@faergeek/eslint-config 6.1.71 → 7.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.
@@ -0,0 +1,3 @@
1
+ import { base, node } from './index.js';
2
+
3
+ export default [...base, ...node];
package/index.js CHANGED
@@ -1,37 +1,158 @@
1
- module.exports = {
2
- reportUnusedDisableDirectives: true,
3
- extends: ['eslint:recommended', 'prettier'],
4
- plugins: ['simple-import-sort'],
5
- parserOptions: { sourceType: 'module' },
6
- env: { es2022: true },
7
- rules: {
8
- 'dot-notation': 'warn',
9
- eqeqeq: ['warn', 'smart'],
10
- 'func-names': ['warn', 'as-needed'],
11
- 'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
12
- 'no-alert': 'warn',
13
- 'no-console': 'warn',
14
- 'no-shadow': 'warn',
15
- 'no-throw-literal': 'warn',
16
- 'no-unused-vars': ['warn', { ignoreRestSiblings: true }],
17
- 'no-useless-computed-key': 'warn',
18
- 'no-useless-concat': 'warn',
19
- 'no-useless-rename': 'warn',
20
- 'object-shorthand': 'warn',
21
- 'operator-assignment': 'warn',
22
- 'prefer-const': ['warn', { destructuring: 'all' }],
23
- 'prefer-template': 'warn',
24
- radix: 'warn',
25
- 'spaced-comment': [
26
- 'warn',
27
- 'always',
28
- {
29
- block: { balanced: true },
30
- markers: ['/'],
1
+ import eslint from '@eslint/js';
2
+ import vitestPlugin from '@vitest/eslint-plugin';
3
+ import reactPluginConfigRecommended from 'eslint-plugin-react/configs/recommended.js';
4
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
5
+ import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
6
+ import globals from 'globals';
7
+ import typescriptEslint from 'typescript-eslint';
8
+
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
+ },
48
+ },
49
+ ];
50
+
51
+ export const browser = [
52
+ {
53
+ languageOptions: {
54
+ globals: globals.browser,
55
+ },
56
+ },
57
+ ];
58
+
59
+ export const node = [
60
+ {
61
+ languageOptions: {
62
+ globals: globals.nodeBuiltin,
63
+ },
64
+ },
65
+ ];
66
+
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
+ },
99
+ },
100
+ ];
101
+
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': [
116
+ 'warn',
117
+ { ignoreRestSiblings: true },
118
+ ],
119
+ 'no-shadow': 'off',
120
+ },
121
+ },
122
+ ];
123
+
124
+ export const vitest = [
125
+ vitestPlugin.configs.recommended,
126
+ {
127
+ settings: {
128
+ vitest: {
129
+ typecheck: true,
31
130
  },
32
- ],
33
- strict: ['warn', 'never'],
34
- 'simple-import-sort/imports': 'warn',
35
- 'simple-import-sort/exports': 'warn',
131
+ },
132
+ rules: {
133
+ '@vitest/consistent-test-it': [
134
+ 'warn',
135
+ { fn: 'test', withinDescribe: 'it' },
136
+ ],
137
+ '@vitest/no-disabled-tests': 'warn',
138
+ '@vitest/no-focused-tests': ['warn', { fixable: false }],
139
+ '@vitest/no-standalone-expect': 'warn',
140
+ '@vitest/no-test-return-statement': 'warn',
141
+ '@vitest/prefer-comparison-matcher': 'warn',
142
+ '@vitest/prefer-equality-matcher': 'warn',
143
+ '@vitest/prefer-expect-resolves': 'warn',
144
+ '@vitest/prefer-hooks-in-order': 'warn',
145
+ '@vitest/prefer-hooks-on-top': 'warn',
146
+ '@vitest/prefer-mock-promise-shorthand': 'warn',
147
+ '@vitest/prefer-strict-equal': 'warn',
148
+ '@vitest/prefer-to-be': 'warn',
149
+ '@vitest/prefer-to-be-object': 'warn',
150
+ '@vitest/prefer-to-contain': 'warn',
151
+ '@vitest/prefer-to-have-length': 'warn',
152
+ '@vitest/prefer-todo': 'warn',
153
+ '@vitest/require-hook': 'warn',
154
+ '@vitest/require-to-throw-message': 'warn',
155
+ '@vitest/valid-title': 'off',
156
+ },
36
157
  },
37
- };
158
+ ];
package/package.json CHANGED
@@ -1,36 +1,38 @@
1
1
  {
2
+ "type": "module",
2
3
  "name": "@faergeek/eslint-config",
3
- "version": "6.1.71",
4
+ "version": "7.0.0",
4
5
  "main": "index.js",
5
6
  "repository": "git@github.com:faergeek/eslint-config.git",
6
7
  "author": "Sergey Slipchenko <faergeek@gmail.com>",
7
8
  "license": "MIT",
9
+ "exports": {
10
+ ".": "./index.js"
11
+ },
8
12
  "files": [
9
13
  "*.js"
10
14
  ],
11
15
  "scripts": {
12
- "lint": "eslint --max-warnings 0 .",
13
- "lint:check-prettier-conflicts": "eslint-config-prettier test.js",
16
+ "lint": "eslint --max-warnings 0",
14
17
  "format": "prettier --write .",
15
18
  "format:check": "prettier --check ."
16
19
  },
17
20
  "peerDependencies": {
18
- "eslint": "^8.56.0"
21
+ "eslint": "^9.0.0"
19
22
  },
20
23
  "packageManager": "pnpm@9.15.4",
21
24
  "dependencies": {
22
- "@typescript-eslint/eslint-plugin": "^8.0.0",
23
- "@typescript-eslint/parser": "^8.0.0",
24
- "eslint-config-prettier": "^10.0.0",
25
25
  "eslint-plugin-react": "^7.23.2",
26
26
  "eslint-plugin-react-hooks": "^5.0.0",
27
27
  "eslint-plugin-simple-import-sort": "^12.0.0",
28
- "@vitest/eslint-plugin": "^1.0.1"
28
+ "@vitest/eslint-plugin": "^1.0.1",
29
+ "globals": "^15.0.0",
30
+ "typescript-eslint": "^7.5.0"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@commitlint/cli": "^19.0.0",
32
34
  "@commitlint/config-conventional": "^19.0.0",
33
- "eslint": "^8.0.0",
35
+ "eslint": "^9.0.0",
34
36
  "prettier": "^3.0.0",
35
37
  "semantic-release": "^24.0.0"
36
38
  }
package/node.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- },
5
- };
package/react.js DELETED
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
3
- env: { 'shared-node-browser': true },
4
- settings: { react: { version: 'detect' } },
5
- rules: {
6
- 'react/display-name': 'off',
7
- 'react/jsx-boolean-value': 'warn',
8
- 'react/jsx-curly-brace-presence': 'warn',
9
- 'react/jsx-fragments': 'warn',
10
- 'react/jsx-key': [
11
- 'warn',
12
- { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true },
13
- ],
14
- 'react/jsx-no-target-blank': [
15
- 'error',
16
- { allowReferrer: true, warnOnSpreadAttributes: true },
17
- ],
18
- 'react/jsx-uses-react': 'off',
19
- 'react/no-danger': 'warn',
20
- 'react/no-unused-prop-types': 'warn',
21
- 'react/prop-types': 'off',
22
- 'react/react-in-jsx-scope': 'off',
23
- 'react/require-render-return': 'off',
24
- },
25
- };
package/typescript.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
3
- rules: {
4
- '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
5
- '@typescript-eslint/ban-ts-comment': [
6
- 'warn',
7
- { 'ts-ignore': 'allow-with-description' },
8
- ],
9
- '@typescript-eslint/consistent-type-imports': 'warn',
10
- '@typescript-eslint/explicit-module-boundary-types': 'off',
11
- '@typescript-eslint/no-non-null-assertion': 'warn',
12
- '@typescript-eslint/no-shadow': 'warn',
13
- '@typescript-eslint/no-unused-vars': 'off',
14
- 'no-shadow': 'off',
15
- },
16
- };
package/vitest.js DELETED
@@ -1,33 +0,0 @@
1
- module.exports = {
2
- extends: 'plugin:@vitest/legacy-recommended',
3
- settings: {
4
- vitest: {
5
- typecheck: true,
6
- },
7
- },
8
- rules: {
9
- '@vitest/consistent-test-it': [
10
- 'warn',
11
- { fn: 'test', withinDescribe: 'it' },
12
- ],
13
- '@vitest/no-disabled-tests': 'warn',
14
- '@vitest/no-focused-tests': ['warn', { fixable: false }],
15
- '@vitest/no-standalone-expect': 'warn',
16
- '@vitest/no-test-return-statement': 'warn',
17
- '@vitest/prefer-comparison-matcher': 'warn',
18
- '@vitest/prefer-equality-matcher': 'warn',
19
- '@vitest/prefer-expect-resolves': 'warn',
20
- '@vitest/prefer-hooks-in-order': 'warn',
21
- '@vitest/prefer-hooks-on-top': 'warn',
22
- '@vitest/prefer-mock-promise-shorthand': 'warn',
23
- '@vitest/prefer-strict-equal': 'warn',
24
- '@vitest/prefer-to-be': 'warn',
25
- '@vitest/prefer-to-be-object': 'warn',
26
- '@vitest/prefer-to-contain': 'warn',
27
- '@vitest/prefer-to-have-length': 'warn',
28
- '@vitest/prefer-todo': 'warn',
29
- '@vitest/require-hook': 'warn',
30
- '@vitest/require-to-throw-message': 'warn',
31
- '@vitest/valid-title': 'off',
32
- },
33
- };