eslint-config-matsuri 2.1.1-alpha-bd9aeba.0 → 3.1.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 CHANGED
@@ -18,20 +18,38 @@ ESLintを除く依存関係を別途インストールする必要はありま
18
18
  yarn add eslint eslint-config-matsuri
19
19
  ```
20
20
 
21
- 設定ファイルは次の記述のみで良くなります。他の記述は削除してください。
21
+ ## Usage
22
+
23
+ Flat configをv3からサポートしています。eslint.config.jsに次のように記述します。
24
+
25
+ ```js
26
+ import config from "eslint-config-matsuri";
27
+
28
+ export default config
29
+ ```
30
+
31
+ 拡張する場合は、次のようにしてください。
22
32
 
23
33
  ```js
24
- /** @type {import('eslint').Linter.BaseConfig} */
25
- const config = {
26
- extends: ["matsuri"],
27
- parserOptions: {
28
- project: true,
29
- tsconfigRootDir: __dirname,
34
+ import config from "eslint-config-matsuri";
35
+
36
+ export default [
37
+ ...config,
38
+ {
39
+ // ここに追加の設定を記述する
30
40
  }
31
- };
32
- module.exports = config;
41
+ ]
33
42
  ```
34
43
 
44
+ VSCodeでFlag configを利用する場合は、`.vscode/settings.json`に次の設定を追加する必要があります。
45
+
46
+ ```json
47
+ {
48
+ "eslint.experimental.useFlatConfig": true
49
+ }
50
+ ```
51
+
52
+
35
53
  ## Contributing
36
54
 
37
55
  ルールの検証などを行いたい場合は、tests以下にファイルを配置してください。
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Linter } from "eslint";
2
+
3
+ declare const config: Linter.FlatConfig[];
4
+
5
+ export default config;
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { FlatCompat } from "@eslint/eslintrc";
1
2
  import globals from "globals";
2
3
  import js from "@eslint/js";
3
4
  import pluginCssReorder from "eslint-plugin-css-reorder";
@@ -5,19 +6,47 @@ import pluginJsxA11y from "eslint-plugin-jsx-a11y";
5
6
  import pluginPrettier from "eslint-config-prettier";
6
7
  import pluginReact from "eslint-plugin-react";
7
8
  import pluginReactHooks from "eslint-plugin-react-hooks";
9
+ import pluginReactRefresh from "eslint-plugin-react-refresh";
8
10
  import pluginSortImports from "eslint-plugin-sort-imports-es6-autofix";
9
11
  import pluginUnusedImport from "eslint-plugin-unused-imports";
10
12
  import ts from "@typescript-eslint/eslint-plugin";
11
13
  import tsParser from "@typescript-eslint/parser";
12
14
 
15
+ /**
16
+ * @see https://github.com/storybookjs/eslint-plugin-storybook/issues/135
17
+ */
18
+ const compat = new FlatCompat();
19
+ const pluginStorybookRecommended = compat.extends(
20
+ "plugin:storybook/recommended"
21
+ );
22
+
13
23
  /** @type { import("eslint").Linter.FlatConfig[] } */
14
24
  const config = [
25
+ {
26
+ ignores: [
27
+ "**/node_modules",
28
+ "**/public",
29
+ // Webpack
30
+ "**/build",
31
+ // Vite
32
+ "**/dist",
33
+ // Next.js
34
+ "**/.next",
35
+ // Nuxt.js
36
+ "**/.nuxt",
37
+ // endpoints-sdk-cli
38
+ "**/endpoints",
39
+ // Storybook
40
+ "**/storybook-static",
41
+ ],
42
+ },
15
43
  {
16
44
  linterOptions: {
17
45
  reportUnusedDisableDirectives: true,
18
46
  },
19
47
  languageOptions: {
20
- ecmaVersion: 12,
48
+ ecmaVersion: "latest",
49
+ sourceType: "module",
21
50
  globals: {
22
51
  ...globals.commonjs,
23
52
  ...globals.es2021,
@@ -29,7 +58,7 @@ const config = [
29
58
  },
30
59
  rules: {
31
60
  ...js.configs.recommended.rules,
32
- "no-console": ["error", { allow: ["error"] }],
61
+ "no-console": ["error", { allow: ["error", "warn"] }],
33
62
  eqeqeq: ["error", "always"],
34
63
 
35
64
  /**
@@ -70,6 +99,7 @@ const config = [
70
99
  "jsx-a11y": pluginJsxA11y,
71
100
  react: pluginReact,
72
101
  "react-hooks": pluginReactHooks,
102
+ "react-refresh": pluginReactRefresh,
73
103
  },
74
104
  rules: {
75
105
  ...pluginReact.configs.recommended.rules,
@@ -162,8 +192,13 @@ const config = [
162
192
  argsIgnorePattern: "^_",
163
193
  },
164
194
  ],
195
+ "react-refresh/only-export-components": [
196
+ "warn",
197
+ { allowConstantExport: true },
198
+ ],
165
199
  },
166
200
  },
201
+ ...pluginStorybookRecommended,
167
202
  ];
168
203
 
169
204
  export default config;
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "eslint-config-matsuri",
3
- "version": "2.1.1-alpha-bd9aeba.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
7
+ "types": "index.d.ts",
7
8
  "files": [
8
- "index.js"
9
+ "index.js",
10
+ "index.d.ts"
9
11
  ],
10
12
  "scripts": {
11
13
  "test": "eslint . --max-warnings 0"
@@ -16,7 +18,7 @@
16
18
  "registry": "https://registry.npmjs.org/"
17
19
  },
18
20
  "peerDependencies": {
19
- "eslint": "8.43.0"
21
+ "eslint": "^8.43.0"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@emotion/react": "11.11.1",
@@ -34,7 +36,9 @@
34
36
  "eslint-plugin-jsx-a11y": "6.7.1",
35
37
  "eslint-plugin-react": "7.33.1",
36
38
  "eslint-plugin-react-hooks": "4.6.0",
39
+ "eslint-plugin-react-refresh": "0.4.4",
37
40
  "eslint-plugin-sort-imports-es6-autofix": "0.6.0",
41
+ "eslint-plugin-storybook": "0.6.15",
38
42
  "eslint-plugin-unused-imports": "2.0.0"
39
43
  }
40
44
  }