@faergeek/eslint-config 7.0.52 → 7.0.54

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.
Files changed (3) hide show
  1. package/eslint.config.js +1 -3
  2. package/index.js +112 -137
  3. package/package.json +4 -4
package/eslint.config.js CHANGED
@@ -1,3 +1 @@
1
- import { base, node } from './index.js';
2
-
3
- export default [...base, ...node];
1
+ export { base as default } from './index.js';
package/index.js CHANGED
@@ -1,155 +1,130 @@
1
- import eslint from '@eslint/js';
1
+ import js from '@eslint/js';
2
2
  import vitestPlugin from '@vitest/eslint-plugin';
3
- import reactPluginConfigRecommended from 'eslint-plugin-react/configs/recommended.js';
3
+ import { defineConfig } from 'eslint/config';
4
+ import reactPlugin from 'eslint-plugin-react';
4
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks';
5
6
  import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
6
7
  import globals from 'globals';
7
8
  import typescriptEslint from 'typescript-eslint';
8
9
 
9
- export const base = [
10
- eslint.configs.recommended,
11
- {
12
- linterOptions: {
13
- reportUnusedDisableDirectives: true,
14
- },
15
- plugins: {
16
- 'simple-import-sort': simpleImportSortPlugin,
17
- },
18
- rules: {
19
- 'dot-notation': 'warn',
20
- eqeqeq: ['warn', 'smart'],
21
- 'func-names': ['warn', 'as-needed'],
22
- 'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
23
- 'no-alert': 'warn',
24
- 'no-console': 'warn',
25
- 'no-shadow': 'warn',
26
- 'no-throw-literal': 'warn',
27
- 'no-unused-vars': ['warn', { ignoreRestSiblings: true }],
28
- 'no-useless-computed-key': 'warn',
29
- 'no-useless-concat': 'warn',
30
- 'no-useless-rename': 'warn',
31
- 'object-shorthand': 'warn',
32
- 'operator-assignment': 'warn',
33
- 'prefer-const': ['warn', { destructuring: 'all' }],
34
- 'prefer-template': 'warn',
35
- radix: 'warn',
36
- 'spaced-comment': [
37
- 'warn',
38
- 'always',
39
- {
40
- block: { balanced: true },
41
- markers: ['/'],
42
- },
43
- ],
44
- strict: ['warn', 'never'],
45
- 'simple-import-sort/imports': 'warn',
46
- 'simple-import-sort/exports': 'warn',
47
- },
10
+ export const base = defineConfig({
11
+ extends: [js.configs.recommended],
12
+ linterOptions: {
13
+ reportUnusedDisableDirectives: true,
14
+ },
15
+ plugins: {
16
+ 'simple-import-sort': simpleImportSortPlugin,
48
17
  },
49
- ];
18
+ rules: {
19
+ 'dot-notation': 'warn',
20
+ eqeqeq: ['warn', 'smart'],
21
+ 'func-names': ['warn', 'as-needed'],
22
+ 'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
23
+ 'no-alert': 'warn',
24
+ 'no-console': 'warn',
25
+ 'no-shadow': 'warn',
26
+ 'no-throw-literal': 'warn',
27
+ 'no-unused-vars': ['warn', { ignoreRestSiblings: true }],
28
+ 'no-useless-computed-key': 'warn',
29
+ 'no-useless-concat': 'warn',
30
+ 'no-useless-rename': 'warn',
31
+ 'object-shorthand': 'warn',
32
+ 'operator-assignment': 'warn',
33
+ 'prefer-const': ['warn', { destructuring: 'all' }],
34
+ 'prefer-template': 'warn',
35
+ radix: 'warn',
36
+ 'spaced-comment': [
37
+ 'warn',
38
+ 'always',
39
+ {
40
+ block: { balanced: true },
41
+ markers: ['/'],
42
+ },
43
+ ],
44
+ strict: ['warn', 'never'],
45
+ 'simple-import-sort/imports': 'warn',
46
+ 'simple-import-sort/exports': 'warn',
47
+ },
48
+ });
50
49
 
51
- export const browser = [
52
- {
53
- languageOptions: {
54
- globals: globals.browser,
55
- },
50
+ export const browser = defineConfig({
51
+ languageOptions: {
52
+ globals: globals.browser,
56
53
  },
57
- ];
54
+ });
58
55
 
59
- export const node = [
60
- {
61
- languageOptions: {
62
- globals: globals.nodeBuiltin,
63
- },
56
+ export const node = defineConfig({
57
+ languageOptions: {
58
+ globals: globals.nodeBuiltin,
64
59
  },
65
- ];
60
+ });
66
61
 
67
- export const react = [
68
- reactPluginConfigRecommended,
69
- {
70
- languageOptions: {
71
- globals: globals['shared-node-browser'],
72
- },
73
- plugins: {
74
- 'react-hooks': reactHooksPlugin,
75
- },
76
- settings: { react: { version: 'detect' } },
77
- rules: {
78
- 'react/display-name': 'off',
79
- 'react/jsx-boolean-value': 'warn',
80
- 'react/jsx-curly-brace-presence': 'warn',
81
- 'react/jsx-fragments': 'warn',
82
- 'react/jsx-key': [
83
- 'warn',
84
- { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true },
85
- ],
86
- 'react/jsx-no-target-blank': [
87
- 'error',
88
- { allowReferrer: true, warnOnSpreadAttributes: true },
89
- ],
90
- 'react/jsx-uses-react': 'off',
91
- 'react/no-danger': 'warn',
92
- 'react/no-unused-prop-types': 'warn',
93
- 'react/prop-types': 'off',
94
- 'react/react-in-jsx-scope': 'off',
95
- 'react/require-render-return': 'off',
96
- 'react-hooks/rules-of-hooks': 'error',
97
- 'react-hooks/exhaustive-deps': 'warn',
98
- },
62
+ export const react = defineConfig({
63
+ extends: [
64
+ reactPlugin.configs.flat.recommended,
65
+ reactPlugin.configs.flat['jsx-runtime'],
66
+ reactHooksPlugin.configs['recommended-latest'],
67
+ ],
68
+ languageOptions: {
69
+ globals: globals['shared-node-browser'],
70
+ },
71
+ settings: { react: { version: 'detect' } },
72
+ rules: {
73
+ 'react/jsx-boolean-value': 'warn',
74
+ 'react/jsx-curly-brace-presence': 'warn',
75
+ 'react/jsx-fragments': 'warn',
76
+ 'react/jsx-key': [
77
+ 'warn',
78
+ { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true },
79
+ ],
80
+ 'react/jsx-no-target-blank': [
81
+ 'error',
82
+ { allowReferrer: true, warnOnSpreadAttributes: true },
83
+ ],
84
+ 'react/no-danger': 'warn',
85
+ 'react/no-unused-prop-types': 'warn',
99
86
  },
100
- ];
87
+ });
101
88
 
102
- export const typescript = [
103
- ...typescriptEslint.configs.recommended,
104
- {
105
- rules: {
106
- '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
107
- '@typescript-eslint/ban-ts-comment': [
108
- 'warn',
109
- { 'ts-ignore': 'allow-with-description' },
110
- ],
111
- '@typescript-eslint/consistent-type-imports': 'warn',
112
- '@typescript-eslint/explicit-module-boundary-types': 'off',
113
- '@typescript-eslint/no-non-null-assertion': 'warn',
114
- '@typescript-eslint/no-shadow': 'warn',
115
- '@typescript-eslint/no-unused-vars': 'off',
116
- 'no-shadow': 'off',
117
- },
89
+ export const typescript = defineConfig({
90
+ extends: [typescriptEslint.configs.recommended],
91
+ rules: {
92
+ '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
93
+ '@typescript-eslint/consistent-type-imports': 'warn',
94
+ '@typescript-eslint/no-non-null-assertion': 'warn',
95
+ '@typescript-eslint/no-shadow': 'warn',
96
+ '@typescript-eslint/no-unused-vars': 'off',
97
+ 'no-shadow': 'off',
118
98
  },
119
- ];
99
+ });
120
100
 
121
- export const vitest = [
122
- vitestPlugin.configs.recommended,
123
- {
124
- settings: {
125
- vitest: {
126
- typecheck: true,
127
- },
128
- },
129
- rules: {
130
- 'vitest/consistent-test-it': [
131
- 'warn',
132
- { fn: 'test', withinDescribe: 'it' },
133
- ],
134
- 'vitest/no-disabled-tests': 'warn',
135
- 'vitest/no-focused-tests': ['warn', { fixable: false }],
136
- 'vitest/no-standalone-expect': 'warn',
137
- 'vitest/no-test-return-statement': 'warn',
138
- 'vitest/prefer-comparison-matcher': 'warn',
139
- 'vitest/prefer-equality-matcher': 'warn',
140
- 'vitest/prefer-expect-resolves': 'warn',
141
- 'vitest/prefer-hooks-in-order': 'warn',
142
- 'vitest/prefer-hooks-on-top': 'warn',
143
- 'vitest/prefer-mock-promise-shorthand': 'warn',
144
- 'vitest/prefer-strict-equal': 'warn',
145
- 'vitest/prefer-to-be': 'warn',
146
- 'vitest/prefer-to-be-object': 'warn',
147
- 'vitest/prefer-to-contain': 'warn',
148
- 'vitest/prefer-to-have-length': 'warn',
149
- 'vitest/prefer-todo': 'warn',
150
- 'vitest/require-hook': 'warn',
151
- 'vitest/require-to-throw-message': 'warn',
152
- 'vitest/valid-title': 'off',
101
+ export const vitest = defineConfig({
102
+ extends: [vitestPlugin.configs.recommended],
103
+ settings: {
104
+ vitest: {
105
+ typecheck: true,
153
106
  },
154
107
  },
155
- ];
108
+ rules: {
109
+ 'vitest/consistent-test-it': ['warn', { fn: 'test', withinDescribe: 'it' }],
110
+ 'vitest/no-disabled-tests': 'warn',
111
+ 'vitest/no-focused-tests': ['warn', { fixable: false }],
112
+ 'vitest/no-standalone-expect': 'warn',
113
+ 'vitest/no-test-return-statement': 'warn',
114
+ 'vitest/prefer-comparison-matcher': 'warn',
115
+ 'vitest/prefer-equality-matcher': 'warn',
116
+ 'vitest/prefer-expect-resolves': 'warn',
117
+ 'vitest/prefer-hooks-in-order': 'warn',
118
+ 'vitest/prefer-hooks-on-top': 'warn',
119
+ 'vitest/prefer-mock-promise-shorthand': 'warn',
120
+ 'vitest/prefer-strict-equal': 'warn',
121
+ 'vitest/prefer-to-be': 'warn',
122
+ 'vitest/prefer-to-be-object': 'warn',
123
+ 'vitest/prefer-to-contain': 'warn',
124
+ 'vitest/prefer-to-have-length': 'warn',
125
+ 'vitest/prefer-todo': 'warn',
126
+ 'vitest/require-hook': 'warn',
127
+ 'vitest/require-to-throw-message': 'warn',
128
+ 'vitest/valid-title': 'off',
129
+ },
130
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@faergeek/eslint-config",
4
- "version": "7.0.52",
4
+ "version": "7.0.54",
5
5
  "main": "index.js",
6
6
  "repository": "git@github.com:faergeek/eslint-config.git",
7
7
  "author": "Sergei Slipchenko <faergeek@gmail.com>",
@@ -17,9 +17,6 @@
17
17
  "format": "prettier --write .",
18
18
  "format:check": "prettier --check ."
19
19
  },
20
- "peerDependencies": {
21
- "eslint": "^9.0.0"
22
- },
23
20
  "packageManager": "pnpm@10.12.4",
24
21
  "pnpm": {
25
22
  "onlyBuiltDependencies": [
@@ -34,6 +31,9 @@
34
31
  "globals": "^16.0.0",
35
32
  "typescript-eslint": "^8.0.0"
36
33
  },
34
+ "peerDependencies": {
35
+ "eslint": "^9.0.0"
36
+ },
37
37
  "devDependencies": {
38
38
  "@commitlint/cli": "^19.0.0",
39
39
  "@commitlint/config-conventional": "^19.0.0",