@ciridae/configs 0.2.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 +6 -0
- package/eslint.js +44 -48
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
package/eslint.js
CHANGED
|
@@ -1,26 +1,49 @@
|
|
|
1
|
-
import { fixupPluginRules } from "@eslint/compat";
|
|
2
1
|
import eslintReact from "@eslint-react/eslint-plugin";
|
|
3
2
|
import js from "@eslint/js";
|
|
4
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
6
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
8
|
-
import
|
|
7
|
+
import regexpPlugin from "eslint-plugin-regexp";
|
|
9
8
|
import tseslint from "typescript-eslint";
|
|
10
9
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
};
|
|
24
47
|
|
|
25
48
|
export function reactAppConfig({ ignores = ["dist"], rules = {} } = {}) {
|
|
26
49
|
return tseslint.config(
|
|
@@ -35,9 +58,12 @@ export function reactAppConfig({ ignores = ["dist"], rules = {} } = {}) {
|
|
|
35
58
|
plugins: {
|
|
36
59
|
"react-hooks": reactHooks,
|
|
37
60
|
"react-refresh": reactRefresh,
|
|
61
|
+
regexp: regexpPlugin,
|
|
38
62
|
},
|
|
39
63
|
rules: {
|
|
40
64
|
...reactHooks.configs.recommended.rules,
|
|
65
|
+
...reactCompilerAdvisoryRules,
|
|
66
|
+
...regexpRules,
|
|
41
67
|
"react-refresh/only-export-components": [
|
|
42
68
|
"warn",
|
|
43
69
|
{ allowConstantExport: true },
|
|
@@ -57,9 +83,6 @@ function createStrictReactAppConfig(
|
|
|
57
83
|
{
|
|
58
84
|
ignores = ["dist"],
|
|
59
85
|
tsconfigRootDir,
|
|
60
|
-
maxLines = 300,
|
|
61
|
-
maxLinesPerFunction = 80,
|
|
62
|
-
tailwindCssFiles,
|
|
63
86
|
rules = {},
|
|
64
87
|
settings = {},
|
|
65
88
|
testFiles = ["**/*.test.{ts,tsx}", "**/test/**/*.{ts,tsx}"],
|
|
@@ -71,7 +94,7 @@ function createStrictReactAppConfig(
|
|
|
71
94
|
"import-x": importX,
|
|
72
95
|
"react-hooks": reactHooks,
|
|
73
96
|
"react-refresh": reactRefresh,
|
|
74
|
-
|
|
97
|
+
regexp: regexpPlugin,
|
|
75
98
|
};
|
|
76
99
|
|
|
77
100
|
return tseslint.config(
|
|
@@ -93,6 +116,8 @@ function createStrictReactAppConfig(
|
|
|
93
116
|
plugins,
|
|
94
117
|
rules: {
|
|
95
118
|
...plugins["react-hooks"].configs.recommended.rules,
|
|
119
|
+
...reactCompilerAdvisoryRules,
|
|
120
|
+
...regexpRules,
|
|
96
121
|
"@typescript-eslint/no-explicit-any": "error",
|
|
97
122
|
"@typescript-eslint/no-non-null-assertion": "error",
|
|
98
123
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
@@ -103,25 +128,8 @@ function createStrictReactAppConfig(
|
|
|
103
128
|
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
104
129
|
"@typescript-eslint/no-unsafe-return": "error",
|
|
105
130
|
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
106
|
-
complexity: ["error", 12],
|
|
107
131
|
"import-x/no-cycle": "error",
|
|
108
132
|
"import-x/no-self-import": "error",
|
|
109
|
-
"max-depth": ["error", 3],
|
|
110
|
-
"max-lines": [
|
|
111
|
-
"error",
|
|
112
|
-
{ max: maxLines, skipBlankLines: true, skipComments: true },
|
|
113
|
-
],
|
|
114
|
-
"max-lines-per-function": [
|
|
115
|
-
"error",
|
|
116
|
-
{
|
|
117
|
-
max: maxLinesPerFunction,
|
|
118
|
-
skipBlankLines: true,
|
|
119
|
-
skipComments: true,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
"max-nested-callbacks": ["error", 3],
|
|
123
|
-
"max-params": ["error", 4],
|
|
124
|
-
"no-restricted-syntax": ["error", ...typeAssertionBan],
|
|
125
133
|
"@eslint-react/no-nested-component-definitions": "error",
|
|
126
134
|
"@eslint-react/no-unstable-context-value": "error",
|
|
127
135
|
"react-refresh/only-export-components": [
|
|
@@ -138,14 +146,6 @@ function createStrictReactAppConfig(
|
|
|
138
146
|
"import-x/resolver-next": [
|
|
139
147
|
createNodeResolver({ extensions: [".js", ".jsx", ".ts", ".tsx"] }),
|
|
140
148
|
],
|
|
141
|
-
...(tailwindCssFiles
|
|
142
|
-
? {
|
|
143
|
-
tailwindcss: {
|
|
144
|
-
config: {},
|
|
145
|
-
cssFiles: tailwindCssFiles,
|
|
146
|
-
},
|
|
147
|
-
}
|
|
148
|
-
: {}),
|
|
149
149
|
...settings,
|
|
150
150
|
},
|
|
151
151
|
},
|
|
@@ -159,10 +159,6 @@ function createStrictReactAppConfig(
|
|
|
159
159
|
"@typescript-eslint/no-unsafe-return": "off",
|
|
160
160
|
"@typescript-eslint/no-explicit-any": "off",
|
|
161
161
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
162
|
-
"no-restricted-syntax": "off",
|
|
163
|
-
"max-lines-per-function": "off",
|
|
164
|
-
"max-lines": "off",
|
|
165
|
-
"max-nested-callbacks": "off",
|
|
166
162
|
},
|
|
167
163
|
},
|
|
168
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,13 +29,12 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint/compat": "^2.1.0",
|
|
33
32
|
"@eslint-react/eslint-plugin": "^5.14.6",
|
|
34
33
|
"@eslint/js": "^10.0.1",
|
|
35
34
|
"eslint-plugin-import-x": "^4.17.1",
|
|
36
35
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
37
36
|
"eslint-plugin-react-refresh": "^0.5.3",
|
|
38
|
-
"eslint-plugin-
|
|
37
|
+
"eslint-plugin-regexp": "^3.1.1",
|
|
39
38
|
"globals": "^17.7.0",
|
|
40
39
|
"typescript-eslint": "^8.63.0"
|
|
41
40
|
},
|