@ts-items/oxlint-config 0.1.0 → 0.2.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/README.md +15 -0
- package/dist/configurations/baseConfig/baseConfig.d.ts +38 -26
- package/dist/configurations/baseConfig/baseConfig.js +14 -22
- package/dist/configurations/baseConfig/rules/eslintRules/eslintRules.d.ts +16 -1
- package/dist/configurations/baseConfig/rules/eslintRules/eslintRules.js +17 -1
- package/dist/configurations/baseConfig/rules/importRules/importRules.d.ts +9 -0
- package/dist/configurations/baseConfig/rules/importRules/importRules.js +10 -0
- package/dist/configurations/baseConfig/rules/oxcRules/oxcRules.d.ts +5 -0
- package/dist/configurations/baseConfig/rules/oxcRules/oxcRules.js +6 -0
- package/dist/configurations/baseConfig/rules/typescriptRules/typescriptRules.d.ts +3 -0
- package/dist/configurations/baseConfig/rules/typescriptRules/typescriptRules.js +3 -0
- package/dist/configurations/baseConfig/rules/unicornRules/unicornRules.d.ts +2 -0
- package/dist/configurations/baseConfig/rules/unicornRules/unicornRules.js +2 -0
- package/dist/configurations/index.d.ts +1 -0
- package/dist/configurations/index.js +1 -0
- package/dist/configurations/nextConfig/nextConfig.d.ts +47 -31
- package/dist/configurations/reactConfig/reactConfig.d.ts +47 -31
- package/dist/configurations/reactConfig/reactConfig.js +4 -18
- package/dist/configurations/reactConfig/rules/reactPerformanceRules/reactPerformanceRules.d.ts +6 -0
- package/dist/configurations/reactConfig/rules/reactPerformanceRules/reactPerformanceRules.js +8 -0
- package/dist/configurations/reactConfig/rules/reactRules/reactRules.d.ts +18 -0
- package/dist/configurations/reactConfig/rules/reactRules/reactRules.js +21 -0
- package/dist/configurations/storybookConfig/storybookConfig.d.ts +1 -0
- package/dist/configurations/storybookConfig/storybookConfig.js +2 -0
- package/dist/configurations/vitestConfig/vitestConfig.d.ts +24 -0
- package/dist/configurations/vitestConfig/vitestConfig.js +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,3 +71,18 @@ export default defineConfig({
|
|
|
71
71
|
// some config for react
|
|
72
72
|
})
|
|
73
73
|
```
|
|
74
|
+
|
|
75
|
+
### For Vitest with some TypeScript Project
|
|
76
|
+
|
|
77
|
+
Enable the vitest plugin and adjust some of its rules for Vitest.
|
|
78
|
+
`vitest/prefer-importing-vitest-globals` is enabled only for test files (`*.spec.*`, `*.test.*`, `spec/**`), so `expect` imported from `storybook/test` in stories is not reported.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { vitestConfig } from "@ts-items/oxlint-config"
|
|
82
|
+
import { defineConfig } from "oxlint"
|
|
83
|
+
|
|
84
|
+
export default defineConfig({
|
|
85
|
+
extends: [vitestConfig],
|
|
86
|
+
// some config for typescript
|
|
87
|
+
})
|
|
88
|
+
```
|
|
@@ -8,42 +8,39 @@ export declare const baseConfig: {
|
|
|
8
8
|
style: "error";
|
|
9
9
|
suspicious: "error";
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
overrides: {
|
|
12
|
+
files: string[];
|
|
13
|
+
rules: {
|
|
14
|
+
"typescript/consistent-type-definitions": "off";
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
plugins: ("eslint" | "import" | "oxc" | "unicorn")[];
|
|
12
18
|
rules: {
|
|
13
|
-
"
|
|
14
|
-
"explicit-module-boundary-types": "off";
|
|
15
|
-
"exports-last": "off";
|
|
16
|
-
"filename-case": "off";
|
|
17
|
-
"group-exports": "off";
|
|
18
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
19
|
-
"import/no-relative-parent-imports": "off";
|
|
20
|
-
"no-duplicate-imports": ["error", {
|
|
21
|
-
allowSeparateTypeImports: true;
|
|
22
|
-
}];
|
|
23
|
-
"no-inline-comments": "off";
|
|
24
|
-
"no-named-export": "off";
|
|
25
|
-
"no-nested-ternary": "error";
|
|
26
|
-
"no-null": "off";
|
|
27
|
-
"no-rest-spread-properties": "off";
|
|
28
|
-
"no-ternary": "off";
|
|
29
|
-
"no-undefined": "off";
|
|
30
|
-
"no-unneeded-ternary": "error";
|
|
31
|
-
"no-warning-comments": "off";
|
|
32
|
-
"one-var": "off";
|
|
33
|
-
"oxc/no-async-await": "off";
|
|
34
|
-
"oxc/no-optional-chaining": "off";
|
|
35
|
-
"prefer-default-export": "off";
|
|
36
|
-
"sort-imports": "off";
|
|
19
|
+
"unicorn/filename-case": "off";
|
|
37
20
|
"unicorn/no-array-callback-reference": "off";
|
|
38
21
|
"unicorn/no-array-reduce": "off";
|
|
39
22
|
"unicorn/no-immediate-mutation": "off";
|
|
23
|
+
"unicorn/no-null": "off";
|
|
40
24
|
"typescript/require-await": "error";
|
|
25
|
+
"typescript/consistent-type-definitions": ["error", "type"];
|
|
26
|
+
"typescript/explicit-function-return-type": "off";
|
|
27
|
+
"typescript/explicit-module-boundary-types": "off";
|
|
41
28
|
"typescript/prefer-readonly-parameter-types": "off";
|
|
42
29
|
"typescript/promise-function-async": "error";
|
|
43
30
|
"typescript/restrict-template-expressions": ["error", {
|
|
44
31
|
readonly allowBoolean: true;
|
|
45
32
|
readonly allowNumber: true;
|
|
46
33
|
}];
|
|
34
|
+
"oxc/no-async-await": "off";
|
|
35
|
+
"oxc/no-optional-chaining": "off";
|
|
36
|
+
"oxc/no-rest-spread-properties": "off";
|
|
37
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
38
|
+
"import/exports-last": "off";
|
|
39
|
+
"import/group-exports": "off";
|
|
40
|
+
"import/max-dependencies": "off";
|
|
41
|
+
"import/no-named-export": "off";
|
|
42
|
+
"import/no-relative-parent-imports": "off";
|
|
43
|
+
"import/prefer-default-export": "off";
|
|
47
44
|
"eslint/arrow-body-style": ["error", "as-needed"];
|
|
48
45
|
"eslint/complexity": ["error", 5];
|
|
49
46
|
"eslint/curly": ["warn", "all"];
|
|
@@ -64,18 +61,33 @@ export declare const baseConfig: {
|
|
|
64
61
|
"eslint/max-nested-callbacks": ["error", 3];
|
|
65
62
|
"eslint/max-params": ["warn", 3];
|
|
66
63
|
"eslint/max-statements": ["error", 10];
|
|
64
|
+
"eslint/no-duplicate-imports": ["error", {
|
|
65
|
+
readonly allowSeparateTypeImports: true;
|
|
66
|
+
}];
|
|
67
67
|
"eslint/no-implicit-coercion": ["warn", {
|
|
68
68
|
readonly boolean: true;
|
|
69
69
|
readonly number: true;
|
|
70
70
|
readonly string: true;
|
|
71
71
|
}];
|
|
72
|
-
"eslint/no-
|
|
72
|
+
"eslint/no-inline-comments": "off";
|
|
73
|
+
"eslint/no-magic-numbers": ["warn", {
|
|
74
|
+
readonly ignoreNumericLiteralTypes: true;
|
|
75
|
+
readonly ignoreReadonlyClassProperties: true;
|
|
76
|
+
readonly ignoreTypeIndexes: true;
|
|
77
|
+
}];
|
|
78
|
+
"eslint/no-nested-ternary": "error";
|
|
73
79
|
"eslint/no-param-reassign": ["error", {
|
|
74
80
|
readonly props: true;
|
|
75
81
|
}];
|
|
82
|
+
"eslint/no-ternary": "off";
|
|
83
|
+
"eslint/no-undefined": "off";
|
|
84
|
+
"eslint/no-unneeded-ternary": "error";
|
|
76
85
|
"eslint/no-use-before-define": "error";
|
|
86
|
+
"eslint/no-warning-comments": "off";
|
|
87
|
+
"eslint/one-var": "off";
|
|
77
88
|
"eslint/prefer-named-capture-group": "warn";
|
|
78
89
|
"eslint/require-await": "off";
|
|
90
|
+
"eslint/sort-imports": "off";
|
|
79
91
|
"eslint/sort-keys": ["warn", "asc", {
|
|
80
92
|
readonly allowLineSeparatedGroups: true;
|
|
81
93
|
}];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from "oxlint";
|
|
2
|
+
import { withRulePrefix } from "../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
3
|
import { eslintRules } from "./rules/eslintRules/eslintRules.js";
|
|
4
|
+
import { importRules } from "./rules/importRules/importRules.js";
|
|
5
|
+
import { oxcRules } from "./rules/oxcRules/oxcRules.js";
|
|
3
6
|
import { typescriptRules } from "./rules/typescriptRules/typescriptRules.js";
|
|
4
7
|
import { unicornRules } from "./rules/unicornRules/unicornRules.js";
|
|
5
8
|
export const baseConfig = defineConfig({
|
|
@@ -12,32 +15,21 @@ export const baseConfig = defineConfig({
|
|
|
12
15
|
style: "error",
|
|
13
16
|
suspicious: "error",
|
|
14
17
|
},
|
|
18
|
+
overrides: [
|
|
19
|
+
{
|
|
20
|
+
// Declaration merging(module augmentation 等)は interface でしか書けず、type への自動修正で拡張が無効になるため
|
|
21
|
+
files: ["**/*.d.{ts,mts,cts}"],
|
|
22
|
+
rules: withRulePrefix("typescript", {
|
|
23
|
+
"consistent-type-definitions": "off",
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
15
27
|
plugins: ["eslint", "import", "oxc", "unicorn"],
|
|
16
28
|
rules: {
|
|
17
29
|
...eslintRules,
|
|
30
|
+
...importRules,
|
|
31
|
+
...oxcRules,
|
|
18
32
|
...typescriptRules,
|
|
19
33
|
...unicornRules,
|
|
20
|
-
"explicit-function-return-type": "off",
|
|
21
|
-
"explicit-module-boundary-types": "off",
|
|
22
|
-
"exports-last": "off",
|
|
23
|
-
"filename-case": "off",
|
|
24
|
-
"group-exports": "off",
|
|
25
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
26
|
-
"import/no-relative-parent-imports": "off",
|
|
27
|
-
"no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
|
|
28
|
-
"no-inline-comments": "off",
|
|
29
|
-
"no-named-export": "off",
|
|
30
|
-
"no-nested-ternary": "error",
|
|
31
|
-
"no-null": "off",
|
|
32
|
-
"no-rest-spread-properties": "off",
|
|
33
|
-
"no-ternary": "off",
|
|
34
|
-
"no-undefined": "off",
|
|
35
|
-
"no-unneeded-ternary": "error",
|
|
36
|
-
"no-warning-comments": "off",
|
|
37
|
-
"one-var": "off",
|
|
38
|
-
"oxc/no-async-await": "off",
|
|
39
|
-
"oxc/no-optional-chaining": "off",
|
|
40
|
-
"prefer-default-export": "off",
|
|
41
|
-
"sort-imports": "off",
|
|
42
34
|
},
|
|
43
35
|
});
|
|
@@ -19,18 +19,33 @@ export declare const eslintRules: {
|
|
|
19
19
|
"eslint/max-nested-callbacks": ["error", 3];
|
|
20
20
|
"eslint/max-params": ["warn", 3];
|
|
21
21
|
"eslint/max-statements": ["error", 10];
|
|
22
|
+
"eslint/no-duplicate-imports": ["error", {
|
|
23
|
+
readonly allowSeparateTypeImports: true;
|
|
24
|
+
}];
|
|
22
25
|
"eslint/no-implicit-coercion": ["warn", {
|
|
23
26
|
readonly boolean: true;
|
|
24
27
|
readonly number: true;
|
|
25
28
|
readonly string: true;
|
|
26
29
|
}];
|
|
27
|
-
"eslint/no-
|
|
30
|
+
"eslint/no-inline-comments": "off";
|
|
31
|
+
"eslint/no-magic-numbers": ["warn", {
|
|
32
|
+
readonly ignoreNumericLiteralTypes: true;
|
|
33
|
+
readonly ignoreReadonlyClassProperties: true;
|
|
34
|
+
readonly ignoreTypeIndexes: true;
|
|
35
|
+
}];
|
|
36
|
+
"eslint/no-nested-ternary": "error";
|
|
28
37
|
"eslint/no-param-reassign": ["error", {
|
|
29
38
|
readonly props: true;
|
|
30
39
|
}];
|
|
40
|
+
"eslint/no-ternary": "off";
|
|
41
|
+
"eslint/no-undefined": "off";
|
|
42
|
+
"eslint/no-unneeded-ternary": "error";
|
|
31
43
|
"eslint/no-use-before-define": "error";
|
|
44
|
+
"eslint/no-warning-comments": "off";
|
|
45
|
+
"eslint/one-var": "off";
|
|
32
46
|
"eslint/prefer-named-capture-group": "warn";
|
|
33
47
|
"eslint/require-await": "off";
|
|
48
|
+
"eslint/sort-imports": "off";
|
|
34
49
|
"eslint/sort-keys": ["warn", "asc", {
|
|
35
50
|
readonly allowLineSeparatedGroups: true;
|
|
36
51
|
}];
|
|
@@ -25,6 +25,7 @@ export const eslintRules = withRulePrefix("eslint", {
|
|
|
25
25
|
"max-nested-callbacks": ["error", 3],
|
|
26
26
|
"max-params": ["warn", 3],
|
|
27
27
|
"max-statements": ["error", 10],
|
|
28
|
+
"no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
|
|
28
29
|
"no-implicit-coercion": [
|
|
29
30
|
"warn",
|
|
30
31
|
{
|
|
@@ -33,15 +34,30 @@ export const eslintRules = withRulePrefix("eslint", {
|
|
|
33
34
|
string: true,
|
|
34
35
|
},
|
|
35
36
|
],
|
|
36
|
-
"no-
|
|
37
|
+
"no-inline-comments": "off",
|
|
38
|
+
"no-magic-numbers": [
|
|
39
|
+
"warn",
|
|
40
|
+
{
|
|
41
|
+
ignoreNumericLiteralTypes: true,
|
|
42
|
+
ignoreReadonlyClassProperties: true,
|
|
43
|
+
ignoreTypeIndexes: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
"no-nested-ternary": "error",
|
|
37
47
|
"no-param-reassign": [
|
|
38
48
|
"error",
|
|
39
49
|
{
|
|
40
50
|
props: true,
|
|
41
51
|
},
|
|
42
52
|
],
|
|
53
|
+
"no-ternary": "off",
|
|
54
|
+
"no-undefined": "off",
|
|
55
|
+
"no-unneeded-ternary": "error",
|
|
43
56
|
"no-use-before-define": "error",
|
|
57
|
+
"no-warning-comments": "off",
|
|
58
|
+
"one-var": "off",
|
|
44
59
|
"prefer-named-capture-group": "warn",
|
|
45
60
|
"require-await": "off",
|
|
61
|
+
"sort-imports": "off",
|
|
46
62
|
"sort-keys": ["warn", "asc", { allowLineSeparatedGroups: true }],
|
|
47
63
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const importRules: {
|
|
2
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
3
|
+
"import/exports-last": "off";
|
|
4
|
+
"import/group-exports": "off";
|
|
5
|
+
"import/max-dependencies": "off";
|
|
6
|
+
"import/no-named-export": "off";
|
|
7
|
+
"import/no-relative-parent-imports": "off";
|
|
8
|
+
"import/prefer-default-export": "off";
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
|
+
export const importRules = withRulePrefix("import", {
|
|
3
|
+
"consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
4
|
+
"exports-last": "off",
|
|
5
|
+
"group-exports": "off",
|
|
6
|
+
"max-dependencies": "off",
|
|
7
|
+
"no-named-export": "off",
|
|
8
|
+
"no-relative-parent-imports": "off",
|
|
9
|
+
"prefer-default-export": "off",
|
|
10
|
+
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const typescriptRules: {
|
|
2
2
|
"typescript/require-await": "error";
|
|
3
|
+
"typescript/consistent-type-definitions": ["error", "type"];
|
|
4
|
+
"typescript/explicit-function-return-type": "off";
|
|
5
|
+
"typescript/explicit-module-boundary-types": "off";
|
|
3
6
|
"typescript/prefer-readonly-parameter-types": "off";
|
|
4
7
|
"typescript/promise-function-async": "error";
|
|
5
8
|
"typescript/restrict-template-expressions": ["error", {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
2
|
export const typescriptRules = withRulePrefix("typescript", {
|
|
3
|
+
"consistent-type-definitions": ["error", "type"],
|
|
4
|
+
"explicit-function-return-type": "off",
|
|
5
|
+
"explicit-module-boundary-types": "off",
|
|
3
6
|
"prefer-readonly-parameter-types": "off",
|
|
4
7
|
"promise-function-async": "error",
|
|
5
8
|
"require-await": "error",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
2
|
export const unicornRules = withRulePrefix("unicorn", {
|
|
3
|
+
"filename-case": "off",
|
|
3
4
|
"no-array-callback-reference": "off",
|
|
4
5
|
"no-array-reduce": "off",
|
|
5
6
|
"no-immediate-mutation": "off",
|
|
7
|
+
"no-null": "off",
|
|
6
8
|
});
|
|
@@ -2,3 +2,4 @@ export { baseConfig } from "./baseConfig/baseConfig.ts";
|
|
|
2
2
|
export { nextConfig } from "./nextConfig/nextConfig.ts";
|
|
3
3
|
export { reactConfig } from "./reactConfig/reactConfig.ts";
|
|
4
4
|
export { storybookConfig } from "./storybookConfig/storybookConfig.ts";
|
|
5
|
+
export { vitestConfig } from "./vitestConfig/vitestConfig.ts";
|
|
@@ -2,3 +2,4 @@ export { baseConfig } from "./baseConfig/baseConfig.js";
|
|
|
2
2
|
export { nextConfig } from "./nextConfig/nextConfig.js";
|
|
3
3
|
export { reactConfig } from "./reactConfig/reactConfig.js";
|
|
4
4
|
export { storybookConfig } from "./storybookConfig/storybookConfig.js";
|
|
5
|
+
export { vitestConfig } from "./vitestConfig/vitestConfig.js";
|
|
@@ -10,42 +10,39 @@ export declare const nextConfig: {
|
|
|
10
10
|
style: "error";
|
|
11
11
|
suspicious: "error";
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
overrides: {
|
|
14
|
+
files: string[];
|
|
15
|
+
rules: {
|
|
16
|
+
"typescript/consistent-type-definitions": "off";
|
|
17
|
+
};
|
|
18
|
+
}[];
|
|
19
|
+
plugins: ("eslint" | "import" | "oxc" | "unicorn")[];
|
|
14
20
|
rules: {
|
|
15
|
-
"
|
|
16
|
-
"explicit-module-boundary-types": "off";
|
|
17
|
-
"exports-last": "off";
|
|
18
|
-
"filename-case": "off";
|
|
19
|
-
"group-exports": "off";
|
|
20
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
21
|
-
"import/no-relative-parent-imports": "off";
|
|
22
|
-
"no-duplicate-imports": ["error", {
|
|
23
|
-
allowSeparateTypeImports: true;
|
|
24
|
-
}];
|
|
25
|
-
"no-inline-comments": "off";
|
|
26
|
-
"no-named-export": "off";
|
|
27
|
-
"no-nested-ternary": "error";
|
|
28
|
-
"no-null": "off";
|
|
29
|
-
"no-rest-spread-properties": "off";
|
|
30
|
-
"no-ternary": "off";
|
|
31
|
-
"no-undefined": "off";
|
|
32
|
-
"no-unneeded-ternary": "error";
|
|
33
|
-
"no-warning-comments": "off";
|
|
34
|
-
"one-var": "off";
|
|
35
|
-
"oxc/no-async-await": "off";
|
|
36
|
-
"oxc/no-optional-chaining": "off";
|
|
37
|
-
"prefer-default-export": "off";
|
|
38
|
-
"sort-imports": "off";
|
|
21
|
+
"unicorn/filename-case": "off";
|
|
39
22
|
"unicorn/no-array-callback-reference": "off";
|
|
40
23
|
"unicorn/no-array-reduce": "off";
|
|
41
24
|
"unicorn/no-immediate-mutation": "off";
|
|
25
|
+
"unicorn/no-null": "off";
|
|
42
26
|
"typescript/require-await": "error";
|
|
27
|
+
"typescript/consistent-type-definitions": ["error", "type"];
|
|
28
|
+
"typescript/explicit-function-return-type": "off";
|
|
29
|
+
"typescript/explicit-module-boundary-types": "off";
|
|
43
30
|
"typescript/prefer-readonly-parameter-types": "off";
|
|
44
31
|
"typescript/promise-function-async": "error";
|
|
45
32
|
"typescript/restrict-template-expressions": ["error", {
|
|
46
33
|
readonly allowBoolean: true;
|
|
47
34
|
readonly allowNumber: true;
|
|
48
35
|
}];
|
|
36
|
+
"oxc/no-async-await": "off";
|
|
37
|
+
"oxc/no-optional-chaining": "off";
|
|
38
|
+
"oxc/no-rest-spread-properties": "off";
|
|
39
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
40
|
+
"import/exports-last": "off";
|
|
41
|
+
"import/group-exports": "off";
|
|
42
|
+
"import/max-dependencies": "off";
|
|
43
|
+
"import/no-named-export": "off";
|
|
44
|
+
"import/no-relative-parent-imports": "off";
|
|
45
|
+
"import/prefer-default-export": "off";
|
|
49
46
|
"eslint/arrow-body-style": ["error", "as-needed"];
|
|
50
47
|
"eslint/complexity": ["error", 5];
|
|
51
48
|
"eslint/curly": ["warn", "all"];
|
|
@@ -66,18 +63,33 @@ export declare const nextConfig: {
|
|
|
66
63
|
"eslint/max-nested-callbacks": ["error", 3];
|
|
67
64
|
"eslint/max-params": ["warn", 3];
|
|
68
65
|
"eslint/max-statements": ["error", 10];
|
|
66
|
+
"eslint/no-duplicate-imports": ["error", {
|
|
67
|
+
readonly allowSeparateTypeImports: true;
|
|
68
|
+
}];
|
|
69
69
|
"eslint/no-implicit-coercion": ["warn", {
|
|
70
70
|
readonly boolean: true;
|
|
71
71
|
readonly number: true;
|
|
72
72
|
readonly string: true;
|
|
73
73
|
}];
|
|
74
|
-
"eslint/no-
|
|
74
|
+
"eslint/no-inline-comments": "off";
|
|
75
|
+
"eslint/no-magic-numbers": ["warn", {
|
|
76
|
+
readonly ignoreNumericLiteralTypes: true;
|
|
77
|
+
readonly ignoreReadonlyClassProperties: true;
|
|
78
|
+
readonly ignoreTypeIndexes: true;
|
|
79
|
+
}];
|
|
80
|
+
"eslint/no-nested-ternary": "error";
|
|
75
81
|
"eslint/no-param-reassign": ["error", {
|
|
76
82
|
readonly props: true;
|
|
77
83
|
}];
|
|
84
|
+
"eslint/no-ternary": "off";
|
|
85
|
+
"eslint/no-undefined": "off";
|
|
86
|
+
"eslint/no-unneeded-ternary": "error";
|
|
78
87
|
"eslint/no-use-before-define": "error";
|
|
88
|
+
"eslint/no-warning-comments": "off";
|
|
89
|
+
"eslint/one-var": "off";
|
|
79
90
|
"eslint/prefer-named-capture-group": "warn";
|
|
80
91
|
"eslint/require-await": "off";
|
|
92
|
+
"eslint/sort-imports": "off";
|
|
81
93
|
"eslint/sort-keys": ["warn", "asc", {
|
|
82
94
|
readonly allowLineSeparatedGroups: true;
|
|
83
95
|
}];
|
|
@@ -85,22 +97,26 @@ export declare const nextConfig: {
|
|
|
85
97
|
}[];
|
|
86
98
|
plugins: ("react" | "react-perf")[];
|
|
87
99
|
rules: {
|
|
88
|
-
"react-
|
|
100
|
+
"react-perf/jsx-no-jsx-as-prop": "off";
|
|
101
|
+
"react-perf/jsx-no-new-array-as-prop": "off";
|
|
102
|
+
"react-perf/jsx-no-new-function-as-prop": "off";
|
|
103
|
+
"react-perf/jsx-no-new-object-as-prop": "off";
|
|
89
104
|
"react/forbid-component-props": ["error", {
|
|
90
|
-
forbid:
|
|
105
|
+
readonly forbid: ["style"];
|
|
91
106
|
}];
|
|
92
107
|
"react/function-component-definition": ["error", {
|
|
93
|
-
namedComponents: "arrow-function";
|
|
108
|
+
readonly namedComponents: "arrow-function";
|
|
94
109
|
}];
|
|
95
110
|
"react/jsx-filename-extension": ["error", {
|
|
96
|
-
extensions:
|
|
111
|
+
readonly extensions: ["tsx"];
|
|
97
112
|
}];
|
|
98
113
|
"react/jsx-fragments": ["error", "element"];
|
|
99
114
|
"react/jsx-max-depth": ["error", {
|
|
100
|
-
max:
|
|
115
|
+
readonly max: 5;
|
|
101
116
|
}];
|
|
102
117
|
"react/jsx-no-literals": "off";
|
|
103
118
|
"react/jsx-props-no-spreading": "off";
|
|
119
|
+
"react/react-in-jsx-scope": "off";
|
|
104
120
|
};
|
|
105
121
|
}[];
|
|
106
122
|
ignorePatterns: string[];
|
|
@@ -9,42 +9,39 @@ export declare const reactConfig: {
|
|
|
9
9
|
style: "error";
|
|
10
10
|
suspicious: "error";
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
overrides: {
|
|
13
|
+
files: string[];
|
|
14
|
+
rules: {
|
|
15
|
+
"typescript/consistent-type-definitions": "off";
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
plugins: ("eslint" | "import" | "oxc" | "unicorn")[];
|
|
13
19
|
rules: {
|
|
14
|
-
"
|
|
15
|
-
"explicit-module-boundary-types": "off";
|
|
16
|
-
"exports-last": "off";
|
|
17
|
-
"filename-case": "off";
|
|
18
|
-
"group-exports": "off";
|
|
19
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
20
|
-
"import/no-relative-parent-imports": "off";
|
|
21
|
-
"no-duplicate-imports": ["error", {
|
|
22
|
-
allowSeparateTypeImports: true;
|
|
23
|
-
}];
|
|
24
|
-
"no-inline-comments": "off";
|
|
25
|
-
"no-named-export": "off";
|
|
26
|
-
"no-nested-ternary": "error";
|
|
27
|
-
"no-null": "off";
|
|
28
|
-
"no-rest-spread-properties": "off";
|
|
29
|
-
"no-ternary": "off";
|
|
30
|
-
"no-undefined": "off";
|
|
31
|
-
"no-unneeded-ternary": "error";
|
|
32
|
-
"no-warning-comments": "off";
|
|
33
|
-
"one-var": "off";
|
|
34
|
-
"oxc/no-async-await": "off";
|
|
35
|
-
"oxc/no-optional-chaining": "off";
|
|
36
|
-
"prefer-default-export": "off";
|
|
37
|
-
"sort-imports": "off";
|
|
20
|
+
"unicorn/filename-case": "off";
|
|
38
21
|
"unicorn/no-array-callback-reference": "off";
|
|
39
22
|
"unicorn/no-array-reduce": "off";
|
|
40
23
|
"unicorn/no-immediate-mutation": "off";
|
|
24
|
+
"unicorn/no-null": "off";
|
|
41
25
|
"typescript/require-await": "error";
|
|
26
|
+
"typescript/consistent-type-definitions": ["error", "type"];
|
|
27
|
+
"typescript/explicit-function-return-type": "off";
|
|
28
|
+
"typescript/explicit-module-boundary-types": "off";
|
|
42
29
|
"typescript/prefer-readonly-parameter-types": "off";
|
|
43
30
|
"typescript/promise-function-async": "error";
|
|
44
31
|
"typescript/restrict-template-expressions": ["error", {
|
|
45
32
|
readonly allowBoolean: true;
|
|
46
33
|
readonly allowNumber: true;
|
|
47
34
|
}];
|
|
35
|
+
"oxc/no-async-await": "off";
|
|
36
|
+
"oxc/no-optional-chaining": "off";
|
|
37
|
+
"oxc/no-rest-spread-properties": "off";
|
|
38
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
39
|
+
"import/exports-last": "off";
|
|
40
|
+
"import/group-exports": "off";
|
|
41
|
+
"import/max-dependencies": "off";
|
|
42
|
+
"import/no-named-export": "off";
|
|
43
|
+
"import/no-relative-parent-imports": "off";
|
|
44
|
+
"import/prefer-default-export": "off";
|
|
48
45
|
"eslint/arrow-body-style": ["error", "as-needed"];
|
|
49
46
|
"eslint/complexity": ["error", 5];
|
|
50
47
|
"eslint/curly": ["warn", "all"];
|
|
@@ -65,18 +62,33 @@ export declare const reactConfig: {
|
|
|
65
62
|
"eslint/max-nested-callbacks": ["error", 3];
|
|
66
63
|
"eslint/max-params": ["warn", 3];
|
|
67
64
|
"eslint/max-statements": ["error", 10];
|
|
65
|
+
"eslint/no-duplicate-imports": ["error", {
|
|
66
|
+
readonly allowSeparateTypeImports: true;
|
|
67
|
+
}];
|
|
68
68
|
"eslint/no-implicit-coercion": ["warn", {
|
|
69
69
|
readonly boolean: true;
|
|
70
70
|
readonly number: true;
|
|
71
71
|
readonly string: true;
|
|
72
72
|
}];
|
|
73
|
-
"eslint/no-
|
|
73
|
+
"eslint/no-inline-comments": "off";
|
|
74
|
+
"eslint/no-magic-numbers": ["warn", {
|
|
75
|
+
readonly ignoreNumericLiteralTypes: true;
|
|
76
|
+
readonly ignoreReadonlyClassProperties: true;
|
|
77
|
+
readonly ignoreTypeIndexes: true;
|
|
78
|
+
}];
|
|
79
|
+
"eslint/no-nested-ternary": "error";
|
|
74
80
|
"eslint/no-param-reassign": ["error", {
|
|
75
81
|
readonly props: true;
|
|
76
82
|
}];
|
|
83
|
+
"eslint/no-ternary": "off";
|
|
84
|
+
"eslint/no-undefined": "off";
|
|
85
|
+
"eslint/no-unneeded-ternary": "error";
|
|
77
86
|
"eslint/no-use-before-define": "error";
|
|
87
|
+
"eslint/no-warning-comments": "off";
|
|
88
|
+
"eslint/one-var": "off";
|
|
78
89
|
"eslint/prefer-named-capture-group": "warn";
|
|
79
90
|
"eslint/require-await": "off";
|
|
91
|
+
"eslint/sort-imports": "off";
|
|
80
92
|
"eslint/sort-keys": ["warn", "asc", {
|
|
81
93
|
readonly allowLineSeparatedGroups: true;
|
|
82
94
|
}];
|
|
@@ -84,21 +96,25 @@ export declare const reactConfig: {
|
|
|
84
96
|
}[];
|
|
85
97
|
plugins: ("react" | "react-perf")[];
|
|
86
98
|
rules: {
|
|
87
|
-
"react-
|
|
99
|
+
"react-perf/jsx-no-jsx-as-prop": "off";
|
|
100
|
+
"react-perf/jsx-no-new-array-as-prop": "off";
|
|
101
|
+
"react-perf/jsx-no-new-function-as-prop": "off";
|
|
102
|
+
"react-perf/jsx-no-new-object-as-prop": "off";
|
|
88
103
|
"react/forbid-component-props": ["error", {
|
|
89
|
-
forbid:
|
|
104
|
+
readonly forbid: ["style"];
|
|
90
105
|
}];
|
|
91
106
|
"react/function-component-definition": ["error", {
|
|
92
|
-
namedComponents: "arrow-function";
|
|
107
|
+
readonly namedComponents: "arrow-function";
|
|
93
108
|
}];
|
|
94
109
|
"react/jsx-filename-extension": ["error", {
|
|
95
|
-
extensions:
|
|
110
|
+
readonly extensions: ["tsx"];
|
|
96
111
|
}];
|
|
97
112
|
"react/jsx-fragments": ["error", "element"];
|
|
98
113
|
"react/jsx-max-depth": ["error", {
|
|
99
|
-
max:
|
|
114
|
+
readonly max: 5;
|
|
100
115
|
}];
|
|
101
116
|
"react/jsx-no-literals": "off";
|
|
102
117
|
"react/jsx-props-no-spreading": "off";
|
|
118
|
+
"react/react-in-jsx-scope": "off";
|
|
103
119
|
};
|
|
104
120
|
};
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { defineConfig } from "oxlint";
|
|
2
2
|
import { baseConfig } from "../baseConfig/baseConfig.js";
|
|
3
|
+
import { reactPerformanceRules } from "./rules/reactPerformanceRules/reactPerformanceRules.js";
|
|
4
|
+
import { reactRules } from "./rules/reactRules/reactRules.js";
|
|
3
5
|
export const reactConfig = defineConfig({
|
|
4
6
|
extends: [baseConfig],
|
|
5
7
|
plugins: ["react", "react-perf"],
|
|
6
8
|
rules: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"react/function-component-definition": [
|
|
10
|
-
"error",
|
|
11
|
-
{
|
|
12
|
-
namedComponents: "arrow-function",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
"react/jsx-filename-extension": [
|
|
16
|
-
"error",
|
|
17
|
-
{
|
|
18
|
-
extensions: ["tsx"],
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
"react/jsx-fragments": ["error", "element"],
|
|
22
|
-
"react/jsx-max-depth": ["error", { max: 5 }],
|
|
23
|
-
"react/jsx-no-literals": "off",
|
|
24
|
-
"react/jsx-props-no-spreading": "off",
|
|
9
|
+
...reactRules,
|
|
10
|
+
...reactPerformanceRules,
|
|
25
11
|
},
|
|
26
12
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
|
+
export const reactPerformanceRules = withRulePrefix("react-perf", {
|
|
3
|
+
// メモ化の必要性は実行環境やレンダリングコストに依存するため、一律に強制しない
|
|
4
|
+
"jsx-no-jsx-as-prop": "off",
|
|
5
|
+
"jsx-no-new-array-as-prop": "off",
|
|
6
|
+
"jsx-no-new-function-as-prop": "off",
|
|
7
|
+
"jsx-no-new-object-as-prop": "off",
|
|
8
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const reactRules: {
|
|
2
|
+
"react/forbid-component-props": ["error", {
|
|
3
|
+
readonly forbid: ["style"];
|
|
4
|
+
}];
|
|
5
|
+
"react/function-component-definition": ["error", {
|
|
6
|
+
readonly namedComponents: "arrow-function";
|
|
7
|
+
}];
|
|
8
|
+
"react/jsx-filename-extension": ["error", {
|
|
9
|
+
readonly extensions: ["tsx"];
|
|
10
|
+
}];
|
|
11
|
+
"react/jsx-fragments": ["error", "element"];
|
|
12
|
+
"react/jsx-max-depth": ["error", {
|
|
13
|
+
readonly max: 5;
|
|
14
|
+
}];
|
|
15
|
+
"react/jsx-no-literals": "off";
|
|
16
|
+
"react/jsx-props-no-spreading": "off";
|
|
17
|
+
"react/react-in-jsx-scope": "off";
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
|
+
export const reactRules = withRulePrefix("react", {
|
|
3
|
+
"forbid-component-props": ["error", { forbid: ["style"] }],
|
|
4
|
+
"function-component-definition": [
|
|
5
|
+
"error",
|
|
6
|
+
{
|
|
7
|
+
namedComponents: "arrow-function",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
"jsx-filename-extension": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
extensions: ["tsx"],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
"jsx-fragments": ["error", "element"],
|
|
17
|
+
"jsx-max-depth": ["error", { max: 5 }],
|
|
18
|
+
"jsx-no-literals": "off",
|
|
19
|
+
"jsx-props-no-spreading": "off",
|
|
20
|
+
"react-in-jsx-scope": "off",
|
|
21
|
+
});
|
|
@@ -14,6 +14,7 @@ export declare const storybookConfig: {
|
|
|
14
14
|
"typescript/restrict-template-expressions": "off";
|
|
15
15
|
"typescript/strict-void-return": "off";
|
|
16
16
|
"import/no-default-export": "off";
|
|
17
|
+
"eslint/max-lines": ["error", 300];
|
|
17
18
|
"eslint/no-magic-numbers": "off";
|
|
18
19
|
"eslint/no-param-reassign": "off";
|
|
19
20
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineConfig } from "oxlint";
|
|
2
2
|
import { withRulePrefix } from "../../utilities/withRulePrefix/withRulePrefix.js";
|
|
3
|
+
/* oxlint-disable no-magic-numbers */
|
|
3
4
|
export const storybookConfig = defineConfig({
|
|
4
5
|
overrides: [
|
|
5
6
|
{
|
|
@@ -20,6 +21,7 @@ export const storybookConfig = defineConfig({
|
|
|
20
21
|
files: ["**/*.stories.*"],
|
|
21
22
|
rules: {
|
|
22
23
|
...withRulePrefix("eslint", {
|
|
24
|
+
"max-lines": ["error", 300],
|
|
23
25
|
"no-magic-numbers": "off",
|
|
24
26
|
"no-param-reassign": "off",
|
|
25
27
|
}),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const vitestConfig: {
|
|
2
|
+
overrides: {
|
|
3
|
+
files: string[];
|
|
4
|
+
rules: {
|
|
5
|
+
"vitest/prefer-importing-vitest-globals": "error";
|
|
6
|
+
"eslint/no-magic-numbers": "off";
|
|
7
|
+
};
|
|
8
|
+
}[];
|
|
9
|
+
plugins: "vitest"[];
|
|
10
|
+
rules: {
|
|
11
|
+
"vitest/prefer-importing-vitest-globals": "off";
|
|
12
|
+
"vitest/no-hooks": "off";
|
|
13
|
+
"vitest/no-importing-vitest-globals": "off";
|
|
14
|
+
"vitest/prefer-expect-assertions": ["error", {
|
|
15
|
+
readonly onlyFunctionsWithAsyncKeyword: true;
|
|
16
|
+
readonly onlyFunctionsWithExpectInCallback: true;
|
|
17
|
+
readonly onlyFunctionsWithExpectInLoop: true;
|
|
18
|
+
}];
|
|
19
|
+
"vitest/require-test-timeout": "off";
|
|
20
|
+
"vitest/valid-title": ["error", {
|
|
21
|
+
readonly allowArguments: true;
|
|
22
|
+
}];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
import { withRulePrefix } from "../../utilities/withRulePrefix/withRulePrefix.js";
|
|
3
|
+
export const vitestConfig = defineConfig({
|
|
4
|
+
overrides: [
|
|
5
|
+
{
|
|
6
|
+
files: ["**/*.{spec,test}.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", "**/spec/**"],
|
|
7
|
+
rules: {
|
|
8
|
+
...withRulePrefix("eslint", {
|
|
9
|
+
// テストは期待値をハードコーディングするため
|
|
10
|
+
"no-magic-numbers": "off",
|
|
11
|
+
}),
|
|
12
|
+
...withRulePrefix("vitest", {
|
|
13
|
+
// Storybook の play 関数などで storybook/test から import した expect を誤検知しないよう、vitest のテストファイルに限る
|
|
14
|
+
"prefer-importing-vitest-globals": "error",
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
plugins: ["vitest"],
|
|
20
|
+
rules: withRulePrefix("vitest", {
|
|
21
|
+
"no-hooks": "off",
|
|
22
|
+
"no-importing-vitest-globals": "off",
|
|
23
|
+
"prefer-expect-assertions": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
onlyFunctionsWithAsyncKeyword: true,
|
|
27
|
+
onlyFunctionsWithExpectInCallback: true,
|
|
28
|
+
onlyFunctionsWithExpectInLoop: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
"prefer-importing-vitest-globals": "off",
|
|
32
|
+
"require-test-timeout": "off",
|
|
33
|
+
"valid-title": ["error", { allowArguments: true }],
|
|
34
|
+
}),
|
|
35
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-items/oxlint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Strict shared oxlint configuration",
|
|
5
5
|
"homepage": "https://github.com/akky-xxxx/project-ts-items/tree/main/workspaces/packages/configurations/oxlint-config#readme",
|
|
6
6
|
"bugs": {
|