File tree 3 files changed +56
-24
lines changed 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:
118
118
```
119
119
120
120
If 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:
123
122
124
- ``` javascript
123
+ ``` json
125
124
{
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" ]
132
126
}
133
127
```
134
128
135
- ...or just use :
129
+ ...or to report with failing errors instead of mere warnings :
136
130
137
131
``` json
138
132
{
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" ]
140
146
}
141
147
```
142
148
143
149
...or to report with failing errors instead of mere warnings:
144
150
145
151
``` json
146
152
{
147
- "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
153
+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor- error" ]
148
154
}
149
155
```
150
156
Original file line number Diff line number Diff line change @@ -131,33 +131,39 @@ as failing errors, you may use the "recommended-error" config:
131
131
```
132
132
133
133
If 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:
136
135
137
- ``` javascript
136
+ ``` json
138
137
{
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" ]
145
139
}
146
140
```
147
141
148
- ...or just use :
142
+ ...or to report with failing errors instead of mere warnings :
149
143
150
144
``` json
151
145
{
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" ]
153
159
}
154
160
```
155
161
156
162
...or to report with failing errors instead of mere warnings:
157
163
158
164
``` json
159
165
{
160
- "extends" : [" plugin:jsdoc/recommended-typescript-error" ]
166
+ "extends" : [" plugin:jsdoc/recommended-typescript-flavor- error" ]
161
167
}
162
168
```
163
169
Original file line number Diff line number Diff line change @@ -205,6 +205,24 @@ const createRecommendedTypeScriptRuleset = (warnOrError) => {
205
205
} ;
206
206
} ;
207
207
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
+
208
226
/* istanbul ignore if -- TS */
209
227
if ( ! index . configs ) {
210
228
throw new Error ( 'TypeScript guard' ) ;
@@ -214,5 +232,7 @@ index.configs.recommended = createRecommendedRuleset('warn');
214
232
index . configs [ 'recommended-error' ] = createRecommendedRuleset ( 'error' ) ;
215
233
index . configs [ 'recommended-typescript' ] = createRecommendedTypeScriptRuleset ( 'warn' ) ;
216
234
index . configs [ 'recommended-typescript-error' ] = createRecommendedTypeScriptRuleset ( 'error' ) ;
235
+ index . configs [ 'recommended-typescript-flavor' ] = createRecommendedTypeScriptFlavorRuleset ( 'warn' ) ;
236
+ index . configs [ 'recommended-typescript-flavor-error' ] = createRecommendedTypeScriptFlavorRuleset ( 'error' ) ;
217
237
218
238
export default index ;
You can’t perform that action at this time.
0 commit comments