eslint-config-matsuri 4.1.2 → 4.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 +31 -4
- package/configs/base.js +26 -0
- package/configs/javascript.js +53 -0
- package/configs/react.js +71 -0
- package/configs/test.js +11 -0
- package/configs/typescript.js +93 -0
- package/index.js +13 -252
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,14 +32,41 @@ export default config
|
|
|
32
32
|
拡張する場合は、次のようにしてください。
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import
|
|
35
|
+
import { configs } from "eslint-config-matsuri";
|
|
36
36
|
|
|
37
37
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
38
38
|
export default [
|
|
39
|
-
|
|
39
|
+
configs.base,
|
|
40
|
+
{
|
|
41
|
+
...configs.javascript,
|
|
42
|
+
rules: {
|
|
43
|
+
...configs.javascript.rules,
|
|
44
|
+
eqeqeq: "off",
|
|
45
|
+
"unused-imports/no-unused-vars": "off",
|
|
46
|
+
"sort-imports-es6-autofix/sort-imports-es6": "off",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
...configs.typescript,
|
|
51
|
+
rules: {
|
|
52
|
+
...configs.typescript.rules,
|
|
53
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
40
56
|
{
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
...configs.react,
|
|
58
|
+
rules: {
|
|
59
|
+
...configs.react.rules,
|
|
60
|
+
"jsx-a11y/label-has-associated-control": [
|
|
61
|
+
2,
|
|
62
|
+
{
|
|
63
|
+
controlComponents: ["TextField", "Checkbox"],
|
|
64
|
+
depth: 3,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
configs.test,
|
|
43
70
|
]
|
|
44
71
|
```
|
|
45
72
|
|
package/configs/base.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.FlatConfig } */
|
|
2
|
+
export const baseConfig = {
|
|
3
|
+
linterOptions: {
|
|
4
|
+
reportUnusedDisableDirectives: true,
|
|
5
|
+
},
|
|
6
|
+
ignores: [
|
|
7
|
+
"**/node_modules",
|
|
8
|
+
"**/public",
|
|
9
|
+
// Webpack
|
|
10
|
+
"webpack.config.cjs",
|
|
11
|
+
"webpack.config.js",
|
|
12
|
+
"**/build",
|
|
13
|
+
// Vite
|
|
14
|
+
"vite.config.ts",
|
|
15
|
+
"vitest.config.ts",
|
|
16
|
+
"**/dist",
|
|
17
|
+
// Next.js
|
|
18
|
+
"**/.next",
|
|
19
|
+
// Nuxt.js
|
|
20
|
+
"**/.nuxt",
|
|
21
|
+
// endpoints-sdk-cli
|
|
22
|
+
"**/endpoints",
|
|
23
|
+
// Storybook
|
|
24
|
+
"**/storybook-static",
|
|
25
|
+
],
|
|
26
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import pluginPrettier from "eslint-config-prettier";
|
|
4
|
+
import pluginSortImports from "eslint-plugin-sort-imports-es6-autofix";
|
|
5
|
+
import pluginUnusedImport from "eslint-plugin-unused-imports";
|
|
6
|
+
|
|
7
|
+
/** @type {import("eslint").Linter.FlatConfig } */
|
|
8
|
+
export const jsConfig = {
|
|
9
|
+
files: ["**/*.js", "**/*.mjs", "**/*.ts", "**/*.tsx"],
|
|
10
|
+
plugins: {
|
|
11
|
+
"sort-imports-es6-autofix": pluginSortImports,
|
|
12
|
+
"unused-imports": pluginUnusedImport,
|
|
13
|
+
},
|
|
14
|
+
languageOptions: {
|
|
15
|
+
ecmaVersion: "latest",
|
|
16
|
+
sourceType: "module",
|
|
17
|
+
globals: {
|
|
18
|
+
...globals.commonjs,
|
|
19
|
+
...globals.es2021,
|
|
20
|
+
...globals.node,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...js.configs.recommended.rules,
|
|
25
|
+
"no-console": ["error", { allow: ["error", "warn"] }],
|
|
26
|
+
eqeqeq: ["error", "always"],
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* eslint-plugin-sort-imports-es6-autofix
|
|
30
|
+
*/
|
|
31
|
+
"sort-imports-es6-autofix/sort-imports-es6": [
|
|
32
|
+
2,
|
|
33
|
+
{
|
|
34
|
+
ignoreCase: false,
|
|
35
|
+
ignoreMemberSort: false,
|
|
36
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
|
|
40
|
+
...pluginPrettier.rules,
|
|
41
|
+
|
|
42
|
+
"unused-imports/no-unused-imports": "error",
|
|
43
|
+
"unused-imports/no-unused-vars": [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
vars: "all",
|
|
47
|
+
varsIgnorePattern: "^_",
|
|
48
|
+
args: "after-used",
|
|
49
|
+
argsIgnorePattern: "^_",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
};
|
package/configs/react.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import pluginCssReorder from "eslint-plugin-css-reorder";
|
|
3
|
+
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
|
+
import pluginReact from "eslint-plugin-react";
|
|
5
|
+
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
6
|
+
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
|
7
|
+
|
|
8
|
+
/** @type {import("eslint").Linter.FlatConfig } */
|
|
9
|
+
export const reactConfig = {
|
|
10
|
+
files: ["**/*.tsx"],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: {
|
|
13
|
+
...globals.browser,
|
|
14
|
+
...globals.es2021,
|
|
15
|
+
React: true,
|
|
16
|
+
JSX: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
20
|
+
react: {
|
|
21
|
+
version: "detect",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
plugins: {
|
|
25
|
+
"jsx-a11y": pluginJsxA11y,
|
|
26
|
+
react: pluginReact,
|
|
27
|
+
"react-hooks": pluginReactHooks,
|
|
28
|
+
"react-refresh": pluginReactRefresh,
|
|
29
|
+
"css-reorder": pluginCssReorder,
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
"css-reorder/property-reorder": "error",
|
|
33
|
+
...pluginReact.configs.recommended.rules,
|
|
34
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
35
|
+
...pluginReact.configs["jsx-runtime"].rules,
|
|
36
|
+
...pluginJsxA11y.configs.recommended.rules,
|
|
37
|
+
|
|
38
|
+
"react/self-closing-comp": [
|
|
39
|
+
"error",
|
|
40
|
+
{
|
|
41
|
+
component: true,
|
|
42
|
+
html: true,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
"react/prop-types": "off",
|
|
46
|
+
"react/display-name": "off",
|
|
47
|
+
// For emotion and its css prop
|
|
48
|
+
"react/no-unknown-property": ["error", { ignore: ["css"] }],
|
|
49
|
+
"react-hooks/exhaustive-deps": "error",
|
|
50
|
+
|
|
51
|
+
"jsx-a11y/click-events-have-key-events": "off",
|
|
52
|
+
"jsx-a11y/no-autofocus": "off",
|
|
53
|
+
|
|
54
|
+
// 当社のサービスでは、ユーザーがアップロードした動画を表示することが主であり、
|
|
55
|
+
// 字幕を付加することはあまり想定されず、無意味なtrack要素の挿入を招くため無効化する
|
|
56
|
+
"jsx-a11y/media-has-caption": "off",
|
|
57
|
+
|
|
58
|
+
"jsx-a11y/label-has-associated-control": [
|
|
59
|
+
"error",
|
|
60
|
+
{
|
|
61
|
+
// デフォルトの2だと、そこそこラベルのテキストが検知できないケースがあるため。
|
|
62
|
+
depth: 7,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
"react-refresh/only-export-components": [
|
|
67
|
+
"warn",
|
|
68
|
+
{ allowConstantExport: true },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
};
|
package/configs/test.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
|
|
3
|
+
/** @type {import("eslint").Linter.FlatConfig } */
|
|
4
|
+
export const testConfig = {
|
|
5
|
+
files: ["**/*.test.ts", "**/*.test.tsx", "**/*.test.js", "**/*.test.jsx"],
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: {
|
|
8
|
+
...globals.jest,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import tseslint from "typescript-eslint";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NOTE: typescript-eslintは、推奨設定をルール単位で返しておらず、parserOptionsやpluginなどを設定を含んだconfigの配列のみを返している。
|
|
5
|
+
* これを以前のESLintにおけるextendsのような記述できるようにするために、tseslint.configという関数を提供しているが、
|
|
6
|
+
* 記述が自明な上に、現状シンプルなケースでは問題が既存の設定を取り込むとエラーが見られるため、ルールのみを抽出して返す関数を作成した。
|
|
7
|
+
*/
|
|
8
|
+
const getRulesFromConfigArray = (configs) => {
|
|
9
|
+
return configs.reduce((rules, config) => {
|
|
10
|
+
return { ...rules, ...config.rules };
|
|
11
|
+
}, {});
|
|
12
|
+
};
|
|
13
|
+
const tseslintRecommendedTypeChckedRules = getRulesFromConfigArray(
|
|
14
|
+
//@ts-expect-error
|
|
15
|
+
tseslint.configs.recommendedTypeChecked
|
|
16
|
+
);
|
|
17
|
+
const tseslintStylisticTypeCheckedRules = getRulesFromConfigArray(
|
|
18
|
+
//@ts-expect-error
|
|
19
|
+
tseslint.configs.stylisticTypeChecked
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/** @type {import("eslint").Linter.FlatConfig } */
|
|
23
|
+
export const tsConfig = {
|
|
24
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
25
|
+
plugins: {
|
|
26
|
+
"@typescript-eslint": tseslint.plugin,
|
|
27
|
+
},
|
|
28
|
+
languageOptions: {
|
|
29
|
+
parser: tseslint.parser,
|
|
30
|
+
parserOptions: {
|
|
31
|
+
project: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
...tseslintRecommendedTypeChckedRules,
|
|
36
|
+
...tseslintStylisticTypeCheckedRules,
|
|
37
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
38
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
39
|
+
|
|
40
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
41
|
+
|
|
42
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
43
|
+
|
|
44
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
45
|
+
|
|
46
|
+
"@typescript-eslint/strict-boolean-expressions": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
allowString: true,
|
|
50
|
+
allowNullableObject: true,
|
|
51
|
+
allowNullableBoolean: true,
|
|
52
|
+
allowNullableString: true,
|
|
53
|
+
allowAny: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
"@typescript-eslint/ban-types": [
|
|
57
|
+
"error",
|
|
58
|
+
{
|
|
59
|
+
types: {
|
|
60
|
+
"React.VFC": {
|
|
61
|
+
message: "Use React.FC instead.",
|
|
62
|
+
fixWith: "React.FC",
|
|
63
|
+
},
|
|
64
|
+
VFC: {
|
|
65
|
+
message: "Use React.FC instead.",
|
|
66
|
+
fixWith: "React.FC",
|
|
67
|
+
},
|
|
68
|
+
"React.FC": {
|
|
69
|
+
message:
|
|
70
|
+
"It is recommended to specify the type in props and specify JSX.Element in the return value.",
|
|
71
|
+
},
|
|
72
|
+
FC: {
|
|
73
|
+
message:
|
|
74
|
+
"It is recommended to specify the type in props and specify JSX.Element in the return value.",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Allow `() => Promise<void>` in JSX event handler.
|
|
82
|
+
* @see https://github.com/typescript-eslint/typescript-eslint/blob/f373fac1dd0150273d98cee5bed606bbd3f55e4b/packages/eslint-plugin/docs/rules/no-misused-promises.md#checksvoidreturn
|
|
83
|
+
*/
|
|
84
|
+
"@typescript-eslint/no-misused-promises": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
checksVoidReturn: {
|
|
88
|
+
attributes: false,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
};
|
package/index.js
CHANGED
|
@@ -1,257 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @see https://github.com/storybookjs/eslint-plugin-storybook/issues/135
|
|
16
|
-
*/
|
|
17
|
-
const compat = new FlatCompat();
|
|
18
|
-
const pluginStorybookRecommended = compat.extends(
|
|
19
|
-
"plugin:storybook/recommended"
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* NOTE: typescript-eslintは、推奨設定をルール単位で返しておらず、parserOptionsやpluginなどを設定を含んだconfigの配列のみを返している。
|
|
24
|
-
* これを以前のESLintにおけるextendsのような記述できるようにするために、tseslint.configという関数を提供しているが、
|
|
25
|
-
* 記述が自明な上に、現状シンプルなケースでは問題が既存の設定を取り込むとエラーが見られるため、ルールのみを抽出して返す関数を作成した。
|
|
26
|
-
*/
|
|
27
|
-
const getRulesFromConfigArray = (configs) => {
|
|
28
|
-
return configs.reduce((rules, config) => {
|
|
29
|
-
return { ...rules, ...config.rules };
|
|
30
|
-
}, {});
|
|
1
|
+
import { baseConfig } from "./configs/base.js";
|
|
2
|
+
import { jsConfig } from "./configs/javascript.js";
|
|
3
|
+
import { reactConfig } from "./configs/react.js";
|
|
4
|
+
import { testConfig } from "./configs/test.js";
|
|
5
|
+
import { tsConfig } from "./configs/typescript.js";
|
|
6
|
+
|
|
7
|
+
export const configs = {
|
|
8
|
+
base: baseConfig,
|
|
9
|
+
javascript: jsConfig,
|
|
10
|
+
typescript: tsConfig,
|
|
11
|
+
react: reactConfig,
|
|
12
|
+
test: testConfig,
|
|
31
13
|
};
|
|
32
|
-
const tseslintRecommendedTypeChckedRules = getRulesFromConfigArray(
|
|
33
|
-
tseslint.configs.recommendedTypeChecked
|
|
34
|
-
);
|
|
35
|
-
const tseslintStylisticTypeCheckedRules = getRulesFromConfigArray(
|
|
36
|
-
tseslint.configs.stylisticTypeChecked
|
|
37
|
-
);
|
|
38
14
|
|
|
39
15
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
40
|
-
const config = [
|
|
41
|
-
{
|
|
42
|
-
linterOptions: {
|
|
43
|
-
reportUnusedDisableDirectives: true,
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* NOTE: pluginsをfilesと紐付けると、利用側でのルール変更が困難になる。
|
|
47
|
-
*
|
|
48
|
-
* Pluginをfilesを指定したconfigで読み込むとfilesと紐づいてしまうため、
|
|
49
|
-
* eslint-config-matsuriを利用する側でルールを上書きしようとした際に、filesまたはpluginの再指定が必要になってしまう。
|
|
50
|
-
* また、pluginがlanguageOptionsなどに依存している場合、その指定も必要になる。
|
|
51
|
-
* さらには、eslint側のアップデートで、同じpluginを再指定するとエラーが出るようになった。
|
|
52
|
-
* このため、pluginをfiles指定なしで、まとめて読み込んでおく。
|
|
53
|
-
*/
|
|
54
|
-
plugins: {
|
|
55
|
-
"sort-imports-es6-autofix": pluginSortImports,
|
|
56
|
-
"@typescript-eslint": tseslint.plugin,
|
|
57
|
-
"unused-imports": pluginUnusedImport,
|
|
58
|
-
"css-reorder": pluginCssReorder,
|
|
59
|
-
"jsx-a11y": pluginJsxA11y,
|
|
60
|
-
react: pluginReact,
|
|
61
|
-
"react-hooks": pluginReactHooks,
|
|
62
|
-
"react-refresh": pluginReactRefresh,
|
|
63
|
-
},
|
|
64
|
-
ignores: [
|
|
65
|
-
"**/node_modules",
|
|
66
|
-
"**/public",
|
|
67
|
-
// Webpack
|
|
68
|
-
"webpack.config.cjs",
|
|
69
|
-
"webpack.config.js",
|
|
70
|
-
"**/build",
|
|
71
|
-
// Vite
|
|
72
|
-
"vite.config.ts",
|
|
73
|
-
"vitest.config.ts",
|
|
74
|
-
"**/dist",
|
|
75
|
-
// Next.js
|
|
76
|
-
"**/.next",
|
|
77
|
-
// Nuxt.js
|
|
78
|
-
"**/.nuxt",
|
|
79
|
-
// endpoints-sdk-cli
|
|
80
|
-
"**/endpoints",
|
|
81
|
-
// Storybook
|
|
82
|
-
"**/storybook-static",
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
files: ["**/*.js"],
|
|
87
|
-
languageOptions: {
|
|
88
|
-
ecmaVersion: "latest",
|
|
89
|
-
sourceType: "module",
|
|
90
|
-
globals: {
|
|
91
|
-
...globals.commonjs,
|
|
92
|
-
...globals.es2021,
|
|
93
|
-
...globals.node,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
rules: {
|
|
97
|
-
...js.configs.recommended.rules,
|
|
98
|
-
"no-console": ["error", { allow: ["error", "warn"] }],
|
|
99
|
-
eqeqeq: ["error", "always"],
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* eslint-plugin-sort-imports-es6-autofix
|
|
103
|
-
*/
|
|
104
|
-
"sort-imports-es6-autofix/sort-imports-es6": [
|
|
105
|
-
2,
|
|
106
|
-
{
|
|
107
|
-
ignoreCase: false,
|
|
108
|
-
ignoreMemberSort: false,
|
|
109
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
116
|
-
languageOptions: {
|
|
117
|
-
globals: {
|
|
118
|
-
...globals.browser,
|
|
119
|
-
...globals.es2021,
|
|
120
|
-
React: true,
|
|
121
|
-
JSX: true,
|
|
122
|
-
},
|
|
123
|
-
parser: tseslint.parser,
|
|
124
|
-
parserOptions: {
|
|
125
|
-
project: true,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
settings: {
|
|
129
|
-
react: {
|
|
130
|
-
version: "detect",
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
rules: {
|
|
134
|
-
...tseslintRecommendedTypeChckedRules,
|
|
135
|
-
...tseslintStylisticTypeCheckedRules,
|
|
136
|
-
...pluginReact.configs.recommended.rules,
|
|
137
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
138
|
-
...pluginReact.configs["jsx-runtime"].rules,
|
|
139
|
-
...pluginJsxA11y.configs.recommended.rules,
|
|
140
|
-
...pluginPrettier.rules,
|
|
141
|
-
"css-reorder/property-reorder": "error",
|
|
142
|
-
|
|
143
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
144
|
-
|
|
145
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
146
|
-
|
|
147
|
-
"@typescript-eslint/no-non-null-assertion": "error",
|
|
148
|
-
|
|
149
|
-
"@typescript-eslint/consistent-type-exports": "error",
|
|
150
|
-
|
|
151
|
-
"@typescript-eslint/strict-boolean-expressions": [
|
|
152
|
-
"error",
|
|
153
|
-
{
|
|
154
|
-
allowString: true,
|
|
155
|
-
allowNullableObject: true,
|
|
156
|
-
allowNullableBoolean: true,
|
|
157
|
-
allowNullableString: true,
|
|
158
|
-
allowAny: true,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
"@typescript-eslint/ban-types": [
|
|
162
|
-
"error",
|
|
163
|
-
{
|
|
164
|
-
types: {
|
|
165
|
-
"React.VFC": {
|
|
166
|
-
message: "Use React.FC instead.",
|
|
167
|
-
fixWith: "React.FC",
|
|
168
|
-
},
|
|
169
|
-
VFC: {
|
|
170
|
-
message: "Use React.FC instead.",
|
|
171
|
-
fixWith: "React.FC",
|
|
172
|
-
},
|
|
173
|
-
"React.FC": {
|
|
174
|
-
message:
|
|
175
|
-
"It is recommended to specify the type in props and specify JSX.Element in the return value.",
|
|
176
|
-
},
|
|
177
|
-
FC: {
|
|
178
|
-
message:
|
|
179
|
-
"It is recommended to specify the type in props and specify JSX.Element in the return value.",
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Allow `() => Promise<void>` in JSX event handler.
|
|
187
|
-
* @see https://github.com/typescript-eslint/typescript-eslint/blob/f373fac1dd0150273d98cee5bed606bbd3f55e4b/packages/eslint-plugin/docs/rules/no-misused-promises.md#checksvoidreturn
|
|
188
|
-
*/
|
|
189
|
-
"@typescript-eslint/no-misused-promises": [
|
|
190
|
-
"error",
|
|
191
|
-
{
|
|
192
|
-
checksVoidReturn: {
|
|
193
|
-
attributes: false,
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
|
|
198
|
-
"react/self-closing-comp": [
|
|
199
|
-
"error",
|
|
200
|
-
{
|
|
201
|
-
component: true,
|
|
202
|
-
html: true,
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
"react/prop-types": "off",
|
|
206
|
-
"react/display-name": "off",
|
|
207
|
-
// For emotion and its css prop
|
|
208
|
-
"react/no-unknown-property": ["error", { ignore: ["css"] }],
|
|
209
|
-
"react-hooks/exhaustive-deps": "error",
|
|
210
|
-
|
|
211
|
-
"jsx-a11y/click-events-have-key-events": "off",
|
|
212
|
-
"jsx-a11y/no-autofocus": "off",
|
|
213
|
-
|
|
214
|
-
// 当社のサービスでは、ユーザーがアップロードした動画を表示することが主であり、
|
|
215
|
-
// 字幕を付加することはあまり想定されず、無意味なtrack要素の挿入を招くため無効化する
|
|
216
|
-
"jsx-a11y/media-has-caption": "off",
|
|
217
|
-
|
|
218
|
-
"jsx-a11y/label-has-associated-control": [
|
|
219
|
-
"error",
|
|
220
|
-
{
|
|
221
|
-
// デフォルトの2だと、そこそこラベルのテキストが検知できないケースがあるため。
|
|
222
|
-
depth: 7,
|
|
223
|
-
},
|
|
224
|
-
],
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* settings for unused-imports
|
|
228
|
-
*/
|
|
229
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
230
|
-
"unused-imports/no-unused-imports": "error",
|
|
231
|
-
"unused-imports/no-unused-vars": [
|
|
232
|
-
"error",
|
|
233
|
-
{
|
|
234
|
-
vars: "all",
|
|
235
|
-
varsIgnorePattern: "^_",
|
|
236
|
-
args: "after-used",
|
|
237
|
-
argsIgnorePattern: "^_",
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
"react-refresh/only-export-components": [
|
|
241
|
-
"warn",
|
|
242
|
-
{ allowConstantExport: true },
|
|
243
|
-
],
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
files: ["**/*.test.ts", "**/*.test.tsx", "**/*.test.js", "**/*.test.jsx"],
|
|
248
|
-
languageOptions: {
|
|
249
|
-
globals: {
|
|
250
|
-
...globals.jest,
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
...pluginStorybookRecommended,
|
|
255
|
-
];
|
|
16
|
+
const config = [baseConfig, jsConfig, tsConfig, reactConfig, testConfig];
|
|
256
17
|
|
|
257
18
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-matsuri",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"index.js",
|
|
13
|
-
"index.d.ts"
|
|
13
|
+
"index.d.ts",
|
|
14
|
+
"configs"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"test": "eslint . --max-warnings 0"
|
|
@@ -32,7 +33,6 @@
|
|
|
32
33
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
33
34
|
"eslint-plugin-react-refresh": "0.4.5",
|
|
34
35
|
"eslint-plugin-sort-imports-es6-autofix": "0.6.0",
|
|
35
|
-
"eslint-plugin-storybook": "0.8.0",
|
|
36
36
|
"eslint-plugin-unused-imports": "3.1.0",
|
|
37
37
|
"globals": "14.0.0",
|
|
38
38
|
"typescript-eslint": "7.1.1"
|