@10stars/config 13.2.2 → 13.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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfigArray } from "typescript-eslint"
|
|
2
|
+
|
|
3
|
+
import { onlyBrowserWithoutCommon } from "./eslint.config.browser"
|
|
4
|
+
import baseConfig from "./eslint.config.common"
|
|
5
|
+
import { onlyNodeWithoutCommon } from "./eslint.config.node"
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
...baseConfig,
|
|
9
|
+
...onlyBrowserWithoutCommon,
|
|
10
|
+
...onlyNodeWithoutCommon,
|
|
11
|
+
] satisfies ConfigArray
|
package/eslint.config.browser.ts
CHANGED
|
@@ -1,13 +1,108 @@
|
|
|
1
|
+
import reactHooks from "@10stars/eslint-plugin-react-hooks"
|
|
2
|
+
import eslintReact from "@eslint-react/eslint-plugin"
|
|
3
|
+
import type { Linter } from "eslint"
|
|
4
|
+
import reactPlugin from "eslint-plugin-react"
|
|
1
5
|
import globals from "globals"
|
|
2
6
|
import type { ConfigArray } from "typescript-eslint"
|
|
3
7
|
|
|
4
|
-
import baseConfig from "./eslint.config"
|
|
8
|
+
import baseConfig from "./eslint.config.common"
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
const addPluginReact = () =>
|
|
11
|
+
[
|
|
12
|
+
reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object
|
|
13
|
+
reactPlugin.configs.flat["jsx-runtime"], // Add this if you are using React 17+
|
|
14
|
+
{
|
|
15
|
+
settings: {
|
|
16
|
+
react: {
|
|
17
|
+
version: "18",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
"react/display-name": 0,
|
|
22
|
+
"react/no-children-prop": 0,
|
|
23
|
+
|
|
24
|
+
"react/no-unknown-property": [
|
|
25
|
+
2,
|
|
26
|
+
{
|
|
27
|
+
ignore: [`sx`],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
"react/prop-types": 0,
|
|
32
|
+
"react/react-in-jsx-scope": 0,
|
|
33
|
+
|
|
34
|
+
"react/jsx-filename-extension": [
|
|
35
|
+
1,
|
|
36
|
+
{
|
|
37
|
+
extensions: [`.jsx`, `.tsx`],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
"react/no-invalid-html-attribute": 2,
|
|
42
|
+
"react/prefer-stateless-function": 2,
|
|
43
|
+
"react/jsx-boolean-value": [1, `never`],
|
|
44
|
+
"react/jsx-curly-brace-presence": [1, `always`],
|
|
45
|
+
"react/jsx-fragments": 1,
|
|
46
|
+
"react/jsx-no-bind": 1,
|
|
47
|
+
"react/jsx-no-constructed-context-values": 1,
|
|
48
|
+
|
|
49
|
+
"react/jsx-no-script-url": [
|
|
50
|
+
2,
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
name: `Link`,
|
|
54
|
+
props: [`to`],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: `NavLink`,
|
|
58
|
+
props: [`to`],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: `a`,
|
|
62
|
+
props: [`href`, `to`],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
"react/jsx-no-useless-fragment": 1,
|
|
68
|
+
"react/jsx-no-target-blank": 2,
|
|
69
|
+
"react/jsx-sort-props": 1,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
] satisfies Linter.Config[]
|
|
73
|
+
|
|
74
|
+
const addPluginReactExtra = () =>
|
|
75
|
+
[
|
|
76
|
+
eslintReact.configs["recommended-typescript"],
|
|
77
|
+
{
|
|
78
|
+
rules: {
|
|
79
|
+
"@eslint-react/dom/no-dangerously-set-innerhtml": 0, // we use for specific cases
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
] satisfies Linter.Config[]
|
|
83
|
+
|
|
84
|
+
const addStorybookOverrides = () =>
|
|
85
|
+
({
|
|
86
|
+
files: ["**/*stories.tsx"],
|
|
87
|
+
rules: {
|
|
88
|
+
"react/jsx-no-bind": 0, // allow inline functions
|
|
89
|
+
"@eslint-react/no-array-index-key": 0, // allow array index as key
|
|
90
|
+
},
|
|
91
|
+
}) satisfies Linter.Config
|
|
92
|
+
|
|
93
|
+
export const onlyBrowserWithoutCommon = [
|
|
8
94
|
{
|
|
9
95
|
languageOptions: {
|
|
10
96
|
globals: globals.browser,
|
|
11
97
|
},
|
|
12
98
|
},
|
|
99
|
+
...addPluginReact(),
|
|
100
|
+
...addPluginReactExtra(),
|
|
101
|
+
reactHooks.configs.recommended,
|
|
102
|
+
addStorybookOverrides(),
|
|
103
|
+
] satisfies ConfigArray
|
|
104
|
+
|
|
105
|
+
export default [
|
|
106
|
+
...baseConfig,
|
|
107
|
+
...onlyBrowserWithoutCommon,
|
|
13
108
|
] satisfies ConfigArray
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { builtinModules } from "node:module"
|
|
2
2
|
|
|
3
3
|
import eslint from "@eslint/js"
|
|
4
|
-
import eslintReact from "@eslint-react/eslint-plugin"
|
|
5
4
|
import stylistic from "@stylistic/eslint-plugin"
|
|
6
5
|
import type { Linter } from "eslint"
|
|
7
6
|
import eslintConfigPrettier from "eslint-config-prettier"
|
|
8
7
|
import importPlugin from "eslint-plugin-import"
|
|
9
8
|
import noRelativeImportPaths from "eslint-plugin-no-relative-import-paths"
|
|
10
|
-
import reactPlugin from "eslint-plugin-react"
|
|
11
|
-
import reactHooksConfigurable from "eslint-plugin-react-hooks-configurable"
|
|
12
9
|
import * as regexpPlugin from "eslint-plugin-regexp"
|
|
13
10
|
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
|
14
11
|
import tseslint from "typescript-eslint"
|
|
@@ -37,97 +34,6 @@ const addPluginNoRelativeImportPaths = () =>
|
|
|
37
34
|
},
|
|
38
35
|
}) satisfies Linter.Config
|
|
39
36
|
|
|
40
|
-
const addPluginReact = () =>
|
|
41
|
-
[
|
|
42
|
-
reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object
|
|
43
|
-
reactPlugin.configs.flat["jsx-runtime"], // Add this if you are using React 17+
|
|
44
|
-
{
|
|
45
|
-
settings: {
|
|
46
|
-
react: {
|
|
47
|
-
version: "18",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
rules: {
|
|
51
|
-
"react/display-name": 0,
|
|
52
|
-
"react/no-children-prop": 0,
|
|
53
|
-
|
|
54
|
-
"react/no-unknown-property": [
|
|
55
|
-
2,
|
|
56
|
-
{
|
|
57
|
-
ignore: [`sx`],
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
|
|
61
|
-
"react/prop-types": 0,
|
|
62
|
-
"react/react-in-jsx-scope": 0,
|
|
63
|
-
|
|
64
|
-
"react/jsx-filename-extension": [
|
|
65
|
-
1,
|
|
66
|
-
{
|
|
67
|
-
extensions: [`.jsx`, `.tsx`],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
|
|
71
|
-
"react/no-invalid-html-attribute": 2,
|
|
72
|
-
"react/prefer-stateless-function": 2,
|
|
73
|
-
"react/jsx-boolean-value": [1, `never`],
|
|
74
|
-
"react/jsx-curly-brace-presence": [1, `always`],
|
|
75
|
-
"react/jsx-fragments": 1,
|
|
76
|
-
"react/jsx-no-bind": 1,
|
|
77
|
-
"react/jsx-no-constructed-context-values": 1,
|
|
78
|
-
|
|
79
|
-
"react/jsx-no-script-url": [
|
|
80
|
-
2,
|
|
81
|
-
[
|
|
82
|
-
{
|
|
83
|
-
name: `Link`,
|
|
84
|
-
props: [`to`],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: `NavLink`,
|
|
88
|
-
props: [`to`],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: `a`,
|
|
92
|
-
props: [`href`, `to`],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
],
|
|
96
|
-
|
|
97
|
-
"react/jsx-no-useless-fragment": 1,
|
|
98
|
-
"react/jsx-no-target-blank": 2,
|
|
99
|
-
"react/jsx-sort-props": 1,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
] satisfies Linter.Config[]
|
|
103
|
-
|
|
104
|
-
const addPluginReactHooksConfigurable = () =>
|
|
105
|
-
({
|
|
106
|
-
plugins: { "react-hooks-configurable": reactHooksConfigurable },
|
|
107
|
-
rules: {
|
|
108
|
-
"react-hooks-configurable/rules-of-hooks": 2,
|
|
109
|
-
},
|
|
110
|
-
}) satisfies Linter.Config
|
|
111
|
-
|
|
112
|
-
const addPluginReactExtra = () =>
|
|
113
|
-
[
|
|
114
|
-
eslintReact.configs["recommended-typescript"],
|
|
115
|
-
{
|
|
116
|
-
rules: {
|
|
117
|
-
"@eslint-react/dom/no-dangerously-set-innerhtml": 0, // we use for specific cases
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
] satisfies Linter.Config[]
|
|
121
|
-
|
|
122
|
-
const addStorybookOverrides = () =>
|
|
123
|
-
({
|
|
124
|
-
files: ["**/*stories.tsx"],
|
|
125
|
-
rules: {
|
|
126
|
-
"react/jsx-no-bind": 0, // allow inline functions
|
|
127
|
-
"@eslint-react/no-array-index-key": 0, // allow array index as key
|
|
128
|
-
},
|
|
129
|
-
}) satisfies Linter.Config
|
|
130
|
-
|
|
131
37
|
const addPluginImport = () =>
|
|
132
38
|
[
|
|
133
39
|
importPlugin.flatConfigs.recommended,
|
|
@@ -184,9 +90,6 @@ export default tseslint.config(
|
|
|
184
90
|
tseslint.configs.stylisticTypeChecked,
|
|
185
91
|
...addPluginRegexp(),
|
|
186
92
|
addPluginNoRelativeImportPaths(),
|
|
187
|
-
...addPluginReact(),
|
|
188
|
-
...addPluginReactExtra(),
|
|
189
|
-
addPluginReactHooksConfigurable(),
|
|
190
93
|
...addPluginImport(),
|
|
191
94
|
addPluginSimpleImportSort(),
|
|
192
95
|
addPluginStylistic(),
|
|
@@ -323,5 +226,4 @@ export default tseslint.config(
|
|
|
323
226
|
"@typescript-eslint/no-useless-constructor": 1,
|
|
324
227
|
},
|
|
325
228
|
},
|
|
326
|
-
addStorybookOverrides(),
|
|
327
229
|
)
|
package/eslint.config.node.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import globals from "globals"
|
|
2
2
|
import type { ConfigArray } from "typescript-eslint"
|
|
3
3
|
|
|
4
|
-
import baseConfig from "./eslint.config"
|
|
4
|
+
import baseConfig from "./eslint.config.common"
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
...baseConfig,
|
|
6
|
+
export const onlyNodeWithoutCommon = [
|
|
8
7
|
{
|
|
9
8
|
languageOptions: {
|
|
10
9
|
globals: globals.node,
|
|
11
10
|
},
|
|
12
11
|
},
|
|
13
12
|
] satisfies ConfigArray
|
|
13
|
+
|
|
14
|
+
export default [
|
|
15
|
+
...baseConfig,
|
|
16
|
+
...onlyNodeWithoutCommon, //
|
|
17
|
+
] satisfies ConfigArray
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"name": "@10stars/config",
|
|
7
|
-
"version": "13.
|
|
7
|
+
"version": "13.3.0",
|
|
8
8
|
"author": "10stars.dev <web@alexandrov.co> (https://alexandrov.co)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"src",
|
|
15
|
-
"eslint.config.ts",
|
|
15
|
+
"eslint.config.all.ts",
|
|
16
|
+
"eslint.config.common.ts",
|
|
16
17
|
"eslint.config.browser.ts",
|
|
17
18
|
"eslint.config.node.ts",
|
|
18
19
|
".prettierrc.js",
|
|
@@ -23,10 +24,11 @@
|
|
|
23
24
|
"tsx": "newer tsx breaks ladle"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
27
|
+
"@10stars/eslint-plugin-react-hooks": "^5.1.0",
|
|
26
28
|
"@commitlint/cli": "^19.0.0",
|
|
27
29
|
"@commitlint/config-conventional": "^19.0.0",
|
|
28
30
|
"@eslint/js": "^9.0.0",
|
|
29
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
31
|
+
"@eslint-react/eslint-plugin": "^1.0.0",
|
|
30
32
|
"@stylistic/eslint-plugin": "^4.0.0",
|
|
31
33
|
"@types/lodash": "^4.0.0",
|
|
32
34
|
"@types/node": "^22.0.0",
|
|
@@ -37,7 +39,6 @@
|
|
|
37
39
|
"eslint-plugin-import": "^2.0.0",
|
|
38
40
|
"eslint-plugin-no-relative-import-paths": "^1.5.4",
|
|
39
41
|
"eslint-plugin-react": "^7.0.0",
|
|
40
|
-
"eslint-plugin-react-hooks-configurable": "5.1.0",
|
|
41
42
|
"eslint-plugin-regexp": "^2.0.0",
|
|
42
43
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
43
44
|
"globals": "^16.0.0",
|