Skip to content

Commit 3ce8e6f

Browse files
authored
Merge pull request #353 from nekochans/feature/issue347/change-eslint-packages
ESLintの設定を @antfu/eslint-config を使った形に変更
2 parents 2415530 + 2128289 commit 3ce8e6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3267
-2059
lines changed

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
node-version: 20
1919
registry-url: 'https://npm.pkg.github.com'
20-
cache: 'npm'
20+
cache: npm
2121
scope: '@nekochans'
2222
- run: npm ci --legacy-peer-deps
2323
env:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
23-
cache: 'npm'
23+
cache: npm
2424
registry-url: 'https://npm.pkg.github.com'
2525
scope: '@nekochans'
2626
- run: |

.prettierignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.storybook/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import '../src/app/globals.css';
2-
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
31
import type { Preview } from '@storybook/react';
2+
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
43
import { initialize, mswLoader } from 'msw-storybook-addon';
4+
import '../src/app/globals.css';
55

66
initialize();
77

eslint.config.mjs

Lines changed: 30 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,50 @@
1-
import path from 'node:path';
2-
import { fileURLToPath } from 'node:url';
3-
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
4-
import { FlatCompat } from '@eslint/eslintrc';
5-
import js from '@eslint/js';
6-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
7-
import jsxA11Y from 'eslint-plugin-jsx-a11y';
8-
import react from 'eslint-plugin-react';
9-
import reactHooks from 'eslint-plugin-react-hooks';
10-
import storybook from 'eslint-plugin-storybook';
11-
import vitest from 'eslint-plugin-vitest';
12-
import globals from 'globals';
1+
import antfu from '@antfu/eslint-config';
2+
import tailwindcss from 'eslint-plugin-tailwindcss';
133

14-
const __filename = fileURLToPath(import.meta.url);
15-
const __dirname = path.dirname(__filename);
16-
const compat = new FlatCompat({
17-
baseDirectory: __dirname,
18-
recommendedConfig: js.configs.recommended,
19-
allConfig: js.configs.all,
20-
});
21-
22-
export default [
4+
export default antfu(
235
{
6+
react: true,
7+
formatters: {
8+
css: true,
9+
html: true,
10+
markdown: 'prettier',
11+
},
12+
stylistic: {
13+
semi: true,
14+
overrides: {
15+
'semi': ['error', 'always'],
16+
'semi-spacing': ['error', { after: true, before: false }],
17+
'semi-style': ['error', 'last'],
18+
'no-extra-semi': 'error',
19+
'no-unexpected-multiline': 'error',
20+
'no-unreachable': 'error',
21+
},
22+
},
23+
typescript: {
24+
overrides: {
25+
'ts/consistent-type-definitions': ['error', 'type'],
26+
},
27+
},
2428
ignores: [
2529
'**/node_modules/',
2630
'**/.next/',
2731
'**/build/',
2832
'**/coverage/',
2933
'**/.eslintrc.json',
3034
'**/next-env.d.ts',
31-
'test/setupTests.ts',
3235
'**/*.config.js',
33-
'**/*.config.mjs',
34-
'**/__mocks__',
3536
'**/storybook-static/',
3637
'public/mockServiceWorker.js',
37-
'**/*.module.css.d.ts',
38-
'**/*.module.css.d.ts.map',
3938
'**/vitest.config.mts',
4039
'**/vitest.setup.mts',
40+
'next.config.mjs',
41+
'tsconfig.json',
4142
],
4243
},
43-
...fixupConfigRules(
44-
compat.extends(
45-
'eslint:recommended',
46-
'plugin:@typescript-eslint/recommended',
47-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
48-
'standard-with-typescript',
49-
'plugin:jsx-a11y/recommended',
50-
'plugin:react/recommended',
51-
'plugin:react/jsx-runtime',
52-
'plugin:react-hooks/recommended',
53-
'plugin:tailwindcss/recommended',
54-
'prettier',
55-
),
56-
),
57-
{
58-
plugins: {
59-
'@typescript-eslint': fixupPluginRules(typescriptEslint),
60-
'jsx-a11y': fixupPluginRules(jsxA11Y),
61-
react: fixupPluginRules(react),
62-
'react-hooks': fixupPluginRules(reactHooks),
63-
storybook,
64-
vitest,
65-
},
66-
67-
languageOptions: {
68-
globals: {
69-
...globals.browser,
70-
...globals.node,
71-
},
72-
73-
ecmaVersion: 'latest',
74-
sourceType: 'module',
75-
76-
parserOptions: {
77-
tsconfigRootDir: '.',
78-
project: ['./tsconfig.json', './tsconfig.storybook.json'],
79-
},
80-
},
81-
82-
settings: {
83-
react: {
84-
version: 'detect',
85-
},
86-
},
87-
88-
rules: {
89-
'padding-line-between-statements': [
90-
'error',
91-
{
92-
blankLine: 'always',
93-
prev: '*',
94-
next: 'return',
95-
},
96-
],
97-
98-
'@typescript-eslint/consistent-type-definitions': 'off',
99-
'@typescript-eslint/explicit-function-return-type': 'off',
100-
'@typescript-eslint/explicit-module-boundary-types': ['error'],
101-
102-
'@typescript-eslint/no-misused-promises': [
103-
'error',
104-
{
105-
checksVoidReturn: false,
106-
},
107-
],
108-
109-
'@typescript-eslint/no-unused-vars': [
110-
'error',
111-
{
112-
argsIgnorePattern: '^_',
113-
varsIgnorePattern: '^_',
114-
},
115-
],
116-
117-
'@typescript-eslint/strict-boolean-expressions': [
118-
'error',
119-
{
120-
allowNullableObject: true,
121-
},
122-
],
123-
124-
'@typescript-eslint/triple-slash-reference': [
125-
'error',
126-
{
127-
types: 'always',
128-
},
129-
],
130-
131-
'import/extensions': [
132-
'error',
133-
{
134-
ignorePackages: true,
135-
136-
pattern: {
137-
js: 'never',
138-
jsx: 'never',
139-
ts: 'never',
140-
tsx: 'never',
141-
},
142-
},
143-
],
144-
145-
'react/display-name': 'off',
146-
'tailwindcss/classnames-order': 'error',
147-
},
148-
},
14944
{
150-
files: ['**/*.tsx'],
151-
15245
rules: {
153-
'react/prop-types': 'off',
46+
'node/prefer-global/process': 'off',
15447
},
15548
},
156-
];
49+
...tailwindcss.configs['flat/recommended'],
50+
);

0 commit comments

Comments
 (0)