@perfective/eslint-config 0.24.0 → 0.25.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/index.js CHANGED
@@ -15,6 +15,7 @@ module.exports = {
15
15
  './rules/eslint-comments',
16
16
  './rules/import',
17
17
  './rules/jsdoc',
18
+ './rules/n',
18
19
  './rules/node',
19
20
  './rules/prefer-arrow',
20
21
  './rules/promise',
@@ -122,6 +123,9 @@ module.exports = {
122
123
  ],
123
124
  }],
124
125
  'max-nested-callbacks': ['error', 6],
126
+ 'n/no-unpublished-import': ['error', {
127
+ allowModules: ['@jest/globals'],
128
+ }],
125
129
  'prefer-arrow/prefer-arrow-functions': 'off',
126
130
  'promise/always-return': 'off',
127
131
  'rxjs/no-topromise': 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perfective/eslint-config",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "ESLint shareable rules configuration",
5
5
  "keywords": ["code quality", "code standard", "code style", "eslint", "eslint config", "lint", "perfective", "tslint", "tslint config", "typescript"],
6
6
  "author": "Andrey Mikheychik <a.mikheychik@gmail.com>",
@@ -11,30 +11,31 @@
11
11
  },
12
12
  "license": "MIT",
13
13
  "peerDependencies": {
14
- "@babel/eslint-parser": "^7.23.10",
15
- "@stylistic/eslint-plugin": "^1.7.0",
16
- "@typescript-eslint/eslint-plugin": "^6.21.0",
17
- "@typescript-eslint/eslint-plugin-tslint": "^6.21.0",
18
- "@typescript-eslint/parser": "^6.21.0",
14
+ "@babel/eslint-parser": "^7.24.7",
15
+ "@stylistic/eslint-plugin": "^2.1.0",
16
+ "@typescript-eslint/eslint-plugin": "^7.12.0",
17
+ "@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
18
+ "@typescript-eslint/parser": "^7.12.0",
19
19
  "eslint": "^8.57.0",
20
20
  "eslint-import-resolver-typescript": "^3.6.1",
21
21
  "eslint-plugin-array-func": "^4.0.0",
22
- "eslint-plugin-cypress": "^2.15.1",
23
- "eslint-plugin-deprecation": "^2.0.0",
22
+ "eslint-plugin-cypress": "^3.3.0",
23
+ "eslint-plugin-deprecation": "^3.0.0",
24
24
  "eslint-plugin-eslint-comments": "^3.2.0",
25
25
  "eslint-plugin-import": "^2.29.1",
26
- "eslint-plugin-jest": "^27.9.0",
27
- "eslint-plugin-jest-dom": "^5.1.0",
26
+ "eslint-plugin-jest": "^28.6.0",
27
+ "eslint-plugin-jest-dom": "^5.4.0",
28
28
  "eslint-plugin-jest-formatting": "^3.1.0",
29
- "eslint-plugin-jsdoc": "^48.2.1",
29
+ "eslint-plugin-jsdoc": "^48.2.9",
30
+ "eslint-plugin-n": "^17.8.1",
30
31
  "eslint-plugin-node": "^11.1.0",
31
32
  "eslint-plugin-prefer-arrow": "^1.2.3",
32
- "eslint-plugin-promise": "^6.1.1",
33
+ "eslint-plugin-promise": "^6.2.0",
33
34
  "eslint-plugin-rxjs": "^5.0.3",
34
- "eslint-plugin-simple-import-sort": "^12.0.0",
35
- "eslint-plugin-sonarjs": "^0.24.0",
36
- "eslint-plugin-testing-library": "^6.2.0",
37
- "eslint-plugin-unicorn": "^51.0.1",
35
+ "eslint-plugin-simple-import-sort": "^12.1.0",
36
+ "eslint-plugin-sonarjs": "^1.0.3",
37
+ "eslint-plugin-testing-library": "^6.2.2",
38
+ "eslint-plugin-unicorn": "^53.0.0",
38
39
  "tslint": "^6.1.3"
39
40
  },
40
41
  "peerDependenciesMeta": {
@@ -3,6 +3,7 @@ const plugin_1 = require("../../config/plugin");
3
3
  module.exports = (0, plugin_1.optionalConfig)('cypress', {
4
4
  'cypress/assertion-before-screenshot': 'error',
5
5
  'cypress/no-assigning-return-values': 'error',
6
+ 'cypress/no-async-before': 'error',
6
7
  'cypress/no-async-tests': 'error',
7
8
  'cypress/no-force': 'error',
8
9
  'cypress/no-pause': 'error',
@@ -23,10 +23,7 @@ module.exports = {
23
23
  'jsx-quotes': 'off',
24
24
  'key-spacing': 'off',
25
25
  'keyword-spacing': 'off',
26
- 'line-comment-position': ['error', {
27
- position: 'above',
28
- ignorePattern: '^ == .+',
29
- }],
26
+ 'line-comment-position': 'off',
30
27
  'linebreak-style': 'off',
31
28
  'lines-around-comment': 'off',
32
29
  'lines-between-class-members': 'off',
@@ -44,9 +44,7 @@ module.exports = {
44
44
  'max-statements': ['off', {
45
45
  max: 10,
46
46
  }],
47
- 'multiline-comment-style': ['warn', 'separate-lines', {
48
- checkJSDoc: false,
49
- }],
47
+ 'multiline-comment-style': 'off',
50
48
  'new-cap': ['error', {
51
49
  newIsCap: true,
52
50
  capIsNew: true,
@@ -34,7 +34,6 @@ module.exports = {
34
34
  'jest/no-focused-tests': 'warn',
35
35
  'jest/no-hooks': 'off',
36
36
  'jest/no-identical-title': 'error',
37
- 'jest/no-if': 'off',
38
37
  'jest/no-interpolation-in-snapshots': 'error',
39
38
  'jest/no-jasmine-globals': 'warn',
40
39
  'jest/no-large-snapshots': 'error',
@@ -58,6 +57,8 @@ module.exports = {
58
57
  'jest/prefer-expect-resolves': 'warn',
59
58
  'jest/prefer-hooks-in-order': 'error',
60
59
  'jest/prefer-hooks-on-top': 'error',
60
+ 'jest/prefer-importing-jest-globals': 'warn',
61
+ 'jest/prefer-jest-mocked': 'warn',
61
62
  'jest/prefer-lowercase-title': ['error', {
62
63
  allowedPrefixes: [],
63
64
  ignore: [],
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ module.exports = {
3
+ plugins: [
4
+ 'n',
5
+ ],
6
+ rules: {
7
+ 'n/callback-return': ['error', ['callback', 'cb', 'next']],
8
+ 'n/exports-style': ['warn', 'module.exports', { allowBatchAssign: false }],
9
+ 'n/file-extension-in-import': 'off',
10
+ 'n/global-require': 'error',
11
+ 'n/handle-callback-err': 'error',
12
+ 'n/hashbang': 'warn',
13
+ 'n/no-callback-literal': 'error',
14
+ 'n/no-deprecated-api': 'error',
15
+ 'n/no-exports-assign': 'error',
16
+ 'n/no-extraneous-import': 'off',
17
+ 'n/no-extraneous-require': 'off',
18
+ 'n/no-hide-core-modules': 'off',
19
+ 'n/no-missing-import': 'off',
20
+ 'n/no-missing-require': 'off',
21
+ 'n/no-mixed-requires': 'error',
22
+ 'n/no-new-require': 'error',
23
+ 'n/no-path-concat': 'error',
24
+ 'n/no-process-env': 'error',
25
+ 'n/no-process-exit': 'off',
26
+ 'n/no-restricted-import': 'error',
27
+ 'n/no-restricted-require': 'error',
28
+ 'n/no-sync': ['error', {
29
+ allowAtRootLevel: false,
30
+ }],
31
+ 'n/no-unpublished-bin': 'error',
32
+ 'n/no-unpublished-import': 'error',
33
+ 'n/no-unpublished-require': ['error', {
34
+ allowModules: [],
35
+ tryExtensions: ['.js', '.json', '.node'],
36
+ }],
37
+ 'n/no-unsupported-features/es-builtins': ['error', {
38
+ version: '>=18.0.0',
39
+ ignores: [],
40
+ }],
41
+ 'n/no-unsupported-features/es-syntax': 'off',
42
+ 'n/no-unsupported-features/node-builtins': ['error', {
43
+ version: '>=18.0.0',
44
+ ignores: [],
45
+ }],
46
+ 'n/prefer-global/buffer': ['error', 'always'],
47
+ 'n/prefer-global/console': ['error', 'always'],
48
+ 'n/prefer-global/process': ['error', 'always'],
49
+ 'n/prefer-global/text-decoder': ['error', 'always'],
50
+ 'n/prefer-global/text-encoder': ['error', 'always'],
51
+ 'n/prefer-global/url': ['error', 'always'],
52
+ 'n/prefer-global/url-search-params': ['error', 'always'],
53
+ 'n/prefer-node-protocol': 'off',
54
+ 'n/prefer-promises/dns': 'error',
55
+ 'n/prefer-promises/fs': 'error',
56
+ 'n/process-exit-as-throw': 'error',
57
+ 'n/shebang': 'off',
58
+ },
59
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  module.exports = {
3
3
  rules: {
4
- 'node/no-deprecated-api': 'error',
4
+ 'node/no-deprecated-api': 'off',
5
5
  },
6
6
  };
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  module.exports = {
3
3
  rules: {
4
- 'node/handle-callback-err': 'error',
5
- 'node/no-callback-literal': 'error',
6
- 'node/no-exports-assign': 'error',
4
+ 'node/handle-callback-err': 'off',
5
+ 'node/no-callback-literal': 'off',
6
+ 'node/no-exports-assign': 'off',
7
7
  'node/no-extraneous-import': 'off',
8
8
  'node/no-extraneous-require': 'off',
9
9
  'node/no-missing-import': 'off',
10
10
  'node/no-missing-require': 'off',
11
- 'node/no-new-require': 'error',
12
- 'node/no-path-concat': 'error',
11
+ 'node/no-new-require': 'off',
12
+ 'node/no-path-concat': 'off',
13
13
  'node/no-process-exit': 'off',
14
- 'node/no-unpublished-bin': 'error',
15
- 'node/no-unpublished-import': 'error',
16
- 'node/no-unpublished-require': 'error',
17
- 'node/no-unsupported-features/es-builtins': 'error',
14
+ 'node/no-unpublished-bin': 'off',
15
+ 'node/no-unpublished-import': 'off',
16
+ 'node/no-unpublished-require': 'off',
17
+ 'node/no-unsupported-features/es-builtins': 'off',
18
18
  'node/no-unsupported-features/es-syntax': 'off',
19
- 'node/no-unsupported-features/node-builtins': 'error',
20
- 'node/process-exit-as-throw': 'error',
21
- 'node/shebang': 'warn',
19
+ 'node/no-unsupported-features/node-builtins': 'off',
20
+ 'node/process-exit-as-throw': 'off',
21
+ 'node/shebang': 'off',
22
22
  },
23
23
  };
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  module.exports = {
3
3
  rules: {
4
- 'node/callback-return': 'error',
5
- 'node/exports-style': ['error', 'module.exports', { allowBatchAssign: false }],
4
+ 'node/callback-return': 'off',
5
+ 'node/exports-style': ['off', 'module.exports', { allowBatchAssign: false }],
6
6
  'node/file-extension-in-import': 'off',
7
- 'node/global-require': 'error',
8
- 'node/no-mixed-requires': 'error',
9
- 'node/no-process-env': 'error',
10
- 'node/no-restricted-import': 'error',
11
- 'node/no-restricted-require': 'error',
12
- 'node/no-sync': 'error',
13
- 'node/prefer-global/buffer': ['error', 'always'],
14
- 'node/prefer-global/console': ['error', 'always'],
15
- 'node/prefer-global/process': ['error', 'always'],
16
- 'node/prefer-global/text-decoder': ['error', 'always'],
17
- 'node/prefer-global/text-encoder': ['error', 'always'],
18
- 'node/prefer-global/url-search-params': ['error', 'always'],
19
- 'node/prefer-global/url': ['error', 'always'],
20
- 'node/prefer-promises/dns': 'error',
21
- 'node/prefer-promises/fs': 'error',
7
+ 'node/global-require': 'off',
8
+ 'node/no-mixed-requires': 'off',
9
+ 'node/no-process-env': 'off',
10
+ 'node/no-restricted-import': 'off',
11
+ 'node/no-restricted-require': 'off',
12
+ 'node/no-sync': 'off',
13
+ 'node/prefer-global/buffer': ['off', 'always'],
14
+ 'node/prefer-global/console': ['off', 'always'],
15
+ 'node/prefer-global/process': ['off', 'always'],
16
+ 'node/prefer-global/text-decoder': ['off', 'always'],
17
+ 'node/prefer-global/text-encoder': ['off', 'always'],
18
+ 'node/prefer-global/url-search-params': ['off', 'always'],
19
+ 'node/prefer-global/url': ['off', 'always'],
20
+ 'node/prefer-promises/dns': 'off',
21
+ 'node/prefer-promises/fs': 'off',
22
22
  },
23
23
  };
@@ -17,7 +17,7 @@ function simpleImportSortImports(internal = []) {
17
17
  }
18
18
  exports.simpleImportSortImports = simpleImportSortImports;
19
19
  function sideEffects() {
20
- return ['^\\u0000'];
20
+ return [String.raw `^\u0000`];
21
21
  }
22
22
  function nodePrefixedModules() {
23
23
  return ['^node:'];
@@ -37,11 +37,11 @@ function internalPackages(internal) {
37
37
  }
38
38
  exports.internalPackages = internalPackages;
39
39
  function parentImports() {
40
- return ['^\\.\\.(?!/?$)', '^\\.\\./?$'];
40
+ return [String.raw `^\.\.(?!/?$)`, String.raw `^\.\./?$`];
41
41
  }
42
42
  function relativeImports() {
43
- return ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'];
43
+ return [String.raw `^\./(?=.*/)(?!/?$)`, String.raw `^\.(?!/?$)`, String.raw `^\./?$`];
44
44
  }
45
45
  function styleImports() {
46
- return ['^.+\\.s?css$'];
46
+ return [String.raw `^.+\.s?css$`];
47
47
  }
@@ -53,6 +53,10 @@ module.exports = {
53
53
  before: true,
54
54
  after: true,
55
55
  }],
56
+ '@stylistic/js/line-comment-position': ['error', {
57
+ position: 'above',
58
+ ignorePattern: '^ == .+',
59
+ }],
56
60
  '@stylistic/js/linebreak-style': ['warn', 'unix'],
57
61
  '@stylistic/js/lines-around-comment': ['warn', {
58
62
  beforeBlockComment: true,
@@ -81,6 +85,9 @@ module.exports = {
81
85
  '@stylistic/js/max-statements-per-line': ['error', {
82
86
  max: 1,
83
87
  }],
88
+ '@stylistic/js/multiline-comment-style': ['warn', 'separate-lines', {
89
+ checkJSDoc: false,
90
+ }],
84
91
  '@stylistic/js/multiline-ternary': ['warn', 'always-multiline'],
85
92
  '@stylistic/js/new-parens': 'warn',
86
93
  '@stylistic/js/newline-per-chained-call': ['off', {
@@ -27,6 +27,7 @@ module.exports = {
27
27
  }],
28
28
  '@stylistic/jsx/jsx-equals-spacing': ['warn', 'never'],
29
29
  '@stylistic/jsx/jsx-first-prop-new-line': ['warn', 'multiline-multiprop'],
30
+ '@stylistic/jsx/jsx-function-call-newline': ['warn', 'multiline'],
30
31
  '@stylistic/jsx/jsx-indent': ['warn', 4, {
31
32
  checkAttributes: true,
32
33
  indentLogicalExpressions: true,
@@ -11,6 +11,8 @@ module.exports = {
11
11
  '@typescript-eslint/comma-dangle': 'off',
12
12
  'comma-spacing': 'off',
13
13
  '@typescript-eslint/comma-spacing': 'off',
14
+ 'consistent-return': 'off',
15
+ '@typescript-eslint/consistent-return': 'error',
14
16
  'default-param-last': 'off',
15
17
  '@typescript-eslint/default-param-last': 'error',
16
18
  'dot-notation': 'off',
@@ -62,7 +64,8 @@ module.exports = {
62
64
  'no-shadow': 'off',
63
65
  '@typescript-eslint/no-shadow': 'off',
64
66
  'no-throw-literal': 'off',
65
- '@typescript-eslint/no-throw-literal': ['error', {
67
+ '@typescript-eslint/no-throw-literal': 'off',
68
+ '@typescript-eslint/only-throw-error': ['error', {
66
69
  allowThrowingAny: false,
67
70
  allowThrowingUnknown: false,
68
71
  }],
@@ -174,6 +174,7 @@ module.exports = {
174
174
  }],
175
175
  '@typescript-eslint/no-unnecessary-condition': 'warn',
176
176
  '@typescript-eslint/no-unnecessary-qualifier': 'warn',
177
+ '@typescript-eslint/no-unnecessary-template-expression': 'error',
177
178
  '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
178
179
  '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
179
180
  '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
@@ -186,7 +187,7 @@ module.exports = {
186
187
  '@typescript-eslint/no-unsafe-return': 'error',
187
188
  '@typescript-eslint/no-unsafe-unary-minus': 'error',
188
189
  '@typescript-eslint/no-useless-empty-export': 'warn',
189
- '@typescript-eslint/no-useless-template-literals': 'error',
190
+ '@typescript-eslint/no-useless-template-literal': 'off',
190
191
  '@typescript-eslint/no-var-requires': ['error', {
191
192
  allow: [],
192
193
  }],
@@ -229,8 +230,10 @@ module.exports = {
229
230
  '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
230
231
  '@typescript-eslint/prefer-regexp-exec': 'warn',
231
232
  '@typescript-eslint/prefer-return-this-type': 'warn',
232
- '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
233
- '@typescript-eslint/prefer-ts-expect-error': 'warn',
233
+ '@typescript-eslint/prefer-string-starts-ends-with': ['warn', {
234
+ allowSingleElementEquality: 'never',
235
+ }],
236
+ '@typescript-eslint/prefer-ts-expect-error': 'off',
234
237
  '@typescript-eslint/promise-function-async': ['warn', {
235
238
  checkArrowFunctions: false,
236
239
  }],
@@ -247,6 +250,7 @@ module.exports = {
247
250
  }],
248
251
  '@typescript-eslint/restrict-template-expressions': ['error', {
249
252
  allowAny: false,
253
+ allowArray: false,
250
254
  allowBoolean: false,
251
255
  allowNullish: false,
252
256
  allowNumber: false,
@@ -290,5 +294,6 @@ module.exports = {
290
294
  '@typescript-eslint/unified-signatures': ['error', {
291
295
  ignoreDifferentlyNamedParameters: true,
292
296
  }],
297
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
293
298
  },
294
299
  };
@@ -8,6 +8,7 @@ module.exports = {
8
8
  'unicorn/better-regex': 'warn',
9
9
  'unicorn/catch-error-name': 'warn',
10
10
  'unicorn/consistent-destructuring': 'warn',
11
+ 'unicorn/consistent-empty-array-spread': 'warn',
11
12
  'unicorn/consistent-function-scoping': ['error', {
12
13
  checkArrowFunctions: true,
13
14
  }],
@@ -24,6 +25,7 @@ module.exports = {
24
25
  'unicorn/import-style': 'off',
25
26
  'unicorn/new-for-builtins': 'warn',
26
27
  'unicorn/no-abusive-eslint-disable': 'error',
28
+ 'unicorn/no-anonymous-default-export': 'error',
27
29
  'unicorn/no-array-callback-reference': 'off',
28
30
  'unicorn/no-array-for-each': 'off',
29
31
  'unicorn/no-array-method-this-argument': 'warn',
@@ -32,12 +34,14 @@ module.exports = {
32
34
  }],
33
35
  'unicorn/no-array-reduce': 'off',
34
36
  'unicorn/no-await-expression-member': 'error',
37
+ 'unicorn/no-await-in-promise-methods': 'error',
35
38
  'unicorn/no-console-spaces': 'warn',
36
39
  'unicorn/no-document-cookie': 'error',
37
40
  'unicorn/no-empty-file': 'error',
38
41
  'unicorn/no-for-loop': 'warn',
39
42
  'unicorn/no-hex-escape': 'warn',
40
43
  'unicorn/no-instanceof-array': 'warn',
44
+ 'unicorn/no-invalid-fetch-options': 'error',
41
45
  'unicorn/no-invalid-remove-event-listener': 'error',
42
46
  'unicorn/no-keyword-prefix': ['off', {
43
47
  disallowedPrefixes: ['new', 'class'],
@@ -45,6 +49,7 @@ module.exports = {
45
49
  onlyCamelCase: false,
46
50
  }],
47
51
  'unicorn/no-lonely-if': 'warn',
52
+ 'unicorn/no-magic-array-flat-depth': 'error',
48
53
  'unicorn/no-negated-condition': 'warn',
49
54
  'unicorn/no-nested-ternary': 'off',
50
55
  'unicorn/no-new-array': 'warn',
@@ -52,6 +57,7 @@ module.exports = {
52
57
  'unicorn/no-null': 'off',
53
58
  'unicorn/no-object-as-default-parameter': 'error',
54
59
  'unicorn/no-process-exit': 'error',
60
+ 'unicorn/no-single-promise-in-promise-methods': 'warn',
55
61
  'unicorn/no-static-only-class': 'error',
56
62
  'unicorn/no-thenable': 'error',
57
63
  'unicorn/no-this-assignment': 'error',
@@ -120,6 +126,7 @@ module.exports = {
120
126
  'unicorn/prefer-node-protocol': 'warn',
121
127
  'unicorn/prefer-number-properties': ['warn', {
122
128
  checkInfinity: true,
129
+ checkNaN: true,
123
130
  }],
124
131
  'unicorn/prefer-object-from-entries': ['off', {
125
132
  functions: [],
@@ -132,10 +139,12 @@ module.exports = {
132
139
  'unicorn/prefer-set-has': 'warn',
133
140
  'unicorn/prefer-set-size': 'warn',
134
141
  'unicorn/prefer-spread': 'off',
142
+ 'unicorn/prefer-string-raw': 'warn',
135
143
  'unicorn/prefer-string-replace-all': 'off',
136
144
  'unicorn/prefer-string-slice': 'warn',
137
145
  'unicorn/prefer-string-starts-ends-with': 'warn',
138
146
  'unicorn/prefer-string-trim-start-end': 'warn',
147
+ 'unicorn/prefer-structured-clone': 'off',
139
148
  'unicorn/prefer-switch': ['error', {
140
149
  minimumCases: 3,
141
150
  emptyDefaultCase: 'do-nothing-comment',