eslint-config-matsuri 2.0.0 → 2.1.1-alpha-bd9aeba.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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/index.js +147 -128
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -24,8 +24,11 @@ yarn add eslint eslint-config-matsuri
24
24
  /** @type {import('eslint').Linter.BaseConfig} */
25
25
  const config = {
26
26
  extends: ["matsuri"],
27
+ parserOptions: {
28
+ project: true,
29
+ tsconfigRootDir: __dirname,
30
+ }
27
31
  };
28
-
29
32
  module.exports = config;
30
33
  ```
31
34
 
package/index.js CHANGED
@@ -1,150 +1,169 @@
1
- /** @type {import('eslint').Linter.BaseConfig} */
2
- const config = {
3
- reportUnusedDisableDirectives: true,
4
- root: true,
5
- env: {
6
- commonjs: true,
7
- es2021: true,
8
- node: true,
9
- },
10
- parserOptions: {
11
- ecmaVersion: 12,
12
- },
13
- extends: ["eslint:recommended"],
14
- plugins: ["sort-imports-es6-autofix"],
15
- rules: {
16
- "no-console": ["error", { allow: ["error"] }],
17
- eqeqeq: ["error", "always"],
1
+ import globals from "globals";
2
+ import js from "@eslint/js";
3
+ import pluginCssReorder from "eslint-plugin-css-reorder";
4
+ import pluginJsxA11y from "eslint-plugin-jsx-a11y";
5
+ import pluginPrettier from "eslint-config-prettier";
6
+ import pluginReact from "eslint-plugin-react";
7
+ import pluginReactHooks from "eslint-plugin-react-hooks";
8
+ import pluginSortImports from "eslint-plugin-sort-imports-es6-autofix";
9
+ import pluginUnusedImport from "eslint-plugin-unused-imports";
10
+ import ts from "@typescript-eslint/eslint-plugin";
11
+ import tsParser from "@typescript-eslint/parser";
18
12
 
19
- /**
20
- * eslint-plugin-sort-imports-es6-autofix
21
- */
22
- "sort-imports-es6-autofix/sort-imports-es6": [
23
- 2,
24
- {
25
- ignoreCase: false,
26
- ignoreMemberSort: false,
27
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
13
+ /** @type { import("eslint").Linter.FlatConfig[] } */
14
+ const config = [
15
+ {
16
+ linterOptions: {
17
+ reportUnusedDisableDirectives: true,
18
+ },
19
+ languageOptions: {
20
+ ecmaVersion: 12,
21
+ globals: {
22
+ ...globals.commonjs,
23
+ ...globals.es2021,
24
+ ...globals.node,
28
25
  },
29
- ],
26
+ },
27
+ plugins: {
28
+ "sort-imports-es6-autofix": pluginSortImports,
29
+ },
30
+ rules: {
31
+ ...js.configs.recommended.rules,
32
+ "no-console": ["error", { allow: ["error"] }],
33
+ eqeqeq: ["error", "always"],
34
+
35
+ /**
36
+ * eslint-plugin-sort-imports-es6-autofix
37
+ */
38
+ "sort-imports-es6-autofix/sort-imports-es6": [
39
+ 2,
40
+ {
41
+ ignoreCase: false,
42
+ ignoreMemberSort: false,
43
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
44
+ },
45
+ ],
46
+ },
30
47
  },
31
- overrides: [
32
- {
33
- files: ["**/*.ts", "**/*.tsx"],
34
- env: {
35
- browser: true,
36
- es2021: true,
48
+ {
49
+ files: ["**/*.ts", "**/*.tsx"],
50
+ languageOptions: {
51
+ globals: {
52
+ ...globals.browser,
53
+ ...globals.es2021,
54
+ React: true,
37
55
  },
38
- plugins: [
39
- "css-reorder",
40
- "jsx-a11y",
41
- "unused-imports",
42
- "@typescript-eslint",
43
- ],
44
- extends: [
45
- "plugin:react/recommended",
46
- "plugin:react-hooks/recommended",
47
- "plugin:react/jsx-runtime",
48
- "plugin:@typescript-eslint/recommended-type-checked",
49
- "plugin:@typescript-eslint/stylistic-type-checked",
50
- "plugin:jsx-a11y/recommended",
51
- "prettier",
52
- ],
53
- parser: "@typescript-eslint/parser",
56
+ parser: tsParser,
54
57
  parserOptions: {
55
58
  project: true,
56
- tsconfigRootDir: __dirname,
57
59
  },
58
- settings: {
59
- react: {
60
- version: "detect",
61
- },
60
+ },
61
+ settings: {
62
+ react: {
63
+ version: "detect",
62
64
  },
63
- rules: {
64
- "css-reorder/property-reorder": "error",
65
+ },
66
+ plugins: {
67
+ "@typescript-eslint": ts,
68
+ "unused-imports": pluginUnusedImport,
69
+ "css-reorder": pluginCssReorder,
70
+ "jsx-a11y": pluginJsxA11y,
71
+ react: pluginReact,
72
+ "react-hooks": pluginReactHooks,
73
+ },
74
+ rules: {
75
+ ...pluginReact.configs.recommended.rules,
76
+ ...pluginReactHooks.configs.recommended.rules,
77
+ ...pluginReact.configs["jsx-runtime"].rules,
78
+ ...ts.configs["recommended-type-checked"].rules,
79
+ ...ts.configs["stylistic-type-checked"].rules,
80
+ ...pluginJsxA11y.configs.recommended.rules,
81
+ ...pluginPrettier.rules,
82
+ "css-reorder/property-reorder": "error",
65
83
 
66
- "@typescript-eslint/explicit-module-boundary-types": "off",
84
+ "@typescript-eslint/explicit-module-boundary-types": "off",
67
85
 
68
- "@typescript-eslint/no-empty-interface": "off",
86
+ "@typescript-eslint/no-empty-interface": "off",
69
87
 
70
- "@typescript-eslint/consistent-type-exports": "error",
88
+ "@typescript-eslint/no-non-null-assertion": "error",
71
89
 
72
- "@typescript-eslint/strict-boolean-expressions": [
73
- "error",
74
- {
75
- allowString: true,
76
- allowNullableObject: true,
77
- allowNullableBoolean: true,
78
- allowNullableString: true,
79
- allowAny: true,
80
- },
81
- ],
82
- "@typescript-eslint/ban-types": [
83
- "error",
84
- {
85
- types: {
86
- "React.VFC": {
87
- message: "Use React.FC instead.",
88
- fixWith: "React.FC",
89
- },
90
- VFC: {
91
- message: "Use React.FC instead.",
92
- fixWith: "React.FC",
93
- },
94
- },
95
- },
96
- ],
90
+ "@typescript-eslint/consistent-type-exports": "error",
97
91
 
98
- /**
99
- * Allow `() => Promise<void>` in JSX event handler.
100
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/f373fac1dd0150273d98cee5bed606bbd3f55e4b/packages/eslint-plugin/docs/rules/no-misused-promises.md#checksvoidreturn
101
- */
102
- "@typescript-eslint/no-misused-promises": [
103
- "error",
104
- {
105
- checksVoidReturn: {
106
- attributes: false,
92
+ "@typescript-eslint/strict-boolean-expressions": [
93
+ "error",
94
+ {
95
+ allowString: true,
96
+ allowNullableObject: true,
97
+ allowNullableBoolean: true,
98
+ allowNullableString: true,
99
+ allowAny: true,
100
+ },
101
+ ],
102
+ "@typescript-eslint/ban-types": [
103
+ "error",
104
+ {
105
+ types: {
106
+ "React.VFC": {
107
+ message: "Use React.FC instead.",
108
+ fixWith: "React.FC",
109
+ },
110
+ VFC: {
111
+ message: "Use React.FC instead.",
112
+ fixWith: "React.FC",
107
113
  },
108
114
  },
109
- ],
115
+ },
116
+ ],
110
117
 
111
- "react/self-closing-comp": [
112
- "error",
113
- {
114
- component: true,
115
- html: true,
118
+ /**
119
+ * Allow `() => Promise<void>` in JSX event handler.
120
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/f373fac1dd0150273d98cee5bed606bbd3f55e4b/packages/eslint-plugin/docs/rules/no-misused-promises.md#checksvoidreturn
121
+ */
122
+ "@typescript-eslint/no-misused-promises": [
123
+ "error",
124
+ {
125
+ checksVoidReturn: {
126
+ attributes: false,
116
127
  },
117
- ],
118
- "react/prop-types": "off",
119
- "react/display-name": "off",
120
- // For emotion and its css prop
121
- "react/no-unknown-property": ["error", { ignore: ["css"] }],
122
- "react-hooks/exhaustive-deps": "error",
128
+ },
129
+ ],
123
130
 
124
- "jsx-a11y/click-events-have-key-events": "off",
125
- "jsx-a11y/no-autofocus": "off",
131
+ "react/self-closing-comp": [
132
+ "error",
133
+ {
134
+ component: true,
135
+ html: true,
136
+ },
137
+ ],
138
+ "react/prop-types": "off",
139
+ "react/display-name": "off",
140
+ // For emotion and its css prop
141
+ "react/no-unknown-property": ["error", { ignore: ["css"] }],
142
+ "react-hooks/exhaustive-deps": "error",
126
143
 
127
- // 当社のサービスでは、ユーザーがアップロードした動画を表示することが主であり、
128
- // 字幕を付加することはあまり想定されず、無意味なtrack要素の挿入を招くため無効化する
129
- "jsx-a11y/media-has-caption": "off",
144
+ "jsx-a11y/click-events-have-key-events": "off",
145
+ "jsx-a11y/no-autofocus": "off",
130
146
 
131
- /**
132
- * settings for unused-imports
133
- */
134
- "@typescript-eslint/no-unused-vars": "off",
135
- "unused-imports/no-unused-imports": "error",
136
- "unused-imports/no-unused-vars": [
137
- "error",
138
- {
139
- vars: "all",
140
- varsIgnorePattern: "^_",
141
- args: "after-used",
142
- argsIgnorePattern: "^_",
143
- },
144
- ],
145
- },
147
+ // 当社のサービスでは、ユーザーがアップロードした動画を表示することが主であり、
148
+ // 字幕を付加することはあまり想定されず、無意味なtrack要素の挿入を招くため無効化する
149
+ "jsx-a11y/media-has-caption": "off",
150
+
151
+ /**
152
+ * settings for unused-imports
153
+ */
154
+ "@typescript-eslint/no-unused-vars": "off",
155
+ "unused-imports/no-unused-imports": "error",
156
+ "unused-imports/no-unused-vars": [
157
+ "error",
158
+ {
159
+ vars: "all",
160
+ varsIgnorePattern: "^_",
161
+ args: "after-used",
162
+ argsIgnorePattern: "^_",
163
+ },
164
+ ],
146
165
  },
147
- ],
148
- };
166
+ },
167
+ ];
149
168
 
150
- module.exports = config;
169
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "eslint-config-matsuri",
3
- "version": "2.0.0",
3
+ "version": "2.1.1-alpha-bd9aeba.0",
4
+ "type": "module",
4
5
  "description": "",
5
6
  "main": "index.js",
6
7
  "files": [
@@ -25,6 +26,7 @@
25
26
  "typescript": "5.1.6"
26
27
  },
27
28
  "dependencies": {
29
+ "@eslint/js": "8.53.0",
28
30
  "@typescript-eslint/eslint-plugin": "6.2.1",
29
31
  "@typescript-eslint/parser": "6.2.1",
30
32
  "eslint-config-prettier": "8.8.0",