@keeex/eslint-config 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/package.json +7 -3
- package/src/config/typescript.js +13 -0
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ module.exports = eslintConfig(
|
|
|
24
24
|
reacthooks: true,
|
|
25
25
|
reactnative: true,
|
|
26
26
|
typescript: "./tsconfig.json",
|
|
27
|
+
tsdoc: true,
|
|
27
28
|
deprecation: true,
|
|
28
29
|
mocha: true,
|
|
29
30
|
},
|
|
@@ -108,6 +109,10 @@ Instead, it is advised to provide the path to the typescript configuration file
|
|
|
108
109
|
(typically `tsconfig.json`), in which case rules that requires typing
|
|
109
110
|
informations are enabled.
|
|
110
111
|
|
|
112
|
+
### TSDoc
|
|
113
|
+
For TypeScript projects, the `eslint-plugin-tsdoc` is enabled by default.
|
|
114
|
+
To disable it, use the `tsdoc` config property set to `false`.
|
|
115
|
+
|
|
111
116
|
### Deprecation
|
|
112
117
|
Warn when using deprecated calls/properties.
|
|
113
118
|
This only work with TypeScript enabled with project types.
|
|
@@ -157,7 +162,7 @@ Dependencies
|
|
|
157
162
|
|
|
158
163
|
Depend on `eslint`.
|
|
159
164
|
If typescript is enabled, `@typescript-eslint/eslint-plugin`,
|
|
160
|
-
`@typescript-eslint/parser` must be installed.
|
|
165
|
+
`@typescript-eslint/parser`, `eslint-plugin-tsdoc` must be installed.
|
|
161
166
|
If deprecation is enabled, `eslint-plugin-deprecation` must be installed.
|
|
162
167
|
If React/JSX is enabled, `eslint-plugin-react` must be installed.
|
|
163
168
|
If React Hooks is enabled, `eslint-plugin-react-hooks` must be installed.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keeex/eslint-config",
|
|
3
3
|
"description": "Common eslint configuration",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src/**/*.js"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"eslint": "^8.
|
|
26
|
+
"eslint": "^8.40.0",
|
|
27
27
|
"eslint-plugin-import": "^2.27.5",
|
|
28
28
|
"eslint-plugin-promise": "^6.1.1"
|
|
29
29
|
},
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"eslint-plugin-promise": "6.x",
|
|
40
40
|
"eslint-plugin-react": "7.x",
|
|
41
41
|
"eslint-plugin-react-hooks": "4.x",
|
|
42
|
-
"eslint-plugin-react-native": "4.x"
|
|
42
|
+
"eslint-plugin-react-native": "4.x",
|
|
43
|
+
"eslint-plugin-tsdoc": "0.x"
|
|
43
44
|
},
|
|
44
45
|
"peerDependenciesMeta": {
|
|
45
46
|
"eslint": {
|
|
@@ -51,6 +52,9 @@
|
|
|
51
52
|
"@typescript-eslint/parser": {
|
|
52
53
|
"optional": true
|
|
53
54
|
},
|
|
55
|
+
"eslint-plugin-tsdoc": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
54
58
|
"eslint-plugin-react": {
|
|
55
59
|
"optional": true
|
|
56
60
|
},
|
package/src/config/typescript.js
CHANGED
|
@@ -15,6 +15,12 @@ const useDeprecation = (presetOptions, allOptions) => {
|
|
|
15
15
|
return allOptions[deprecationKey] === true;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
const useTSDoc = allOptions => {
|
|
19
|
+
const tsdocOptions = allOptions.tsdoc;
|
|
20
|
+
if (tsdocOptions !== undefined && tsdocOptions === false) return false;
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
|
|
18
24
|
const rulesBase = {
|
|
19
25
|
"@typescript-eslint/array-type": [
|
|
20
26
|
"error",
|
|
@@ -285,6 +291,9 @@ module.exports = {
|
|
|
285
291
|
...importExtends,
|
|
286
292
|
];
|
|
287
293
|
},
|
|
294
|
+
plugins: (presetOptions, allOptions) => {
|
|
295
|
+
if (useTSDoc(allOptions)) return ["eslint-plugin-tsdoc"];
|
|
296
|
+
},
|
|
288
297
|
rules: (presetOptions, allOptions) => {
|
|
289
298
|
// There seem to be no way for now to have import understand that ".js" imports should refer
|
|
290
299
|
// to ".ts" files.
|
|
@@ -304,8 +313,12 @@ module.exports = {
|
|
|
304
313
|
const deprecationOverride = useDeprecation(presetOptions, allOptions)
|
|
305
314
|
? {"deprecation/deprecation": "warn"}
|
|
306
315
|
: undefined;
|
|
316
|
+
const tsdoc = useTSDoc(allOptions)
|
|
317
|
+
? {"tsdoc/syntax": "warn"}
|
|
318
|
+
: undefined;
|
|
307
319
|
return {
|
|
308
320
|
...rulesBase,
|
|
321
|
+
...tsdoc,
|
|
309
322
|
...typesOverride,
|
|
310
323
|
...importOverride,
|
|
311
324
|
...deprecationOverride,
|