@mrpalmer/eslint-config 2.1.0 → 2.3.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/.turbo/turbo-build.log +8 -0
- package/CHANGELOG.md +26 -0
- package/configs/base.js +5 -2
- package/configs/jest.js +7 -3
- package/configs/react.js +65 -109
- package/configs/typescript.js +3 -2
- package/index.js +2 -4
- package/package.json +23 -14
- package/tsconfig.json +10 -0
- package/turbo.json +8 -0
- package/types/configs/base.d.ts +2 -0
- package/types/configs/jest.d.ts +2 -0
- package/types/configs/react.d.ts +2 -0
- package/types/configs/typescript.d.ts +2 -0
- package/types/index.d.ts +18 -0
- package/types/utils/deprecated.d.ts +4 -0
- package/types/utils/packageJson.d.ts +14 -0
- package/utils/deprecated.js +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mrpalmer/eslint-config
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5e223a2: Upgrade plugins and configure new rules
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b99f7df: Update dependencies
|
|
12
|
+
- Updated dependencies [03c9f7f]
|
|
13
|
+
- @mrpalmer/eslint-plugin@1.0.2
|
|
14
|
+
|
|
15
|
+
## 2.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- afbdd32: Replace `eslint-plugin-react` with `@eslint-react/eslint-plugin`
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 1e43272: Update ESLint plugins
|
|
24
|
+
- 32711bf: Fix order of configs in "all"
|
|
25
|
+
- df14ce7: Export TypeScript types
|
|
26
|
+
- Updated dependencies [96a657e]
|
|
27
|
+
- @mrpalmer/eslint-plugin@1.0.1
|
|
28
|
+
|
|
3
29
|
## 2.1.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/configs/base.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import eslint from '@eslint/js'
|
|
2
2
|
import mrpalmerPlugin from '@mrpalmer/eslint-plugin'
|
|
3
|
+
import { defineConfig } from 'eslint/config'
|
|
3
4
|
import pluginImport from 'eslint-plugin-import-x'
|
|
4
|
-
import { config } from 'typescript-eslint'
|
|
5
5
|
|
|
6
|
-
export default
|
|
6
|
+
export default defineConfig(
|
|
7
7
|
{
|
|
8
8
|
name: 'eslint/recommended',
|
|
9
9
|
...eslint.configs.recommended,
|
|
@@ -120,6 +120,7 @@ export default config(
|
|
|
120
120
|
'no-template-curly-in-string': 'error',
|
|
121
121
|
'no-ternary': 'off',
|
|
122
122
|
'no-throw-literal': 'error',
|
|
123
|
+
'no-unassigned-vars': 'error',
|
|
123
124
|
'no-undef-init': 'error',
|
|
124
125
|
'no-undefined': 'off',
|
|
125
126
|
'no-underscore-dangle': 'off',
|
|
@@ -170,6 +171,7 @@ export default config(
|
|
|
170
171
|
'prefer-rest-params': 'error',
|
|
171
172
|
'prefer-spread': 'error',
|
|
172
173
|
'prefer-template': 'error',
|
|
174
|
+
'preserve-caught-error': 'warn',
|
|
173
175
|
radix: 'error',
|
|
174
176
|
'require-atomic-updates': 'off',
|
|
175
177
|
'require-await': 'off',
|
|
@@ -227,6 +229,7 @@ export default config(
|
|
|
227
229
|
'import-x/no-webpack-loader-syntax': 'error',
|
|
228
230
|
'import-x/order': 'off',
|
|
229
231
|
'import-x/prefer-default-export': 'off',
|
|
232
|
+
'import-x/prefer-namespace-import': 'off',
|
|
230
233
|
'import-x/unambiguous': 'off',
|
|
231
234
|
},
|
|
232
235
|
settings: {
|
package/configs/jest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import pluginJest from 'eslint-plugin-jest'
|
|
2
3
|
import pluginJestDom from 'eslint-plugin-jest-dom'
|
|
3
4
|
import pluginTestingLibrary from 'eslint-plugin-testing-library'
|
|
4
|
-
import tseslint from 'typescript-eslint'
|
|
5
5
|
import { getAllDependencies } from '../utils/packageJson.js'
|
|
6
6
|
|
|
7
7
|
const allDeps = new Set(Object.keys(getAllDependencies()))
|
|
@@ -11,7 +11,7 @@ const hasTestingLibraryDom = allDeps.has('@testing-library/dom')
|
|
|
11
11
|
const hasTestingLibraryReact = allDeps.has('@testing-library/react')
|
|
12
12
|
const hasTestingLibrary = hasTestingLibraryDom || hasTestingLibraryReact
|
|
13
13
|
|
|
14
|
-
export default
|
|
14
|
+
export default defineConfig(
|
|
15
15
|
{
|
|
16
16
|
extends: [
|
|
17
17
|
{ name: 'jest/recommended', ...pluginJest.configs['flat/recommended'] },
|
|
@@ -36,7 +36,9 @@ export default tseslint.config(
|
|
|
36
36
|
name: 'mrpalmer/jest',
|
|
37
37
|
|
|
38
38
|
rules: {
|
|
39
|
-
|
|
39
|
+
// we don't need a display name in test files
|
|
40
|
+
'@eslint-react/no-missing-component-display-name': 'off',
|
|
41
|
+
'@eslint-react/no-missing-context-display-name': 'off',
|
|
40
42
|
|
|
41
43
|
'jest/consistent-test-it': 'off',
|
|
42
44
|
'jest/max-expects': 'off',
|
|
@@ -61,6 +63,7 @@ export default tseslint.config(
|
|
|
61
63
|
'jest/prefer-called-with': 'error',
|
|
62
64
|
'jest/prefer-comparison-matcher': 'warn',
|
|
63
65
|
'jest/prefer-each': 'warn',
|
|
66
|
+
'jest/prefer-ending-with-an-expect': 'warn',
|
|
64
67
|
'jest/prefer-equality-matcher': 'warn',
|
|
65
68
|
'jest/prefer-expect-assertions': 'off',
|
|
66
69
|
'jest/prefer-expect-resolves': 'off',
|
|
@@ -82,6 +85,7 @@ export default tseslint.config(
|
|
|
82
85
|
...(hasTestingLibrary
|
|
83
86
|
? {
|
|
84
87
|
'testing-library/consistent-data-testid': 'off',
|
|
88
|
+
'testing-library/no-test-id-queries': 'warn',
|
|
85
89
|
'testing-library/prefer-explicit-assert': 'warn',
|
|
86
90
|
'testing-library/prefer-implicit-assert': 'off',
|
|
87
91
|
'testing-library/prefer-query-matchers': 'off',
|
package/configs/react.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import pluginReact from '@eslint-react/eslint-plugin'
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
1
3
|
import pluginJsxA11y from 'eslint-plugin-jsx-a11y'
|
|
2
|
-
import pluginReact from 'eslint-plugin-react'
|
|
3
4
|
import pluginReactHooks from 'eslint-plugin-react-hooks'
|
|
4
5
|
import globals from 'globals'
|
|
5
|
-
import
|
|
6
|
+
import * as deprecated from '../utils/deprecated.js'
|
|
6
7
|
import {
|
|
7
8
|
getAllDependencies,
|
|
8
9
|
getMinimumSupportedVersion,
|
|
@@ -13,25 +14,21 @@ const oldestSupportedReactVersion = '16.5.2'
|
|
|
13
14
|
const allDeps = getAllDependencies()
|
|
14
15
|
const minimumSupportedReactVersion =
|
|
15
16
|
getMinimumSupportedVersion(allDeps, 'react') ?? oldestSupportedReactVersion
|
|
16
|
-
const hasPropTypes = Object.hasOwn(allDeps, 'prop-types')
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const jsxA11yRecommended = deprecated.remove(
|
|
19
|
+
pluginJsxA11y.flatConfigs.recommended,
|
|
20
|
+
// jsx-a11y/label-has-for is deprecated but still defined in the recommended config
|
|
21
|
+
['jsx-a11y/label-has-for']
|
|
22
|
+
)
|
|
20
23
|
|
|
21
|
-
export default
|
|
24
|
+
export default defineConfig(
|
|
22
25
|
{
|
|
23
26
|
extends: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
...pluginReact.configs.flat.recommended,
|
|
27
|
-
},
|
|
28
|
-
pluginJsxA11y.flatConfigs.recommended,
|
|
27
|
+
pluginReact.configs.recommended,
|
|
28
|
+
jsxA11yRecommended,
|
|
29
29
|
{
|
|
30
30
|
name: 'react-hooks/recommended',
|
|
31
|
-
|
|
32
|
-
'react-hooks': pluginReactHooks,
|
|
33
|
-
},
|
|
34
|
-
rules: pluginReactHooks.configs.recommended.rules,
|
|
31
|
+
...pluginReactHooks.configs.flat['recommended-latest'],
|
|
35
32
|
},
|
|
36
33
|
],
|
|
37
34
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
@@ -42,113 +39,72 @@ export default tseslint.config(
|
|
|
42
39
|
},
|
|
43
40
|
name: 'mrpalmer/react',
|
|
44
41
|
rules: {
|
|
45
|
-
'react/
|
|
46
|
-
'react/
|
|
47
|
-
'react/
|
|
48
|
-
'react/
|
|
49
|
-
'react/
|
|
50
|
-
'react/
|
|
51
|
-
'react/
|
|
52
|
-
'react/
|
|
53
|
-
'react/
|
|
54
|
-
'react/
|
|
55
|
-
'react/
|
|
56
|
-
'react/function-component-definition': 'off',
|
|
57
|
-
'react/hook-use-state': 'off',
|
|
58
|
-
'react/iframe-missing-sandbox': 'warn',
|
|
59
|
-
'react/jsx-boolean-value': 'off',
|
|
60
|
-
'react/jsx-child-element-spacing': 'warn',
|
|
61
|
-
'react/jsx-closing-bracket-location': 'off',
|
|
62
|
-
'react/jsx-closing-tag-location': 'off',
|
|
63
|
-
'react/jsx-curly-brace-presence': [
|
|
64
|
-
'warn',
|
|
65
|
-
{ children: 'ignore', propElementValues: 'always', props: 'never' },
|
|
66
|
-
],
|
|
67
|
-
'react/jsx-curly-newline': 'off',
|
|
68
|
-
'react/jsx-curly-spacing': 'off',
|
|
69
|
-
'react/jsx-equals-spacing': 'off',
|
|
70
|
-
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
|
|
71
|
-
'react/jsx-first-prop-new-line': 'off',
|
|
72
|
-
'react/jsx-fragments': 'off',
|
|
73
|
-
'react/jsx-handler-names': 'off',
|
|
74
|
-
'react/jsx-indent': 'off',
|
|
75
|
-
'react/jsx-indent-props': 'off',
|
|
76
|
-
'react/jsx-max-depth': 'off',
|
|
77
|
-
'react/jsx-max-props-per-line': 'off',
|
|
78
|
-
'react/jsx-newline': 'off',
|
|
79
|
-
'react/jsx-no-bind': 'off',
|
|
80
|
-
'react/jsx-no-constructed-context-values': 'off',
|
|
81
|
-
'react/jsx-no-leaked-render': 'off',
|
|
82
|
-
'react/jsx-no-literals': 'off',
|
|
83
|
-
'react/jsx-no-script-url': 'error',
|
|
84
|
-
'react/jsx-no-useless-fragment': 'warn',
|
|
85
|
-
'react/jsx-one-expression-per-line': 'off',
|
|
86
|
-
'react/jsx-pascal-case': 'error',
|
|
87
|
-
'react/jsx-props-no-multi-spaces': 'off',
|
|
88
|
-
'react/jsx-props-no-spread-multi': 'warn',
|
|
89
|
-
'react/jsx-props-no-spreading': 'off',
|
|
90
|
-
'react/jsx-sort-props': 'off',
|
|
91
|
-
'react/jsx-tag-spacing': 'off',
|
|
92
|
-
'react/jsx-wrap-multilines': 'off',
|
|
93
|
-
'react/no-access-state-in-setstate': 'error',
|
|
94
|
-
'react/no-adjacent-inline-elements': 'off',
|
|
95
|
-
'react/no-array-index-key': 'off', // sometimes you don't care about the issues, or they don't apply
|
|
96
|
-
'react/no-arrow-function-lifecycle': 'error',
|
|
97
|
-
'react/no-danger': 'off',
|
|
98
|
-
'react/no-did-mount-set-state': 'error',
|
|
99
|
-
'react/no-did-update-set-state': 'error',
|
|
100
|
-
'react/no-invalid-html-attribute': 'error',
|
|
101
|
-
'react/no-multi-comp': 'off',
|
|
102
|
-
'react/no-namespace': 'error',
|
|
103
|
-
'react/no-object-type-as-default-prop': 'warn',
|
|
104
|
-
'react/no-redundant-should-component-update': 'error',
|
|
105
|
-
'react/no-set-state': 'off',
|
|
106
|
-
'react/no-this-in-sfc': 'error',
|
|
107
|
-
'react/no-typos': 'error',
|
|
108
|
-
'react/no-unescaped-entities': 'warn',
|
|
109
|
-
'react/no-unsafe': 'warn', // if you need it there should be a comment explaining why
|
|
110
|
-
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
|
111
|
-
'react/no-unused-class-component-methods': 'error',
|
|
112
|
-
'react/no-unused-prop-types': hasPropTypes ? 'error' : 'off',
|
|
113
|
-
'react/no-unused-state': 'error',
|
|
114
|
-
'react/no-will-update-set-state': 'error',
|
|
115
|
-
'react/prefer-es6-class': 'off',
|
|
116
|
-
'react/prefer-exact-props': 'off',
|
|
117
|
-
'react/prefer-read-only-props': 'off',
|
|
118
|
-
'react/prefer-stateless-function': 'off',
|
|
119
|
-
'react/prop-types': hasPropTypes ? 'error' : 'off',
|
|
120
|
-
'react/require-default-props': 'off', // sometimes the default value is undefined so that's fine...
|
|
121
|
-
'react/require-optimization': 'off',
|
|
122
|
-
'react/self-closing-comp': 'error',
|
|
123
|
-
'react/sort-comp': 'off',
|
|
124
|
-
'react/sort-default-props': 'off',
|
|
125
|
-
'react/sort-prop-types': 'off',
|
|
126
|
-
'react/state-in-constructor': 'off',
|
|
127
|
-
'react/static-property-placement': 'off',
|
|
128
|
-
'react/style-prop-object': 'error',
|
|
129
|
-
'react/void-dom-elements-no-children': 'error',
|
|
42
|
+
'react-hooks/automatic-effect-dependencies': 'off',
|
|
43
|
+
'react-hooks/capitalized-calls': 'off',
|
|
44
|
+
'react-hooks/fbt': 'off',
|
|
45
|
+
'react-hooks/fire': 'off',
|
|
46
|
+
'react-hooks/hooks': 'off',
|
|
47
|
+
'react-hooks/invariant': 'off',
|
|
48
|
+
'react-hooks/memoized-effect-dependencies': 'off',
|
|
49
|
+
'react-hooks/no-deriving-state-in-effects': 'off',
|
|
50
|
+
'react-hooks/rule-suppression': 'off',
|
|
51
|
+
'react-hooks/syntax': 'off',
|
|
52
|
+
'react-hooks/todo': 'off',
|
|
130
53
|
|
|
131
54
|
'jsx-a11y/lang': 'error',
|
|
132
55
|
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
133
56
|
'jsx-a11y/no-autofocus': 'off',
|
|
134
57
|
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
135
58
|
'jsx-a11y/tabindex-no-positive': 'warn',
|
|
59
|
+
|
|
60
|
+
'@eslint-react/jsx-key-before-spread': 'warn',
|
|
61
|
+
'@eslint-react/jsx-no-iife': 'warn',
|
|
62
|
+
'@eslint-react/jsx-no-undef': 'error',
|
|
63
|
+
'@eslint-react/jsx-shorthand-boolean': 'warn',
|
|
64
|
+
'@eslint-react/jsx-shorthand-fragment': 'warn',
|
|
65
|
+
'@eslint-react/no-children-prop': 'warn',
|
|
66
|
+
'@eslint-react/no-class-component': 'warn',
|
|
67
|
+
'@eslint-react/no-forbidden-props': 'off',
|
|
68
|
+
'@eslint-react/no-leaked-conditional-rendering': 'off', // will be enabled for typescript files below
|
|
69
|
+
'@eslint-react/no-missing-component-display-name': 'warn',
|
|
70
|
+
'@eslint-react/no-missing-context-display-name': 'warn',
|
|
71
|
+
'@eslint-react/no-misused-capture-owner-stack': 'error',
|
|
72
|
+
'@eslint-react/no-unnecessary-key': 'warn',
|
|
73
|
+
'@eslint-react/no-unnecessary-use-callback': 'warn',
|
|
74
|
+
'@eslint-react/no-unnecessary-use-memo': 'warn',
|
|
75
|
+
'@eslint-react/no-unstable-context-value': 'warn',
|
|
76
|
+
'@eslint-react/no-unstable-default-props': 'warn',
|
|
77
|
+
'@eslint-react/no-unused-props': 'warn',
|
|
78
|
+
'@eslint-react/no-unused-state': 'warn',
|
|
79
|
+
'@eslint-react/no-useless-fragment': 'warn',
|
|
80
|
+
'@eslint-react/prefer-destructuring-assignment': 'warn',
|
|
81
|
+
'@eslint-react/prefer-namespace-import': 'warn',
|
|
82
|
+
'@eslint-react/prefer-read-only-props': 'off', // may be enabled for typescript files below
|
|
83
|
+
|
|
84
|
+
'@eslint-react/dom/no-missing-button-type': 'off',
|
|
85
|
+
'@eslint-react/dom/no-missing-iframe-sandbox': 'off',
|
|
86
|
+
'@eslint-react/dom/no-string-style-prop': 'error',
|
|
87
|
+
'@eslint-react/dom/no-unknown-property': 'error',
|
|
88
|
+
'@eslint-react/dom/no-unsafe-target-blank': 'warn',
|
|
89
|
+
'@eslint-react/dom/no-void-elements-with-children': 'error',
|
|
90
|
+
'@eslint-react/dom/prefer-namespace-import': 'error',
|
|
91
|
+
|
|
92
|
+
'@eslint-react/naming-convention/component-name': 'warn',
|
|
93
|
+
'@eslint-react/naming-convention/filename': 'off', // this needs to be configured per project
|
|
94
|
+
'@eslint-react/naming-convention/filename-extension': [
|
|
95
|
+
'warn',
|
|
96
|
+
'as-needed',
|
|
97
|
+
],
|
|
98
|
+
'@eslint-react/naming-convention/use-state': 'off',
|
|
136
99
|
},
|
|
137
100
|
settings: {
|
|
138
|
-
react: {
|
|
101
|
+
'react-x': {
|
|
139
102
|
version: minimumSupportedReactVersion,
|
|
140
103
|
},
|
|
141
104
|
},
|
|
142
105
|
},
|
|
143
106
|
{
|
|
144
107
|
files: ['**/*.ts?(x)'],
|
|
145
|
-
|
|
146
|
-
rules: {
|
|
147
|
-
'react/jsx-filename-extension': [
|
|
148
|
-
'error',
|
|
149
|
-
{ extensions: ['.ts', '.tsx'] },
|
|
150
|
-
],
|
|
151
|
-
'react/prop-types': 'off',
|
|
152
|
-
},
|
|
108
|
+
...pluginReact.configs['recommended-type-checked'],
|
|
153
109
|
}
|
|
154
110
|
)
|
package/configs/typescript.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
|
|
2
3
|
import pluginImport from 'eslint-plugin-import-x'
|
|
3
4
|
import tseslint from 'typescript-eslint'
|
|
@@ -13,7 +14,7 @@ tseslint.configs.stylisticTypeChecked.forEach(disableDeprecatedRules)
|
|
|
13
14
|
|
|
14
15
|
delete pluginImport.flatConfigs.typescript.settings['import-x/resolver']
|
|
15
16
|
|
|
16
|
-
export default
|
|
17
|
+
export default defineConfig({
|
|
17
18
|
extends: [
|
|
18
19
|
...tseslint.configs.strictTypeChecked,
|
|
19
20
|
...tseslint.configs.stylisticTypeChecked,
|
|
@@ -130,6 +131,7 @@ export default tseslint.config({
|
|
|
130
131
|
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'warn',
|
|
131
132
|
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
|
|
132
133
|
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
|
134
|
+
'@typescript-eslint/no-unnecessary-type-conversion': 'warn',
|
|
133
135
|
'@typescript-eslint/no-unsafe-type-assertion': 'error',
|
|
134
136
|
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
135
137
|
'@typescript-eslint/parameter-properties': [
|
|
@@ -148,7 +150,6 @@ export default tseslint.config({
|
|
|
148
150
|
],
|
|
149
151
|
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
150
152
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
151
|
-
'@typescript-eslint/typedef': 'off',
|
|
152
153
|
},
|
|
153
154
|
settings: {
|
|
154
155
|
'import-x/resolver-next': [
|
package/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import globals from 'globals'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
2
|
import base from './configs/base.js'
|
|
4
3
|
import jest from './configs/jest.js'
|
|
5
4
|
import react from './configs/react.js'
|
|
6
5
|
import typescript from './configs/typescript.js'
|
|
7
6
|
|
|
8
7
|
const configs = {
|
|
9
|
-
all: [...base, ...
|
|
8
|
+
all: [...base, ...typescript, ...react, ...jest],
|
|
10
9
|
base,
|
|
11
10
|
jest,
|
|
12
11
|
react,
|
|
@@ -14,8 +13,7 @@ const configs = {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export default {
|
|
17
|
-
config,
|
|
18
16
|
configs,
|
|
19
17
|
globals,
|
|
20
18
|
}
|
|
21
|
-
export {
|
|
19
|
+
export { configs, globals }
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrpalmer/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Mike Palmer's personal ESLint rules",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"types": "./types/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
7
14
|
"main": "index.js",
|
|
15
|
+
"types": "types/index.d.ts",
|
|
8
16
|
"scripts": {
|
|
17
|
+
"prebuild": "rm -rf types",
|
|
18
|
+
"build": "tsc",
|
|
9
19
|
"check-config": "run-p check-config:*",
|
|
10
20
|
"check-config:jest": "cd test && validate-config -f component.test.js",
|
|
11
21
|
"check-config:jest-ts": "cd test && validate-config -f component.test.ts",
|
|
@@ -15,21 +25,20 @@
|
|
|
15
25
|
"validate": "npm run check-config"
|
|
16
26
|
},
|
|
17
27
|
"dependencies": {
|
|
18
|
-
"@eslint/
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"eslint-import-resolver-typescript": "^4.
|
|
22
|
-
"eslint-plugin-import-x": "^4.
|
|
23
|
-
"eslint-plugin-jest": "^
|
|
28
|
+
"@eslint-react/eslint-plugin": "^2.2.2",
|
|
29
|
+
"@eslint/js": "^9.31.0",
|
|
30
|
+
"@mrpalmer/eslint-plugin": "^1.0.2",
|
|
31
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
32
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
33
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
24
34
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
25
35
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
26
|
-
"eslint-plugin-react": "^7.
|
|
27
|
-
"eslint-plugin-
|
|
28
|
-
"
|
|
29
|
-
"globals": "^15.14.0",
|
|
36
|
+
"eslint-plugin-react-hooks": "^7.0.0",
|
|
37
|
+
"eslint-plugin-testing-library": "^7.13.3",
|
|
38
|
+
"globals": "^16.4.0",
|
|
30
39
|
"read-package-up": "^11.0.0",
|
|
31
|
-
"semver": "^7.3
|
|
32
|
-
"typescript-eslint": "^8.
|
|
40
|
+
"semver": "^7.7.3",
|
|
41
|
+
"typescript-eslint": "^8.46.1"
|
|
33
42
|
},
|
|
34
43
|
"peerDependencies": {
|
|
35
44
|
"@testing-library/dom": "*",
|
|
@@ -54,7 +63,7 @@
|
|
|
54
63
|
},
|
|
55
64
|
"engines": {
|
|
56
65
|
"node": ">=20",
|
|
57
|
-
"npm": ">=
|
|
66
|
+
"npm": ">=10",
|
|
58
67
|
"yarn": ">=1"
|
|
59
68
|
}
|
|
60
69
|
}
|
package/tsconfig.json
ADDED
package/turbo.json
ADDED
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { configs };
|
|
3
|
+
export { globals };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export namespace configs {
|
|
7
|
+
export let all: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
|
|
8
|
+
export { base };
|
|
9
|
+
export { jest };
|
|
10
|
+
export { react };
|
|
11
|
+
export { typescript };
|
|
12
|
+
}
|
|
13
|
+
import globals from 'globals';
|
|
14
|
+
import base from './configs/base.js';
|
|
15
|
+
import jest from './configs/jest.js';
|
|
16
|
+
import react from './configs/react.js';
|
|
17
|
+
import typescript from './configs/typescript.js';
|
|
18
|
+
export { globals };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @typedef {Record<string, string>} Dependencies */
|
|
2
|
+
/**
|
|
3
|
+
* Get all dependencies from the current project
|
|
4
|
+
* @returns {Dependencies}
|
|
5
|
+
*/
|
|
6
|
+
export function getAllDependencies(): Dependencies;
|
|
7
|
+
/**
|
|
8
|
+
* Get the installed version of a dependency
|
|
9
|
+
* @param {Dependencies} allDeps
|
|
10
|
+
* @param {string} depName
|
|
11
|
+
* @returns {string | undefined}
|
|
12
|
+
*/
|
|
13
|
+
export function getMinimumSupportedVersion(allDeps: Dependencies, depName: string): string | undefined;
|
|
14
|
+
export type Dependencies = Record<string, string>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function remove(config, ruleNames) {
|
|
2
|
+
if (!config || !config.rules) {
|
|
3
|
+
return config
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
for (const ruleName of ruleNames) {
|
|
7
|
+
if (Object.hasOwn(config.rules, ruleName)) {
|
|
8
|
+
delete config.rules[ruleName]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return config
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function disable(pluginName, ruleNames) {
|
|
16
|
+
return Object.fromEntries(
|
|
17
|
+
ruleNames.map((ruleName) => [`${pluginName}/${ruleName}`, 'off'])
|
|
18
|
+
)
|
|
19
|
+
}
|