@keeex/eslint-config 1.9.3 → 1.10.1

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 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,13 +1,14 @@
1
1
  {
2
2
  "name": "@keeex/eslint-config",
3
3
  "description": "Common eslint configuration",
4
- "version": "1.9.3",
4
+ "version": "1.10.1",
5
5
  "main": "src/index.js",
6
6
  "files": [
7
7
  "src/**/*.js"
8
8
  ],
9
9
  "scripts": {
10
10
  "check": "npx eslint .",
11
+ "prepublishOnly": "publish_check.sh",
11
12
  "test": "echo No test for this project"
12
13
  },
13
14
  "repository": {
@@ -23,7 +24,7 @@
23
24
  ],
24
25
  "license": "MIT",
25
26
  "devDependencies": {
26
- "eslint": "^8.32.0",
27
+ "eslint": "^8.40.0",
27
28
  "eslint-plugin-import": "^2.27.5",
28
29
  "eslint-plugin-promise": "^6.1.1"
29
30
  },
@@ -39,7 +40,8 @@
39
40
  "eslint-plugin-promise": "6.x",
40
41
  "eslint-plugin-react": "7.x",
41
42
  "eslint-plugin-react-hooks": "4.x",
42
- "eslint-plugin-react-native": "4.x"
43
+ "eslint-plugin-react-native": "4.x",
44
+ "eslint-plugin-tsdoc": "0.x"
43
45
  },
44
46
  "peerDependenciesMeta": {
45
47
  "eslint": {
@@ -51,6 +53,9 @@
51
53
  "@typescript-eslint/parser": {
52
54
  "optional": true
53
55
  },
56
+ "eslint-plugin-tsdoc": {
57
+ "optional": true
58
+ },
54
59
  "eslint-plugin-react": {
55
60
  "optional": true
56
61
  },
@@ -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",
@@ -213,6 +219,7 @@ const rulesBase = {
213
219
  "allowCallbacks": "always",
214
220
  "allowMappedTypes": "always",
215
221
  "allowGenerics": "always",
222
+ "allowConditionalTypes": "always",
216
223
  },
217
224
  ],
218
225
  "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"],
@@ -285,6 +292,9 @@ module.exports = {
285
292
  ...importExtends,
286
293
  ];
287
294
  },
295
+ plugins: (presetOptions, allOptions) => {
296
+ if (useTSDoc(allOptions)) return ["eslint-plugin-tsdoc"];
297
+ },
288
298
  rules: (presetOptions, allOptions) => {
289
299
  // There seem to be no way for now to have import understand that ".js" imports should refer
290
300
  // to ".ts" files.
@@ -304,8 +314,12 @@ module.exports = {
304
314
  const deprecationOverride = useDeprecation(presetOptions, allOptions)
305
315
  ? {"deprecation/deprecation": "warn"}
306
316
  : undefined;
317
+ const tsdoc = useTSDoc(allOptions)
318
+ ? {"tsdoc/syntax": "warn"}
319
+ : undefined;
307
320
  return {
308
321
  ...rulesBase,
322
+ ...tsdoc,
309
323
  ...typesOverride,
310
324
  ...importOverride,
311
325
  ...deprecationOverride,