@aarongoldenthal/eslint-config-standard 17.0.1 → 19.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/README.md CHANGED
@@ -1,25 +1,28 @@
1
1
  # @aarongoldenthal/eslint-config-standard
2
2
 
3
- Custom standard ESLint configuration for all projects. Includes configurations for `eslint`, `eslint-plugin-jest`, `eslint-plugin-jsdoc`, `eslint-plugin-node`, `eslint-plugin-sonarjs`, and `eslint-plugin-unicorn`. Defines all required configurations as `dependencies` so they are installed and do not have to be defined in each project.
3
+ ## Summary
4
4
 
5
- To configure .eslintrc.json for all plugins:
5
+ Custom standard ESLint configuration for all projects. Includes configurations for `eslint`, `eslint-plugin-jest`, `eslint-plugin-jsdoc`, `eslint-plugin-n` (formerly `eslint-plugin-node`), `eslint-plugin-playwright`, `eslint-plugin-promise`, `eslint-plugin-sonarjs`, and `eslint-plugin-unicorn`. This package defines all required configurations as `dependencies` so they are installed and do not have to be defined in each project.
6
+
7
+ Per recommended best practices, the following configurations include `overrides` so they are only applicable to a subset of files:
8
+
9
+ - `jest-config`: applicable to files matching `['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)']`,
10
+ which is the [default filter for Jest test files](https://jestjs.io/docs/configuration#testmatch-arraystring).
11
+ - `playwright-config`: applicable to files matching `['**/*.pwtest.[jt]s']`, which differentiates them from Jest test files.
12
+
13
+ The configuration as-defined includes a number of formatting rules. The `eslint-config-prettier` package is included as well, and can be added to the config if `prettier` is also being used so it takes priority for formatting.
14
+
15
+ ### Usage
16
+
17
+ There is a `recommended` configuration with all plugin configurations enabled (including `prettier`). To configure .eslintrc.json with this configuration:
6
18
 
7
19
  ```json
8
20
  {
9
- "extends": [
10
- "@aarongoldenthal/eslint-config-standard/jest-config",
11
- "@aarongoldenthal/eslint-config-standard/jsdoc-config",
12
- "@aarongoldenthal/eslint-config-standard/node-config",
13
- "@aarongoldenthal/eslint-config-standard/sonarjs-config",
14
- "@aarongoldenthal/eslint-config-standard/unicorn-config",
15
- "@aarongoldenthal/eslint-config-standard"
16
- ]
21
+ "extends": ["@aarongoldenthal/eslint-config-standard/recommended"]
17
22
  }
18
23
  ```
19
24
 
20
- Note `@aarongoldenthal/eslint-config-standard` is included last so those settings take precendence.
21
-
22
- The configuration as-defined includes a number of formatting rules. The `eslint-config-prettier` package is included as well, and can be added to the config if `prettier` is also being used so it takes priority for formatting.
25
+ To configure .eslintrc.json with individual plugins, use the appropriate subset of the options below:
23
26
 
24
27
  ```json
25
28
  {
@@ -27,6 +30,8 @@ The configuration as-defined includes a number of formatting rules. The `eslint-
27
30
  "@aarongoldenthal/eslint-config-standard/jest-config",
28
31
  "@aarongoldenthal/eslint-config-standard/jsdoc-config",
29
32
  "@aarongoldenthal/eslint-config-standard/node-config",
33
+ "@aarongoldenthal/eslint-config-standard/playwright-config",
34
+ "@aarongoldenthal/eslint-config-standard/promise-config",
30
35
  "@aarongoldenthal/eslint-config-standard/sonarjs-config",
31
36
  "@aarongoldenthal/eslint-config-standard/unicorn-config",
32
37
  "@aarongoldenthal/eslint-config-standard",
@@ -35,4 +40,7 @@ The configuration as-defined includes a number of formatting rules. The `eslint-
35
40
  }
36
41
  ```
37
42
 
38
- In this case `prettier` is included last to take priority in disabling the applicable rules from all other configurations.
43
+ Notes:
44
+
45
+ - If used, the `@aarongoldenthal/eslint-config-standard` config should be included after any other `@aarongoldenthal/eslint-config-standard/*` configurations so those settings take precedence.
46
+ - If used, the `prettier` should be included last to take priority in disabling the applicable rules from all other configurations.
package/index.js CHANGED
@@ -8,12 +8,12 @@ const nestedThreshold = 5;
8
8
 
9
9
  module.exports = {
10
10
  env: {
11
- es6: true,
11
+ es2022: true,
12
12
  node: true
13
13
  },
14
14
  extends: ['eslint:recommended'],
15
15
  parserOptions: {
16
- ecmaVersion: 2021,
16
+ ecmaVersion: 2022,
17
17
  sourceType: 'script'
18
18
  },
19
19
  reportUnusedDisableDirectives: true,
@@ -42,6 +42,7 @@ module.exports = {
42
42
  'keyword-spacing': ['error', { before: true, after: true }],
43
43
  'linebreak-style': ['error', 'unix'],
44
44
  'lines-between-class-members': ['error', 'always'],
45
+ 'logical-assignment-operators': ['error', 'always'],
45
46
  'max-depth': ['error', { max: nestedThreshold }],
46
47
  'max-lines': ['error', maxLinesThreshold],
47
48
  'max-lines-per-function': [
@@ -62,6 +63,7 @@ module.exports = {
62
63
  'no-div-regex': 'error',
63
64
  'no-duplicate-imports': 'error',
64
65
  'no-else-return': 'error',
66
+ 'no-empty-static-block': 'error',
65
67
  'no-eq-null': 'error',
66
68
  'no-eval': 'error',
67
69
  'no-extend-native': 'error',
@@ -81,6 +83,7 @@ module.exports = {
81
83
  'no-nested-ternary': 'off',
82
84
  'no-new': 'error',
83
85
  'no-new-func': 'error',
86
+ 'no-new-native-nonconstructor': 'error',
84
87
  'no-new-object': 'error',
85
88
  'no-new-wrappers': 'error',
86
89
  'no-param-reassign': ['error', { props: false }],
package/node-config.js CHANGED
@@ -2,46 +2,46 @@
2
2
 
3
3
  module.exports = {
4
4
  // Included to set various globals, all rules are explicitly defined
5
- extends: ['plugin:node/recommended'],
6
- plugins: ['node'],
5
+ extends: ['plugin:n/recommended'],
6
+ plugins: ['n'],
7
7
  rules: {
8
- 'node/callback-return': 'error',
9
- 'node/exports-style': 'error',
10
- 'node/file-extension-in-import': 'error',
11
- 'node/global-require': 'error',
12
- 'node/handle-callback-err': 'error',
13
- 'node/no-callback-literal': 'off',
14
- 'node/no-deprecated-api': 'error',
15
- 'node/no-exports-assign': 'error',
16
- 'node/no-extraneous-import': 'error',
17
- 'node/no-extraneous-require': 'error',
18
- 'node/no-missing-import': 'error',
19
- 'node/no-missing-require': 'error',
20
- 'node/no-mixed-requires': 'off',
21
- 'node/no-new-require': 'error',
22
- 'node/no-path-concat': 'error',
23
- 'node/no-process-env': 'off',
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',
24
24
  // Disabled in favor of unicorn/no-process-exit
25
- 'node/no-process-exit': 'off',
26
- 'node/no-restricted-import': 'off',
27
- 'node/no-restricted-require': 'off',
28
- 'node/no-sync': 'off',
29
- 'node/no-unpublished-bin': 'error',
30
- 'node/no-unpublished-import': 'error',
31
- 'node/no-unpublished-require': 'error',
32
- 'node/no-unsupported-features/es-builtins': 'error',
33
- 'node/no-unsupported-features/es-syntax': 'error',
34
- 'node/no-unsupported-features/node-builtins': 'error',
35
- 'node/prefer-global/buffer': ['error', 'always'],
36
- 'node/prefer-global/console': ['error', 'always'],
37
- 'node/prefer-global/process': ['error', 'always'],
38
- 'node/prefer-global/text-decoder': ['error', 'always'],
39
- 'node/prefer-global/text-encoder': ['error', 'always'],
40
- 'node/prefer-global/url-search-params': ['error', 'always'],
41
- 'node/prefer-global/url': ['error', 'always'],
42
- 'node/prefer-promises/dns': 'error',
43
- 'node/prefer-promises/fs': 'error',
44
- 'node/process-exit-as-throw': 'error',
45
- 'node/shebang': 'error'
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-search-params': ['error', 'always'],
41
+ 'n/prefer-global/url': ['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'
46
46
  }
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarongoldenthal/eslint-config-standard",
3
- "version": "17.0.1",
3
+ "version": "19.0.0",
4
4
  "description": "Standard ESLint configuration settings",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,20 +35,22 @@
35
35
  "homepage": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard",
36
36
  "dependencies": {
37
37
  "eslint-config-prettier": "^8.5.0",
38
- "eslint-plugin-jest": "^27.0.1",
39
- "eslint-plugin-jsdoc": "^39.3.6",
40
- "eslint-plugin-node": "^11.1.0",
41
- "eslint-plugin-sonarjs": "^0.15.0",
42
- "eslint-plugin-unicorn": "^43.0.2"
38
+ "eslint-plugin-jest": "^27.1.7",
39
+ "eslint-plugin-jsdoc": "^39.6.4",
40
+ "eslint-plugin-n": "^15.6.0",
41
+ "eslint-plugin-playwright": "^0.11.2",
42
+ "eslint-plugin-promise": "^6.1.1",
43
+ "eslint-plugin-sonarjs": "^0.17.0",
44
+ "eslint-plugin-unicorn": "^45.0.2"
43
45
  },
44
46
  "devDependencies": {
45
- "eslint": "^8.23.0",
46
- "jest": "^29.0.2",
47
- "jest-junit": "^14.0.1",
47
+ "eslint": "^8.30.0",
48
+ "jest": "^29.3.1",
49
+ "jest-junit": "^15.0.0",
48
50
  "markdownlint-cli": "^0.32.2",
49
- "prettier": "^2.7.1"
51
+ "prettier": "^2.8.1"
50
52
  },
51
53
  "peerDependencies": {
52
- "eslint": "^8.14.0"
54
+ "eslint": "^8.27.0"
53
55
  }
54
56
  }
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ overrides: [
5
+ {
6
+ files: ['**/*.pwtest.[jt]s'],
7
+ plugins: ['playwright'],
8
+ env: {
9
+ 'shared-node-browser': true
10
+ },
11
+ rules: {
12
+ 'playwright/max-nested-describe': 'error',
13
+ 'playwright/missing-playwright-await': 'error',
14
+ 'playwright/no-conditional-in-test': 'error',
15
+ 'playwright/no-element-handle': 'error',
16
+ 'playwright/no-eval': 'error',
17
+ 'playwright/no-focused-test': 'error',
18
+ 'playwright/no-force-option': 'error',
19
+ 'playwright/no-page-pause': 'error',
20
+ 'playwright/no-skipped-test': 'error',
21
+ 'playwright/no-useless-not': 'error',
22
+ 'playwright/no-wait-for-timeout': 'error',
23
+ 'playwright/prefer-lowercase-title': 'error',
24
+ 'playwright/prefer-to-have-length': 'error',
25
+ 'playwright/require-top-level-describe': 'error',
26
+ 'playwright/valid-expect': 'error'
27
+ }
28
+ }
29
+ ]
30
+ };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ plugins: ['promise'],
5
+ rules: {
6
+ 'promise/always-return': 'error',
7
+ 'promise/avoid-new': 'error',
8
+ 'promise/catch-or-return': 'error',
9
+ 'promise/no-callback-in-promise': 'error',
10
+ 'promise/no-multiple-resolved': 'error',
11
+ 'promise/no-native': 'off',
12
+ 'promise/no-nesting': 'error',
13
+ 'promise/no-new-statics': 'error',
14
+ 'promise/no-promise-in-callback': 'error',
15
+ 'promise/no-return-in-finally': 'error',
16
+ 'promise/no-return-wrap': 'error',
17
+ 'promise/param-names': [
18
+ 'error',
19
+ { resolvePattern: '^resolve$', rejectPattern: '^reject$' }
20
+ ],
21
+ 'promise/prefer-await-to-callbacks': 'error',
22
+ 'promise/prefer-await-to-then': 'error',
23
+ 'promise/valid-params': 'error'
24
+ }
25
+ };
package/unicorn-config.js CHANGED
@@ -32,6 +32,7 @@ module.exports = {
32
32
  'unicorn/no-invalid-remove-event-listener': 'error',
33
33
  'unicorn/no-keyword-prefix': 'off',
34
34
  'unicorn/no-lonely-if': 'error',
35
+ 'unicorn/no-negated-condition': 'error',
35
36
  'unicorn/no-nested-ternary': 'error',
36
37
  'unicorn/no-new-array': 'error',
37
38
  'unicorn/no-new-buffer': 'off',
@@ -41,6 +42,8 @@ module.exports = {
41
42
  'unicorn/no-static-only-class': 'error',
42
43
  'unicorn/no-thenable': 'error',
43
44
  'unicorn/no-this-assignment': 'error',
45
+ 'unicorn/no-typeof-undefined': 'error',
46
+ 'unicorn/no-unnecessary-await': 'error',
44
47
  'unicorn/no-unreadable-array-destructuring': 'error',
45
48
  'unicorn/no-unreadable-iife': 'error',
46
49
  'unicorn/no-unsafe-regex': 'error',
@@ -89,6 +92,7 @@ module.exports = {
89
92
  'unicorn/prefer-reflect-apply': 'off',
90
93
  'unicorn/prefer-regexp-test': 'error',
91
94
  'unicorn/prefer-set-has': 'error',
95
+ 'unicorn/prefer-set-size': 'error',
92
96
  'unicorn/prefer-spread': 'error',
93
97
  'unicorn/prefer-string-replace-all': 'off',
94
98
  'unicorn/prefer-string-slice': 'error',
@@ -114,6 +118,7 @@ module.exports = {
114
118
  'unicorn/require-number-to-fixed-digits-argument': 'error',
115
119
  'unicorn/require-post-message-target-origin': 'off',
116
120
  'unicorn/string-content': 'off',
121
+ 'unicorn/switch-case-braces': ['error', 'always'],
117
122
  'unicorn/template-indent': 'off',
118
123
  'unicorn/text-encoding-identifier-case': 'error',
119
124
  'unicorn/throw-new-error': 'error'