@aarongoldenthal/eslint-config-standard 27.0.0 → 28.0.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/jest-config.js CHANGED
@@ -1,90 +1,89 @@
1
1
  'use strict';
2
2
 
3
+ const jestPlugin = require('eslint-plugin-jest');
4
+ const globals = require('globals');
5
+
3
6
  module.exports = {
4
- overrides: [
5
- {
6
- env: {
7
- jest: true
8
- },
9
- files: [
10
- '**/__tests__/**/*.[jt]s?(x)',
11
- '**/?(*.)+(spec|test).[jt]s?(x)'
12
- ],
13
- plugins: ['jest'],
14
- rules: {
15
- 'jest/consistent-test-it': [
16
- 'error',
17
- { fn: 'it', withinDescribe: 'it' }
18
- ],
19
- 'jest/expect-expect': 'error',
20
- 'jest/max-expects': ['error', { max: 5 }],
21
- 'jest/max-nested-describe': 'error',
22
- 'jest/no-alias-methods': 'error',
23
- 'jest/no-commented-out-tests': 'error',
24
- 'jest/no-conditional-expect': 'error',
25
- 'jest/no-conditional-in-test': 'error',
26
- 'jest/no-deprecated-functions': 'error',
27
- 'jest/no-disabled-tests': 'error',
28
- 'jest/no-done-callback': 'error',
29
- 'jest/no-duplicate-hooks': 'error',
30
- 'jest/no-export': 'error',
31
- 'jest/no-focused-tests': 'error',
32
- 'jest/no-hooks': 'off',
33
- 'jest/no-identical-title': 'error',
34
- 'jest/no-interpolation-in-snapshots': 'error',
35
- 'jest/no-jasmine-globals': 'error',
36
- 'jest/no-large-snapshots': 'off',
37
- 'jest/no-mocks-import': 'error',
38
- 'jest/no-restricted-matchers': [
39
- 'error',
40
- {
41
- 'not.toBeFalsy': 'Avoid `not.toBeFalsy`',
42
- 'not.toBeTruthy': 'Avoid `not.toBeTruthy`',
43
- 'rejects.not.toBeFalsy':
44
- 'Avoid `rejects.not.toBeFalsy`',
45
- 'rejects.not.toBeTruthy':
46
- 'Avoid `rejects.not.toBeTruthy`',
47
- 'rejects.toBeFalsy': 'Avoid `rejects.toBeFalsy`',
48
- 'rejects.toBeTruthy': 'Avoid `rejects.toBeTruthy`',
49
- 'resolves.not.toBeFalsy':
50
- 'Avoid `resolves.not.toBeFalsy`',
51
- 'resolves.not.toBeTruthy':
52
- 'Avoid `resolves.not.toBeTruthy`',
53
- 'resolves.toBeFalsy': 'Avoid `resolves.toBeFalsy`',
54
- 'resolves.toBeTruthy': 'Avoid `resolves.toBeTruthy`',
55
- toBeFalsy: 'Avoid `toBeFalsy`',
56
- toBeTruthy: 'Avoid `toBeTruthy`'
57
- }
58
- ],
59
- 'jest/no-standalone-expect': 'error',
60
- 'jest/no-test-prefixes': 'error',
61
- 'jest/no-test-return-statement': 'error',
62
- 'jest/no-untyped-mock-factory': 'off',
63
- 'jest/prefer-called-with': 'error',
64
- 'jest/prefer-comparison-matcher': 'error',
65
- 'jest/prefer-each': 'error',
66
- 'jest/prefer-equality-matcher': 'error',
67
- 'jest/prefer-expect-assertions': 'error',
68
- 'jest/prefer-expect-resolves': 'error',
69
- 'jest/prefer-hooks-in-order': 'error',
70
- 'jest/prefer-hooks-on-top': 'error',
71
- 'jest/prefer-lowercase-title': 'error',
72
- 'jest/prefer-mock-promise-shorthand': 'error',
73
- 'jest/prefer-snapshot-hint': 'error',
74
- 'jest/prefer-spy-on': 'error',
75
- 'jest/prefer-strict-equal': 'error',
76
- 'jest/prefer-to-be': 'error',
77
- 'jest/prefer-to-contain': 'error',
78
- 'jest/prefer-to-have-length': 'error',
79
- 'jest/prefer-todo': 'error',
80
- 'jest/require-hook': 'error',
81
- 'jest/require-to-throw-message': 'error',
82
- 'jest/require-top-level-describe': 'error',
83
- 'jest/valid-describe-callback': 'error',
84
- 'jest/valid-expect': 'error',
85
- 'jest/valid-expect-in-promise': 'error',
86
- 'jest/valid-title': 'error'
87
- }
7
+ files: [
8
+ '**/__tests__/**/*.{js,mjs,cjs}',
9
+ '**/?(*.)+(spec|test).{js,mjs,cjs}'
10
+ ],
11
+ languageOptions: {
12
+ globals: {
13
+ ...globals.jest
88
14
  }
89
- ]
15
+ },
16
+ name: 'jest (test files)',
17
+ plugins: { jest: jestPlugin },
18
+ rules: {
19
+ 'jest/consistent-test-it': [
20
+ 'error',
21
+ { fn: 'it', withinDescribe: 'it' }
22
+ ],
23
+ 'jest/expect-expect': 'error',
24
+ 'jest/max-expects': ['error', { max: 5 }],
25
+ 'jest/max-nested-describe': 'error',
26
+ 'jest/no-alias-methods': 'error',
27
+ 'jest/no-commented-out-tests': 'error',
28
+ 'jest/no-conditional-expect': 'error',
29
+ 'jest/no-conditional-in-test': 'error',
30
+ 'jest/no-deprecated-functions': 'error',
31
+ 'jest/no-disabled-tests': 'error',
32
+ 'jest/no-done-callback': 'error',
33
+ 'jest/no-duplicate-hooks': 'error',
34
+ 'jest/no-export': 'error',
35
+ 'jest/no-focused-tests': 'error',
36
+ 'jest/no-hooks': 'off',
37
+ 'jest/no-identical-title': 'error',
38
+ 'jest/no-interpolation-in-snapshots': 'error',
39
+ 'jest/no-jasmine-globals': 'error',
40
+ 'jest/no-large-snapshots': 'off',
41
+ 'jest/no-mocks-import': 'error',
42
+ 'jest/no-restricted-matchers': [
43
+ 'error',
44
+ {
45
+ 'not.toBeFalsy': 'Avoid `not.toBeFalsy`',
46
+ 'not.toBeTruthy': 'Avoid `not.toBeTruthy`',
47
+ 'rejects.not.toBeFalsy': 'Avoid `rejects.not.toBeFalsy`',
48
+ 'rejects.not.toBeTruthy': 'Avoid `rejects.not.toBeTruthy`',
49
+ 'rejects.toBeFalsy': 'Avoid `rejects.toBeFalsy`',
50
+ 'rejects.toBeTruthy': 'Avoid `rejects.toBeTruthy`',
51
+ 'resolves.not.toBeFalsy': 'Avoid `resolves.not.toBeFalsy`',
52
+ 'resolves.not.toBeTruthy': 'Avoid `resolves.not.toBeTruthy`',
53
+ 'resolves.toBeFalsy': 'Avoid `resolves.toBeFalsy`',
54
+ 'resolves.toBeTruthy': 'Avoid `resolves.toBeTruthy`',
55
+ toBeFalsy: 'Avoid `toBeFalsy`',
56
+ toBeTruthy: 'Avoid `toBeTruthy`'
57
+ }
58
+ ],
59
+ 'jest/no-standalone-expect': 'error',
60
+ 'jest/no-test-prefixes': 'error',
61
+ 'jest/no-test-return-statement': 'error',
62
+ 'jest/no-untyped-mock-factory': 'off',
63
+ 'jest/prefer-called-with': 'error',
64
+ 'jest/prefer-comparison-matcher': 'error',
65
+ 'jest/prefer-each': 'error',
66
+ 'jest/prefer-equality-matcher': 'error',
67
+ 'jest/prefer-expect-assertions': 'error',
68
+ 'jest/prefer-expect-resolves': 'error',
69
+ 'jest/prefer-hooks-in-order': 'error',
70
+ 'jest/prefer-hooks-on-top': 'error',
71
+ 'jest/prefer-importing-jest-globals': 'off',
72
+ 'jest/prefer-lowercase-title': 'error',
73
+ 'jest/prefer-mock-promise-shorthand': 'error',
74
+ 'jest/prefer-snapshot-hint': 'error',
75
+ 'jest/prefer-spy-on': 'error',
76
+ 'jest/prefer-strict-equal': 'error',
77
+ 'jest/prefer-to-be': 'error',
78
+ 'jest/prefer-to-contain': 'error',
79
+ 'jest/prefer-to-have-length': 'error',
80
+ 'jest/prefer-todo': 'error',
81
+ 'jest/require-hook': 'error',
82
+ 'jest/require-to-throw-message': 'error',
83
+ 'jest/require-top-level-describe': 'error',
84
+ 'jest/valid-describe-callback': 'error',
85
+ 'jest/valid-expect': 'error',
86
+ 'jest/valid-expect-in-promise': 'error',
87
+ 'jest/valid-title': 'error'
88
+ }
90
89
  };
package/jsdoc-config.js CHANGED
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ const jsdocPlugin = require('eslint-plugin-jsdoc');
4
+
3
5
  module.exports = {
4
- plugins: ['jsdoc'],
6
+ files: ['**/*.{js,mjs,cjs}'],
7
+ name: 'jsdoc (all files)',
8
+ plugins: { jsdoc: jsdocPlugin },
5
9
  rules: {
6
10
  'jsdoc/check-access': 'error', // Recommended
7
11
  'jsdoc/check-alignment': 'error', // Recommended
package/node-config.js CHANGED
@@ -1,47 +1,55 @@
1
1
  'use strict';
2
2
 
3
+ const nodePlugin = require('eslint-plugin-n');
4
+ const globals = require('globals');
5
+
3
6
  module.exports = {
4
- // Included to set various globals, all rules are explicitly defined
5
- extends: ['plugin:n/recommended'],
6
- plugins: ['n'],
7
+ files: ['**/*.{js,mjs,cjs}'],
8
+ languageOptions: {
9
+ globals: {
10
+ ...globals.node
11
+ }
12
+ },
13
+ name: 'node (all files)',
14
+ plugins: { node: nodePlugin },
7
15
  rules: {
8
- 'n/callback-return': 'error',
9
- 'n/exports-style': 'error',
10
- 'n/file-extension-in-import': 'error',
11
- 'n/global-require': 'error',
12
- 'n/handle-callback-err': 'error',
13
- 'n/no-callback-literal': 'off',
14
- 'n/no-deprecated-api': 'error',
15
- 'n/no-exports-assign': 'error',
16
- 'n/no-extraneous-import': 'error',
17
- 'n/no-extraneous-require': 'error',
18
- 'n/no-missing-import': 'error',
19
- 'n/no-missing-require': 'error',
20
- 'n/no-mixed-requires': 'off',
21
- 'n/no-new-require': 'error',
22
- 'n/no-path-concat': 'error',
23
- 'n/no-process-env': 'off',
16
+ 'node/callback-return': 'error',
17
+ 'node/exports-style': 'error',
18
+ 'node/file-extension-in-import': 'error',
19
+ 'node/global-require': 'error',
20
+ 'node/handle-callback-err': 'error',
21
+ 'node/hashbang': 'error',
22
+ 'node/no-callback-literal': 'off',
23
+ 'node/no-deprecated-api': 'error',
24
+ 'node/no-exports-assign': 'error',
25
+ 'node/no-extraneous-import': 'error',
26
+ 'node/no-extraneous-require': 'error',
27
+ 'node/no-missing-import': 'error',
28
+ 'node/no-missing-require': 'error',
29
+ 'node/no-mixed-requires': 'off',
30
+ 'node/no-new-require': 'error',
31
+ 'node/no-path-concat': 'error',
32
+ 'node/no-process-env': 'off',
24
33
  // Disabled in favor of unicorn/no-process-exit
25
- 'n/no-process-exit': 'off',
26
- 'n/no-restricted-import': 'off',
27
- 'n/no-restricted-require': 'off',
28
- 'n/no-sync': 'off',
29
- 'n/no-unpublished-bin': 'error',
30
- 'n/no-unpublished-import': 'error',
31
- 'n/no-unpublished-require': 'error',
32
- 'n/no-unsupported-features/es-builtins': 'error',
33
- 'n/no-unsupported-features/es-syntax': 'error',
34
- 'n/no-unsupported-features/node-builtins': 'error',
35
- 'n/prefer-global/buffer': ['error', 'always'],
36
- 'n/prefer-global/console': ['error', 'always'],
37
- 'n/prefer-global/process': ['error', 'always'],
38
- 'n/prefer-global/text-decoder': ['error', 'always'],
39
- 'n/prefer-global/text-encoder': ['error', 'always'],
40
- 'n/prefer-global/url': ['error', 'always'],
41
- 'n/prefer-global/url-search-params': ['error', 'always'],
42
- 'n/prefer-promises/dns': 'error',
43
- 'n/prefer-promises/fs': 'error',
44
- 'n/process-exit-as-throw': 'error',
45
- 'n/shebang': 'error'
34
+ 'node/no-process-exit': 'off',
35
+ 'node/no-restricted-import': 'off',
36
+ 'node/no-restricted-require': 'off',
37
+ 'node/no-sync': 'off',
38
+ 'node/no-unpublished-bin': 'error',
39
+ 'node/no-unpublished-import': 'error',
40
+ 'node/no-unpublished-require': 'error',
41
+ 'node/no-unsupported-features/es-builtins': 'error',
42
+ 'node/no-unsupported-features/es-syntax': 'error',
43
+ 'node/no-unsupported-features/node-builtins': 'error',
44
+ 'node/prefer-global/buffer': ['error', 'always'],
45
+ 'node/prefer-global/console': ['error', 'always'],
46
+ 'node/prefer-global/process': ['error', 'always'],
47
+ 'node/prefer-global/text-decoder': ['error', 'always'],
48
+ 'node/prefer-global/text-encoder': ['error', 'always'],
49
+ 'node/prefer-global/url': ['error', 'always'],
50
+ 'node/prefer-global/url-search-params': ['error', 'always'],
51
+ 'node/prefer-promises/dns': 'error',
52
+ 'node/prefer-promises/fs': 'error',
53
+ 'node/process-exit-as-throw': 'error'
46
54
  }
47
55
  };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@aarongoldenthal/eslint-config-standard",
3
- "version": "27.0.0",
3
+ "version": "28.0.0",
4
4
  "description": "Standard ESLint configuration settings",
5
- "main": "index.js",
6
5
  "scripts": {
7
6
  "hooks:pre-commit": "npm run lint && npm run prettier:check",
8
7
  "hooks:pre-push": "npm audit --audit-level=high && npm test",
@@ -23,35 +22,38 @@
23
22
  "author": "Aaron Goldenthal <npm@aarongoldenthal.com>",
24
23
  "license": "MIT",
25
24
  "engines": {
26
- "node": "^18.12.0 || >=20.0.0"
25
+ "node": "^18.12.0 || ^20.9.0 || >=22.0.0"
27
26
  },
28
27
  "files": [
29
- "index.js",
30
- "*-config.js",
28
+ "*-config*.js",
31
29
  "recommended*.js"
32
30
  ],
33
31
  "bugs": {
34
32
  "url": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard/issues"
35
33
  },
36
34
  "homepage": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard",
35
+ "dependencies": {
36
+ "@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
37
+ "eslint-config-prettier": "9.1.0",
38
+ "eslint-plugin-jest": "28.5.0",
39
+ "eslint-plugin-jsdoc": "48.2.7",
40
+ "eslint-plugin-n": "17.7.0",
41
+ "eslint-plugin-playwright": "1.6.2",
42
+ "eslint-plugin-promise": "6.2.0",
43
+ "eslint-plugin-sonarjs": "1.0.3",
44
+ "eslint-plugin-unicorn": "53.0.0",
45
+ "eslint-plugin-vitest": "0.5.4",
46
+ "globals": "15.3.0"
47
+ },
37
48
  "devDependencies": {
38
- "eslint": "8.57.0",
49
+ "@eslint/config-inspector": "0.4.10",
50
+ "eslint": "9.4.0",
39
51
  "jest": "29.7.0",
40
52
  "jest-junit": "16.0.0",
41
- "markdownlint-cli2": "0.12.1",
42
- "prettier": "3.2.5"
53
+ "markdownlint-cli2": "0.13.0",
54
+ "prettier": "3.3.0"
43
55
  },
44
56
  "peerDependencies": {
45
- "@eslint-community/eslint-plugin-eslint-comments": "4.1.0",
46
- "eslint": "^8.27.0",
47
- "eslint-config-prettier": "9.1.0",
48
- "eslint-plugin-jest": "27.9.0",
49
- "eslint-plugin-jsdoc": "48.2.1",
50
- "eslint-plugin-n": "16.6.2",
51
- "eslint-plugin-playwright": "1.5.2",
52
- "eslint-plugin-promise": "6.1.1",
53
- "eslint-plugin-sonarjs": "0.24.0",
54
- "eslint-plugin-unicorn": "51.0.1",
55
- "eslint-plugin-vitest": "0.3.24"
57
+ "eslint": "^9.0.0"
56
58
  }
57
59
  }
@@ -1,63 +1,65 @@
1
1
  'use strict';
2
2
 
3
+ const playwrightPlugin = require('eslint-plugin-playwright');
4
+ const globals = require('globals');
5
+
3
6
  const maxExpects = 5;
4
7
 
5
8
  module.exports = {
6
- overrides: [
7
- {
8
- env: {
9
- 'shared-node-browser': true
10
- },
11
- files: ['**/*.pwtest.[jt]s'],
12
- plugins: ['playwright'],
13
- rules: {
14
- 'playwright/expect-expect': 'error',
15
- 'playwright/max-expects': ['error', { max: maxExpects }],
16
- 'playwright/max-nested-describe': 'error',
17
- 'playwright/missing-playwright-await': 'error',
18
- 'playwright/no-commented-out-tests': 'error',
19
- 'playwright/no-conditional-expect': 'error',
20
- 'playwright/no-conditional-in-test': 'error',
21
- 'playwright/no-duplicate-hooks': 'error',
22
- 'playwright/no-element-handle': 'error',
23
- 'playwright/no-eval': 'error',
24
- 'playwright/no-focused-test': 'error',
25
- 'playwright/no-force-option': 'error',
26
- 'playwright/no-get-by-title': 'error',
27
- 'playwright/no-hooks': 'off',
28
- 'playwright/no-nested-step': 'error',
29
- 'playwright/no-networkidle': 'error',
30
- 'playwright/no-nth-methods': 'error',
31
- 'playwright/no-page-pause': 'error',
32
- 'playwright/no-raw-locators': 'error',
33
- 'playwright/no-restricted-matchers': 'off',
34
- 'playwright/no-skipped-test': 'error',
35
- 'playwright/no-standalone-expect': 'error',
36
- 'playwright/no-unsafe-references': 'error',
37
- 'playwright/no-useless-await': 'error',
38
- 'playwright/no-useless-not': 'error',
39
- 'playwright/no-wait-for-selector': 'error',
40
- 'playwright/no-wait-for-timeout': 'error',
41
- 'playwright/prefer-comparison-matcher': 'error',
42
- 'playwright/prefer-equality-matcher': 'error',
43
- 'playwright/prefer-hooks-in-order': 'error',
44
- 'playwright/prefer-hooks-on-top': 'error',
45
- 'playwright/prefer-lowercase-title': 'error',
46
- 'playwright/prefer-strict-equal': 'error',
47
- 'playwright/prefer-to-be': 'error',
48
- 'playwright/prefer-to-contain': 'error',
49
- 'playwright/prefer-to-have-count': 'error',
50
- 'playwright/prefer-to-have-length': 'error',
51
- 'playwright/prefer-web-first-assertions': 'error',
52
- 'playwright/require-hook': 'error',
53
- 'playwright/require-soft-assertions': 'off',
54
- 'playwright/require-to-throw-message': 'error',
55
- 'playwright/require-top-level-describe': 'error',
56
- 'playwright/valid-describe-callback': 'error',
57
- 'playwright/valid-expect': 'error',
58
- 'playwright/valid-expect-in-promise': 'error',
59
- 'playwright/valid-title': 'error'
60
- }
9
+ files: ['**/*.pwtest.{js,mjs,cjs}'],
10
+ languageOptions: {
11
+ globals: {
12
+ ...globals['shared-node-browser']
61
13
  }
62
- ]
14
+ },
15
+ name: 'playwright (pwtest files)',
16
+ plugins: { playwright: playwrightPlugin },
17
+ rules: {
18
+ 'playwright/expect-expect': 'error',
19
+ 'playwright/max-expects': ['error', { max: maxExpects }],
20
+ 'playwright/max-nested-describe': 'error',
21
+ 'playwright/missing-playwright-await': 'error',
22
+ 'playwright/no-commented-out-tests': 'error',
23
+ 'playwright/no-conditional-expect': 'error',
24
+ 'playwright/no-conditional-in-test': 'error',
25
+ 'playwright/no-duplicate-hooks': 'error',
26
+ 'playwright/no-element-handle': 'error',
27
+ 'playwright/no-eval': 'error',
28
+ 'playwright/no-focused-test': 'error',
29
+ 'playwright/no-force-option': 'error',
30
+ 'playwright/no-get-by-title': 'error',
31
+ 'playwright/no-hooks': 'off',
32
+ 'playwright/no-nested-step': 'error',
33
+ 'playwright/no-networkidle': 'error',
34
+ 'playwright/no-nth-methods': 'error',
35
+ 'playwright/no-page-pause': 'error',
36
+ 'playwright/no-raw-locators': 'error',
37
+ 'playwright/no-restricted-matchers': 'off',
38
+ 'playwright/no-skipped-test': 'error',
39
+ 'playwright/no-standalone-expect': 'error',
40
+ 'playwright/no-unsafe-references': 'error',
41
+ 'playwright/no-useless-await': 'error',
42
+ 'playwright/no-useless-not': 'error',
43
+ 'playwright/no-wait-for-selector': 'error',
44
+ 'playwright/no-wait-for-timeout': 'error',
45
+ 'playwright/prefer-comparison-matcher': 'error',
46
+ 'playwright/prefer-equality-matcher': 'error',
47
+ 'playwright/prefer-hooks-in-order': 'error',
48
+ 'playwright/prefer-hooks-on-top': 'error',
49
+ 'playwright/prefer-lowercase-title': 'error',
50
+ 'playwright/prefer-strict-equal': 'error',
51
+ 'playwright/prefer-to-be': 'error',
52
+ 'playwright/prefer-to-contain': 'error',
53
+ 'playwright/prefer-to-have-count': 'error',
54
+ 'playwright/prefer-to-have-length': 'error',
55
+ 'playwright/prefer-web-first-assertions': 'error',
56
+ 'playwright/require-hook': 'error',
57
+ 'playwright/require-soft-assertions': 'off',
58
+ 'playwright/require-to-throw-message': 'error',
59
+ 'playwright/require-top-level-describe': 'error',
60
+ 'playwright/valid-describe-callback': 'error',
61
+ 'playwright/valid-expect': 'error',
62
+ 'playwright/valid-expect-in-promise': 'error',
63
+ 'playwright/valid-title': 'error'
64
+ }
63
65
  };
package/promise-config.js CHANGED
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ const promisePlugin = require('eslint-plugin-promise');
4
+
3
5
  module.exports = {
4
- plugins: ['promise'],
6
+ files: ['**/*.{js,mjs,cjs}'],
7
+ name: 'promise (all files)',
8
+ plugins: { promise: promisePlugin },
5
9
  rules: {
6
10
  'promise/always-return': 'error',
7
11
  'promise/avoid-new': 'error',
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ const eslintCommentsConfig = require('./eslint-comments-config.js');
4
+ const jsdocConfig = require('./jsdoc-config.js');
5
+ const nodeConfig = require('./node-config.js');
6
+ const playwrightConfig = require('./playwright-config.js');
7
+ const promiseConfig = require('./promise-config.js');
8
+ const sonarjsConfig = require('./sonarjs-config.js');
9
+ const unicornConfigs = require('./unicorn-configs.js');
10
+ const vitestConfig = require('./vitest-config.js');
11
+ const baseConfigs = require('./base-configs.js');
12
+ const esmConfig = require('./esm-config.js');
13
+ const prettierConfig = require('eslint-config-prettier');
14
+
15
+ module.exports = [
16
+ eslintCommentsConfig,
17
+ jsdocConfig,
18
+ nodeConfig,
19
+ playwrightConfig,
20
+ promiseConfig,
21
+ sonarjsConfig,
22
+ ...unicornConfigs,
23
+ vitestConfig,
24
+ ...baseConfigs,
25
+ esmConfig,
26
+ prettierConfig
27
+ ];
package/recommended.js CHANGED
@@ -1,16 +1,25 @@
1
1
  'use strict';
2
2
 
3
- module.exports = {
4
- extends: [
5
- './eslint-comments-config.js',
6
- './jest-config.js',
7
- './jsdoc-config.js',
8
- './node-config.js',
9
- './playwright-config.js',
10
- './promise-config.js',
11
- './sonarjs-config.js',
12
- './unicorn-config.js',
13
- './index.js',
14
- 'prettier'
15
- ]
16
- };
3
+ const eslintCommentsConfig = require('./eslint-comments-config.js');
4
+ const jestConfig = require('./jest-config.js');
5
+ const jsdocConfig = require('./jsdoc-config.js');
6
+ const nodeConfig = require('./node-config.js');
7
+ const playwrightConfig = require('./playwright-config.js');
8
+ const promiseConfig = require('./promise-config.js');
9
+ const sonarjsConfig = require('./sonarjs-config.js');
10
+ const unicornConfigs = require('./unicorn-configs.js');
11
+ const baseConfigs = require('./base-configs.js');
12
+ const prettierConfig = require('eslint-config-prettier');
13
+
14
+ module.exports = [
15
+ eslintCommentsConfig,
16
+ jestConfig,
17
+ jsdocConfig,
18
+ nodeConfig,
19
+ playwrightConfig,
20
+ promiseConfig,
21
+ sonarjsConfig,
22
+ ...unicornConfigs,
23
+ ...baseConfigs,
24
+ { name: 'prettier (all files)', ...prettierConfig }
25
+ ];
package/sonarjs-config.js CHANGED
@@ -1,13 +1,21 @@
1
1
  'use strict';
2
2
 
3
- const cognitiveComplexityThreshold = 5;
3
+ const cognitiveComplexityThresholdLow = 5;
4
+ const cognitiveComplexityThresholdHigh = 15;
4
5
  const maxSwitchCasesThreshold = 30;
5
6
  const noDuplicateStringThreshold = 3;
6
7
 
8
+ const sonarjsPlugin = require('eslint-plugin-sonarjs');
9
+
7
10
  module.exports = {
8
- plugins: ['sonarjs'],
11
+ files: ['**/*.{js,mjs,cjs}'],
12
+ name: 'sonarjs (all files)',
13
+ plugins: { sonarjs: sonarjsPlugin, sonarjs2: sonarjsPlugin },
9
14
  rules: {
10
- 'sonarjs/cognitive-complexity': ['error', cognitiveComplexityThreshold],
15
+ 'sonarjs/cognitive-complexity': [
16
+ 'error',
17
+ cognitiveComplexityThresholdLow
18
+ ],
11
19
  'sonarjs/elseif-without-else': 'error',
12
20
  'sonarjs/max-switch-cases': ['error', maxSwitchCasesThreshold],
13
21
  'sonarjs/no-all-duplicated-branches': 'error',
@@ -41,6 +49,10 @@ module.exports = {
41
49
  'sonarjs/prefer-immediate-return': 'error',
42
50
  'sonarjs/prefer-object-literal': 'error',
43
51
  'sonarjs/prefer-single-boolean-return': 'error',
44
- 'sonarjs/prefer-while': 'error'
52
+ 'sonarjs/prefer-while': 'error',
53
+ 'sonarjs2/cognitive-complexity': [
54
+ 'error',
55
+ cognitiveComplexityThresholdHigh
56
+ ]
45
57
  }
46
58
  };