File tree Expand file tree Collapse file tree 3 files changed +56
-24
lines changed Expand file tree Collapse file tree 3 files changed +56
-24
lines changed Original file line number Diff line number Diff line change @@ -118,33 +118,39 @@ as failing errors, you may use the "recommended-error" config:
118118```
119119
120120If you plan to use TypeScript syntax (and not just "typescript"
121- ` mode ` to indicate the JSDoc flavor is TypeScript), you can configure
122- the following:
121+ ` mode ` to indicate the JSDoc flavor is TypeScript), you can use:
123122
124- ``` javascript
123+ ``` json
125124{
126- " rules" : {
127- " jsdoc/no-types" : 1 ,
128- " jsdoc/require-param-type" : 0 ,
129- " jsdoc/require-property-type" : 0 ,
130- " jsdoc/require-returns-type" : 0 ,
131- }
125+ "extends" : [" plugin:jsdoc/recommended-typescript" ]
132126}
133127```
134128
135- ...or just use :
129+ ...or to report with failing errors instead of mere warnings :
136130
137131``` json
138132{
139- "extends" : [" plugin:jsdoc/recommended-typescript" ]
133+ "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
134+ }
135+ ```
136+
137+ If you are not using TypeScript syntax (your source files are still ` .js ` files)
138+ but you are using the TypeScript flavor within JSDoc (i.e., the default
139+ "typescript" ` mode ` in ` eslint-plugin-jsdoc ` ) and you are perhaps using
140+ ` allowJs ` and ` checkJs ` options of TypeScript's ` tsconfig.json ` ), you may
141+ use:
142+
143+ ``` json
144+ {
145+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor" ]
140146}
141147```
142148
143149...or to report with failing errors instead of mere warnings:
144150
145151``` json
146152{
147- "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
153+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor- error" ]
148154}
149155```
150156
Original file line number Diff line number Diff line change @@ -131,33 +131,39 @@ as failing errors, you may use the "recommended-error" config:
131131```
132132
133133If you plan to use TypeScript syntax (and not just "typescript"
134- ` mode ` to indicate the JSDoc flavor is TypeScript), you can configure
135- the following:
134+ ` mode ` to indicate the JSDoc flavor is TypeScript), you can use:
136135
137- ``` javascript
136+ ``` json
138137{
139- " rules" : {
140- " jsdoc/no-types" : 1 ,
141- " jsdoc/require-param-type" : 0 ,
142- " jsdoc/require-property-type" : 0 ,
143- " jsdoc/require-returns-type" : 0 ,
144- }
138+ "extends" : [" plugin:jsdoc/recommended-typescript" ]
145139}
146140```
147141
148- ...or just use :
142+ ...or to report with failing errors instead of mere warnings :
149143
150144``` json
151145{
152- "extends" : [" plugin:jsdoc/recommended-typescript" ]
146+ "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
147+ }
148+ ```
149+
150+ If you are not using TypeScript syntax (your source files are still ` .js ` files)
151+ but you are using the TypeScript flavor within JSDoc (i.e., the default
152+ "typescript" ` mode ` in ` eslint-plugin-jsdoc ` ) and you are perhaps using
153+ ` allowJs ` and ` checkJs ` options of TypeScript's ` tsconfig.json ` ), you may
154+ use:
155+
156+ ``` json
157+ {
158+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor" ]
153159}
154160```
155161
156162...or to report with failing errors instead of mere warnings:
157163
158164``` json
159165{
160- "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
166+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor- error" ]
161167}
162168```
163169
Original file line number Diff line number Diff line change @@ -205,6 +205,24 @@ const createRecommendedTypeScriptRuleset = (warnOrError) => {
205205 } ;
206206} ;
207207
208+ /**
209+ * @param {"warn"|"error" } warnOrError
210+ * @returns {import('eslint').ESLint.ConfigData }
211+ */
212+ const createRecommendedTypeScriptFlavorRuleset = ( warnOrError ) => {
213+ const ruleset = createRecommendedRuleset ( warnOrError ) ;
214+
215+ return {
216+ ...ruleset ,
217+ rules : {
218+ ...ruleset . rules ,
219+ /* eslint-disable indent -- Extra indent to avoid use by auto-rule-editing */
220+ 'jsdoc/no-undefined-types' : 'off' ,
221+ /* eslint-enable indent */
222+ } ,
223+ } ;
224+ } ;
225+
208226/* istanbul ignore if -- TS */
209227if ( ! index . configs ) {
210228 throw new Error ( 'TypeScript guard' ) ;
@@ -214,5 +232,7 @@ index.configs.recommended = createRecommendedRuleset('warn');
214232index . configs [ 'recommended-error' ] = createRecommendedRuleset ( 'error' ) ;
215233index . configs [ 'recommended-typescript' ] = createRecommendedTypeScriptRuleset ( 'warn' ) ;
216234index . configs [ 'recommended-typescript-error' ] = createRecommendedTypeScriptRuleset ( 'error' ) ;
235+ index . configs [ 'recommended-typescript-flavor' ] = createRecommendedTypeScriptFlavorRuleset ( 'warn' ) ;
236+ index . configs [ 'recommended-typescript-flavor-error' ] = createRecommendedTypeScriptFlavorRuleset ( 'error' ) ;
217237
218238export default index ;
You can’t perform that action at this time.
0 commit comments