@keeex/eslint-config 1.9.2 → 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 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.9.2",
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.32.0",
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
  },
@@ -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",
@@ -49,6 +55,13 @@ const rulesBase = {
49
55
  "@typescript-eslint/indent": [
50
56
  "error",
51
57
  indentDepth,
58
+ {
59
+ "FunctionDeclaration": {"parameters": "first"},
60
+ "FunctionExpression": {"parameters": "first"},
61
+ "CallExpression": {"arguments": "first"},
62
+ "ArrayExpression": "first",
63
+ "ignoreComments": true,
64
+ },
52
65
  ],
53
66
  "@typescript-eslint/member-ordering": [
54
67
  "warn",
@@ -278,6 +291,9 @@ module.exports = {
278
291
  ...importExtends,
279
292
  ];
280
293
  },
294
+ plugins: (presetOptions, allOptions) => {
295
+ if (useTSDoc(allOptions)) return ["eslint-plugin-tsdoc"];
296
+ },
281
297
  rules: (presetOptions, allOptions) => {
282
298
  // There seem to be no way for now to have import understand that ".js" imports should refer
283
299
  // to ".ts" files.
@@ -297,8 +313,12 @@ module.exports = {
297
313
  const deprecationOverride = useDeprecation(presetOptions, allOptions)
298
314
  ? {"deprecation/deprecation": "warn"}
299
315
  : undefined;
316
+ const tsdoc = useTSDoc(allOptions)
317
+ ? {"tsdoc/syntax": "warn"}
318
+ : undefined;
300
319
  return {
301
320
  ...rulesBase,
321
+ ...tsdoc,
302
322
  ...typesOverride,
303
323
  ...importOverride,
304
324
  ...deprecationOverride,