@ciridae/configs 0.1.0 → 0.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/CHANGELOG.md +12 -0
- package/eslint.js +63 -89
- package/package.json +8 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ciridae/configs
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Keep one ESLint 10 preset with regexp correctness checks and remove copied code-shape, compiler-advisory, and Tailwind lint policy.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Use an ESLint 10-compatible shared baseline and remove legacy ESLint presets.
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
|
|
5
17
|
- Publish shared ESLint, Prettier, and TypeScript configurations with explicit subpath exports.
|
package/eslint.js
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
|
-
import
|
|
1
|
+
import eslintReact from "@eslint-react/eslint-plugin";
|
|
2
2
|
import js from "@eslint/js";
|
|
3
|
-
import
|
|
4
|
-
import react from "eslint-plugin-react";
|
|
3
|
+
import { createNodeResolver, importX } from "eslint-plugin-import-x";
|
|
5
4
|
import globals from "globals";
|
|
6
5
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
7
|
-
import legacyReactHooks from "eslint-plugin-react-hooks-legacy";
|
|
8
6
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
9
|
-
import
|
|
10
|
-
import tailwindcss from "eslint-plugin-tailwindcss";
|
|
11
|
-
import legacyTailwindcss from "eslint-plugin-tailwindcss-legacy";
|
|
7
|
+
import regexpPlugin from "eslint-plugin-regexp";
|
|
12
8
|
import tseslint from "typescript-eslint";
|
|
13
9
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
const reactCompilerAdvisoryRules = {
|
|
11
|
+
"react-hooks/config": "off",
|
|
12
|
+
"react-hooks/gating": "off",
|
|
13
|
+
"react-hooks/globals": "off",
|
|
14
|
+
"react-hooks/immutability": "off",
|
|
15
|
+
"react-hooks/incompatible-library": "off",
|
|
16
|
+
"react-hooks/preserve-manual-memoization": "off",
|
|
17
|
+
"react-hooks/purity": "off",
|
|
18
|
+
"react-hooks/refs": "off",
|
|
19
|
+
"react-hooks/set-state-in-effect": "off",
|
|
20
|
+
"react-hooks/static-components": "off",
|
|
21
|
+
"react-hooks/unsupported-syntax": "off",
|
|
22
|
+
"react-hooks/use-memo": "off",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const recommendedRegexpRules = Object.fromEntries(
|
|
26
|
+
Object.entries(regexpPlugin.configs["flat/recommended"].rules)
|
|
27
|
+
.filter(
|
|
28
|
+
([ruleName, setting]) =>
|
|
29
|
+
ruleName.startsWith("regexp/") && setting !== "off" && setting !== 0,
|
|
30
|
+
)
|
|
31
|
+
.map(([ruleName, setting]) => [
|
|
32
|
+
ruleName,
|
|
33
|
+
Array.isArray(setting) ? ["error", ...setting.slice(1)] : "error",
|
|
34
|
+
]),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const regexpRules = {
|
|
38
|
+
...recommendedRegexpRules,
|
|
39
|
+
"no-empty-character-class": "off",
|
|
40
|
+
"no-invalid-regexp": "off",
|
|
41
|
+
"no-misleading-character-class": "off",
|
|
42
|
+
"no-useless-backreference": "off",
|
|
43
|
+
"prefer-regex-literals": "error",
|
|
44
|
+
"regexp/no-super-linear-move": "error",
|
|
45
|
+
"regexp/prefer-escape-replacement-dollar-char": "error",
|
|
46
|
+
};
|
|
27
47
|
|
|
28
48
|
export function reactAppConfig({ ignores = ["dist"], rules = {} } = {}) {
|
|
29
49
|
return tseslint.config(
|
|
@@ -36,11 +56,14 @@ export function reactAppConfig({ ignores = ["dist"], rules = {} } = {}) {
|
|
|
36
56
|
globals: globals.browser,
|
|
37
57
|
},
|
|
38
58
|
plugins: {
|
|
39
|
-
"react-hooks":
|
|
40
|
-
"react-refresh":
|
|
59
|
+
"react-hooks": reactHooks,
|
|
60
|
+
"react-refresh": reactRefresh,
|
|
61
|
+
regexp: regexpPlugin,
|
|
41
62
|
},
|
|
42
63
|
rules: {
|
|
43
|
-
...
|
|
64
|
+
...reactHooks.configs.recommended.rules,
|
|
65
|
+
...reactCompilerAdvisoryRules,
|
|
66
|
+
...regexpRules,
|
|
44
67
|
"react-refresh/only-export-components": [
|
|
45
68
|
"warn",
|
|
46
69
|
{ allowConstantExport: true },
|
|
@@ -52,42 +75,26 @@ export function reactAppConfig({ ignores = ["dist"], rules = {} } = {}) {
|
|
|
52
75
|
);
|
|
53
76
|
}
|
|
54
77
|
|
|
55
|
-
export function legacyStrictReactAppConfig(options = {}) {
|
|
56
|
-
return createStrictReactAppConfig(options, {
|
|
57
|
-
reactHooks: legacyReactHooks,
|
|
58
|
-
reactRefresh: legacyReactRefresh,
|
|
59
|
-
tailwindcss: legacyTailwindcss,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
78
|
export function strictReactAppConfig(options = {}) {
|
|
64
|
-
return createStrictReactAppConfig(options
|
|
65
|
-
reactHooks,
|
|
66
|
-
reactRefresh,
|
|
67
|
-
tailwindcss,
|
|
68
|
-
});
|
|
79
|
+
return createStrictReactAppConfig(options);
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
function createStrictReactAppConfig(
|
|
72
83
|
{
|
|
73
84
|
ignores = ["dist"],
|
|
74
85
|
tsconfigRootDir,
|
|
75
|
-
maxLines = 300,
|
|
76
|
-
maxLinesPerFunction = 80,
|
|
77
|
-
tailwindCssFiles,
|
|
78
86
|
rules = {},
|
|
79
87
|
settings = {},
|
|
80
88
|
testFiles = ["**/*.test.{ts,tsx}", "**/test/**/*.{ts,tsx}"],
|
|
81
89
|
overrides = [],
|
|
82
90
|
} = {},
|
|
83
|
-
policyPlugins,
|
|
84
91
|
) {
|
|
85
92
|
const plugins = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"react-hooks":
|
|
89
|
-
"react-refresh":
|
|
90
|
-
|
|
93
|
+
"@eslint-react": eslintReact,
|
|
94
|
+
"import-x": importX,
|
|
95
|
+
"react-hooks": reactHooks,
|
|
96
|
+
"react-refresh": reactRefresh,
|
|
97
|
+
regexp: regexpPlugin,
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
return tseslint.config(
|
|
@@ -109,6 +116,8 @@ function createStrictReactAppConfig(
|
|
|
109
116
|
plugins,
|
|
110
117
|
rules: {
|
|
111
118
|
...plugins["react-hooks"].configs.recommended.rules,
|
|
119
|
+
...reactCompilerAdvisoryRules,
|
|
120
|
+
...regexpRules,
|
|
112
121
|
"@typescript-eslint/no-explicit-any": "error",
|
|
113
122
|
"@typescript-eslint/no-non-null-assertion": "error",
|
|
114
123
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
@@ -119,28 +128,10 @@ function createStrictReactAppConfig(
|
|
|
119
128
|
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
120
129
|
"@typescript-eslint/no-unsafe-return": "error",
|
|
121
130
|
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
122
|
-
|
|
123
|
-
"import/no-
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"max-lines": [
|
|
127
|
-
"error",
|
|
128
|
-
{ max: maxLines, skipBlankLines: true, skipComments: true },
|
|
129
|
-
],
|
|
130
|
-
"max-lines-per-function": [
|
|
131
|
-
"error",
|
|
132
|
-
{
|
|
133
|
-
max: maxLinesPerFunction,
|
|
134
|
-
skipBlankLines: true,
|
|
135
|
-
skipComments: true,
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
"max-nested-callbacks": ["error", 3],
|
|
139
|
-
"max-params": ["error", 4],
|
|
140
|
-
"no-restricted-syntax": ["error", ...typeAssertionBan],
|
|
141
|
-
"react/jsx-max-depth": ["error", { max: 4 }],
|
|
142
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
143
|
-
"react/no-unstable-nested-components": "error",
|
|
131
|
+
"import-x/no-cycle": "error",
|
|
132
|
+
"import-x/no-self-import": "error",
|
|
133
|
+
"@eslint-react/no-nested-component-definitions": "error",
|
|
134
|
+
"@eslint-react/no-unstable-context-value": "error",
|
|
144
135
|
"react-refresh/only-export-components": [
|
|
145
136
|
"warn",
|
|
146
137
|
{ allowConstantExport: true },
|
|
@@ -148,26 +139,13 @@ function createStrictReactAppConfig(
|
|
|
148
139
|
...rules,
|
|
149
140
|
},
|
|
150
141
|
settings: {
|
|
151
|
-
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
|
|
152
|
-
"import/parsers": {
|
|
142
|
+
"import-x/extensions": [".js", ".jsx", ".ts", ".tsx"],
|
|
143
|
+
"import-x/parsers": {
|
|
153
144
|
"@typescript-eslint/parser": [".ts", ".tsx"],
|
|
154
145
|
},
|
|
155
|
-
"import/resolver":
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
react: {
|
|
161
|
-
version: "detect",
|
|
162
|
-
},
|
|
163
|
-
...(tailwindCssFiles
|
|
164
|
-
? {
|
|
165
|
-
tailwindcss: {
|
|
166
|
-
config: {},
|
|
167
|
-
cssFiles: tailwindCssFiles,
|
|
168
|
-
},
|
|
169
|
-
}
|
|
170
|
-
: {}),
|
|
146
|
+
"import-x/resolver-next": [
|
|
147
|
+
createNodeResolver({ extensions: [".js", ".jsx", ".ts", ".tsx"] }),
|
|
148
|
+
],
|
|
171
149
|
...settings,
|
|
172
150
|
},
|
|
173
151
|
},
|
|
@@ -181,10 +159,6 @@ function createStrictReactAppConfig(
|
|
|
181
159
|
"@typescript-eslint/no-unsafe-return": "off",
|
|
182
160
|
"@typescript-eslint/no-explicit-any": "off",
|
|
183
161
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
184
|
-
"no-restricted-syntax": "off",
|
|
185
|
-
"max-lines-per-function": "off",
|
|
186
|
-
"max-lines": "off",
|
|
187
|
-
"max-nested-callbacks": "off",
|
|
188
162
|
},
|
|
189
163
|
},
|
|
190
164
|
...overrides,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciridae/configs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared ESLint, Prettier, and TypeScript configurations for Ciridae projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,20 +29,16 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint/
|
|
33
|
-
"@eslint/js": "^
|
|
34
|
-
"eslint-plugin-import": "^
|
|
35
|
-
"eslint-plugin-react": "^7.37.5",
|
|
32
|
+
"@eslint-react/eslint-plugin": "^5.14.6",
|
|
33
|
+
"@eslint/js": "^10.0.1",
|
|
34
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
36
35
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
37
|
-
"eslint-plugin-react-hooks-legacy": "npm:eslint-plugin-react-hooks@^5.1.0-rc.0",
|
|
38
36
|
"eslint-plugin-react-refresh": "^0.5.3",
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"
|
|
41
|
-
"eslint
|
|
42
|
-
"globals": "^15.9.0",
|
|
43
|
-
"typescript-eslint": "^8.0.1"
|
|
37
|
+
"eslint-plugin-regexp": "^3.1.1",
|
|
38
|
+
"globals": "^17.7.0",
|
|
39
|
+
"typescript-eslint": "^8.63.0"
|
|
44
40
|
},
|
|
45
41
|
"peerDependencies": {
|
|
46
|
-
"eslint": "^
|
|
42
|
+
"eslint": "^10.7.0"
|
|
47
43
|
}
|
|
48
44
|
}
|