@jabworks/eslint-plugin 1.1.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @jabworks/eslint-plugin
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Tweak eslint configs
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -41,13 +41,7 @@ export default [
41
41
  ];
42
42
  ```
43
43
 
44
- Or, if using legacy config:
45
-
46
- ```json
47
- {
48
- "extends": ["plugin:@jabworks/base"]
49
- }
50
- ```
44
+ Legacy `.eslintrc` configs are not provided. Use flat config with ESLint v9+.
51
45
 
52
46
  ## Available Configs
53
47
 
@@ -71,6 +65,10 @@ import helper from './helper';
71
65
  import styles from './styles.css';
72
66
  ```
73
67
 
68
+ ## Compatibility
69
+
70
+ - **ESLint**: >=9.39.2
71
+
74
72
  ## License
75
73
 
76
74
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jabworks/eslint-plugin",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "private": false,
5
5
  "description": "Opinionated ESLint plugin and flat config for JS, TS, React, and Next.js",
6
6
  "keywords": [
@@ -10,6 +10,7 @@ import es6 from '../rules/es6.js';
10
10
  import importConfig from '../rules/import.js';
11
11
  import possibleErrors from '../rules/possible-errors.js';
12
12
  import stylistic from '../rules/stylistic.js';
13
+ import unicornRules from '../rules/unicorn.js';
13
14
  import variables from '../rules/variables.js';
14
15
  import comments from './comments.js';
15
16
 
@@ -27,6 +28,7 @@ export const baseConfig = {
27
28
  ...possibleErrors,
28
29
  ...stylistic,
29
30
  ...variables,
31
+ ...unicornRules,
30
32
  },
31
33
  };
32
34
 
@@ -5,6 +5,7 @@ import importPlugin from 'eslint-plugin-import';
5
5
  import pluginReact from 'eslint-plugin-react';
6
6
  import pluginReactHooks from 'eslint-plugin-react-hooks';
7
7
  import globals from 'globals';
8
+ import jsxA11yRules from '../rules/jsx-a11y.js';
8
9
 
9
10
  import reactRules from '../rules/react.js';
10
11
  import baseConfig from './base.js';
@@ -49,6 +50,7 @@ const configs = [
49
50
  ...pluginNext.configs.recommended.rules,
50
51
  ...pluginNext.configs['core-web-vitals'].rules,
51
52
  ...tseslintConfig.rules,
53
+ ...jsxA11yRules,
52
54
  },
53
55
  },
54
56
  {
@@ -1,37 +1,44 @@
1
1
  import js from '@eslint/js';
2
2
  import eslintConfigPrettier from 'eslint-config-prettier';
3
3
  import importPlugin from 'eslint-plugin-import';
4
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
4
5
  import pluginReact from 'eslint-plugin-react';
5
6
  import pluginReactHooks from 'eslint-plugin-react-hooks';
6
7
  import globals from 'globals';
7
8
 
9
+ import jsxA11yRules from '../rules/jsx-a11y.js';
8
10
  import reactRules from '../rules/react.js';
9
11
  import baseConfig from './base.js';
10
12
  import tseslintConfig from './typescript.js';
11
13
 
12
14
  /** @type {import("eslint").Linter.Config} */
13
15
  export const reactConfig = {
14
- name: '@jabworks/eslint-config-react',
15
- languageOptions: {
16
- ...pluginReact.configs.flat.recommended?.languageOptions,
17
- globals: {
18
- ...globals.serviceworker,
19
- ...globals.browser,
20
- },
21
- parserOptions: {
22
- projectService: true,
23
- tsconfigRootDir: import.meta.dirname,
24
- },
25
- },
26
- plugins: {
27
- 'react-hooks': pluginReactHooks,
28
- },
29
- settings: { react: { version: 'detect' } },
30
- rules: {
31
- ...pluginReactHooks.configs['recommended-latest'].rules,
32
- ...reactRules,
33
- 'import/no-cycle': 'error',
34
- },
16
+ name: '@jabworks/eslint-config-react',
17
+ languageOptions: {
18
+ ...pluginReact.configs.flat.recommended?.languageOptions,
19
+ globals: {
20
+ ...globals.serviceworker,
21
+ ...globals.browser,
22
+ },
23
+ parserOptions: {
24
+ projectService: true,
25
+ tsconfigRootDir: import.meta.dirname,
26
+ ecmaFeatures: {
27
+ jsx: true,
28
+ },
29
+ },
30
+ },
31
+ plugins: {
32
+ 'react-hooks': pluginReactHooks,
33
+ 'jsx-a11y': jsxA11y,
34
+ },
35
+ settings: { react: { version: 'detect' } },
36
+ rules: {
37
+ ...pluginReactHooks.configs['recommended-latest'].rules,
38
+ ...reactRules,
39
+ ...jsxA11yRules,
40
+ 'import/no-cycle': 'error',
41
+ },
35
42
  };
36
43
 
37
44
  /**
@@ -40,13 +47,14 @@ export const reactConfig = {
40
47
  * @type {import("eslint").Linter.Config[]}
41
48
  */
42
49
  const configs = [
43
- js.configs.recommended,
44
- eslintConfigPrettier,
45
- importPlugin.flatConfigs.recommended,
46
- ...baseConfig,
47
- ...tseslintConfig,
48
- pluginReact.configs.flat.recommended,
49
- reactConfig,
50
+ js.configs.recommended,
51
+ eslintConfigPrettier,
52
+ importPlugin.flatConfigs.recommended,
53
+ ...baseConfig,
54
+ ...tseslintConfig,
55
+ pluginReact.configs.flat.recommended,
56
+ pluginReact.configs.flat['jsx-runtime'],
57
+ reactConfig,
50
58
  ];
51
59
 
52
60
  export default configs;
@@ -1,116 +1,110 @@
1
1
  /** @type {import('eslint').Linter.RulesRecord} */
2
2
  const disabledRules = {
3
- 'import/named': 'off',
4
- 'import/no-cycle': 'off', // This rule is the most taxing on performance, so we disable it by default.
5
- 'import/order': 'off',
6
- 'sort-imports': 'off',
3
+ 'import/named': 'off',
4
+ 'import/no-cycle': 'off', // This rule is the most taxing on performance, so we disable it by default.
5
+ 'import/order': 'off',
6
+ 'sort-imports': 'off',
7
7
  };
8
8
 
9
9
  /** @type {import('eslint').Linter.RulesRecord} */
10
10
  const rules = {
11
- /**
12
- * Disallow non-import statements appearing before import statements.
13
- *
14
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
15
- */
16
- 'import/first': 'error',
17
- /**
18
- * Require a newline after the last import/require.
19
- *
20
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
21
- */
22
- 'import/newline-after-import': 'warn',
23
- /**
24
- * Disallow import of modules using absolute paths.
25
- *
26
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
27
- */
28
- 'import/no-absolute-path': 'error',
29
- /**
30
- * Disallow default exports.
31
- *
32
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
33
- */
34
- 'import/no-default-export': 'error',
35
- /**
36
- * Disallow the use of extraneous packages.
37
- *
38
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
39
- */
40
- 'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
41
- /**
42
- * Disallow mutable exports.
43
- *
44
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
45
- */
46
- 'import/no-mutable-exports': 'error',
47
- /**
48
- * Disallow importing packages through relative paths.
49
- *
50
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
51
- */
52
- 'import/no-relative-packages': 'warn',
53
- /**
54
- * Disallow a module from importing itself.
55
- *
56
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
57
- */
58
- 'import/no-self-import': 'error',
59
- /**
60
- * Ensures that there are no useless path segments.
61
- *
62
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
63
- */
64
- 'import/no-useless-path-segments': ['error'],
65
- /**
66
- * Forbid imported names marked with @deprecated documentation tag.
67
- *
68
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
69
- */
70
- 'import/no-deprecated': 'error',
71
- /**
72
- * Forbid a module from importing a module with a dependency path back to itself.
73
- *
74
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
75
- */
76
- 'import/no-cycle': 'error',
77
- /**
78
- * Enforce a module import order convention.
79
- *
80
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
81
- */
82
- // 'import/order': [
83
- // 'warn',
84
- // {
85
- // groups: [
86
- // 'builtin', // Node.js built-in modules
87
- // 'external', // Packages
88
- // 'internal', // Aliased modules
89
- // 'parent', // Relative parent
90
- // 'sibling', // Relative sibling
91
- // 'index', // Relative index
92
- // ],
93
- // 'newlines-between': 'never',
94
- // },
95
- // ],
96
- /**
97
- * Enforce a module export order convention.
98
- *
99
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort
100
- */
101
- 'simple-import-sort/exports': 'warn',
102
- /**
103
- * Enforce a module import order convention.
104
- *
105
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort
106
- */
107
- 'simple-import-sort/imports': [
108
- 'warn',
109
- {
110
- groups: [['^react'], ['^@?\\w'], ['^@/'], ['^\\.((?!.(css|scss)).)*$'], ['^[^.]'], ['^.+\\.(css|scss)$']],
111
- },
112
- ],
113
- ...disabledRules,
11
+ /**
12
+ * Disallow non-import statements appearing before import statements.
13
+ *
14
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
15
+ */
16
+ 'import/first': 'error',
17
+ /**
18
+ * Require a newline after the last import/require.
19
+ *
20
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
21
+ */
22
+ 'import/newline-after-import': 'warn',
23
+ /**
24
+ * Disallow import of modules using absolute paths.
25
+ *
26
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
27
+ */
28
+ 'import/no-absolute-path': 'error',
29
+ /**
30
+ * Disallow default exports.
31
+ *
32
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
33
+ */
34
+ 'import/no-default-export': 'error',
35
+ /**
36
+ * Disallow the use of extraneous packages.
37
+ *
38
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
39
+ */
40
+ 'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
41
+ /**
42
+ * Disallow mutable exports.
43
+ *
44
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
45
+ */
46
+ 'import/no-mutable-exports': 'error',
47
+ /**
48
+ * Disallow importing packages through relative paths.
49
+ *
50
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
51
+ */
52
+ 'import/no-relative-packages': 'warn',
53
+ /**
54
+ * Disallow a module from importing itself.
55
+ *
56
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
57
+ */
58
+ 'import/no-self-import': 'error',
59
+ /**
60
+ * Ensures that there are no useless path segments.
61
+ *
62
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
63
+ */
64
+ 'import/no-useless-path-segments': ['error'],
65
+ /**
66
+ * Forbid imported names marked with @deprecated documentation tag.
67
+ *
68
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
69
+ */
70
+ 'import/no-deprecated': 'error',
71
+ /**
72
+ * Enforce a module import order convention.
73
+ *
74
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
75
+ */
76
+ // 'import/order': [
77
+ // 'warn',
78
+ // {
79
+ // groups: [
80
+ // 'builtin', // Node.js built-in modules
81
+ // 'external', // Packages
82
+ // 'internal', // Aliased modules
83
+ // 'parent', // Relative parent
84
+ // 'sibling', // Relative sibling
85
+ // 'index', // Relative index
86
+ // ],
87
+ // 'newlines-between': 'never',
88
+ // },
89
+ // ],
90
+ /**
91
+ * Enforce a module export order convention.
92
+ *
93
+ * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort
94
+ */
95
+ 'simple-import-sort/exports': 'warn',
96
+ /**
97
+ * Enforce a module import order convention.
98
+ *
99
+ * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort
100
+ */
101
+ 'simple-import-sort/imports': [
102
+ 'warn',
103
+ {
104
+ groups: [['^react'], ['^@?\\w'], ['^@/'], ['^\\.((?!.(css|scss)).)*$'], ['^[^.]'], ['^.+\\.(css|scss)$']],
105
+ },
106
+ ],
107
+ ...disabledRules,
114
108
  };
115
109
 
116
110
  export default rules;