Skip to content

Commit 30be6b0

Browse files
refactor(Lint): Centralize lint files
1 parent 74a139f commit 30be6b0

File tree

11 files changed

+84
-77
lines changed

11 files changed

+84
-77
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ trim_trailing_whitespace = true
2929
# UTF-8 encoding
3030
charset = utf-8
3131

32-
# Use spaces for all indents with a width of 4 characters.
32+
# Use spaces for all indents with a width of 2 characters.
3333
indent_style = space
3434
indent_size = 2
3535

.github/linters/.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage/
2+
dist/
3+
storybook-static/
4+
tokens/
5+
CHANGELOG.md
File renamed without changes.

.github/linters/eslint.config.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
2+
import { FlatCompat } from '@eslint/eslintrc';
3+
import js from '@eslint/js';
4+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
5+
import tsParser from '@typescript-eslint/parser';
6+
import { defineConfig, globalIgnores } from 'eslint/config';
7+
import globals from 'globals';
8+
import path from 'node:path';
9+
import { fileURLToPath } from 'node:url';
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all,
17+
});
18+
19+
export default defineConfig(
20+
[globalIgnores(['storybook-static/', 'dist/', 'coverage/'])],
21+
[
22+
{
23+
extends: fixupConfigRules(
24+
compat.extends(
25+
'eslint:recommended',
26+
'plugin:react/recommended',
27+
'plugin:@typescript-eslint/recommended',
28+
'plugin:@typescript-eslint/eslint-recommended',
29+
'prettier',
30+
'plugin:prettier/recommended',
31+
'plugin:react-hooks/recommended',
32+
'plugin:storybook/recommended',
33+
),
34+
),
35+
36+
settings: {
37+
react: {
38+
version: 'detect',
39+
},
40+
},
41+
42+
plugins: {
43+
'@typescript-eslint': fixupPluginRules(typescriptEslint),
44+
},
45+
46+
languageOptions: {
47+
globals: {
48+
...globals.jest,
49+
...globals.browser,
50+
},
51+
52+
parser: tsParser,
53+
},
54+
55+
ignores: [
56+
'eslint.config.mjs',
57+
'vitest.config.js',
58+
'**/vendor/*.js',
59+
'CHANGELOG.md',
60+
],
61+
62+
rules: {
63+
'react/react-in-jsx-scope': 'off',
64+
'react/prop-types': 'off',
65+
},
66+
},
67+
],
68+
);

.github/workflows/commitlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
2828
- name: Validate PR commits with commitlint
2929
if: github.event_name == 'pull_request'
30-
run: npx commitlint -g .commitlintrc.ts --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
30+
run: npx commitlint -g .github/linters/.commitlintrc.ts --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.husky/commit-msg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
npx commitlint -e $1 -g .commitlintrc.ts
1+
npx commitlint -e $1 -g .github/linters/.commitlintrc.ts
2+

.prettierignore

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"javascript",
99
"javascriptreact"
1010
],
11-
"eslint.workingDirectories": [{ "mode": "auto" }]
11+
"eslint.workingDirectories": [{ "mode": "auto" }],
12+
"prettier.configPath": ".github/linters/.prettierrc"
1213
}

eslint.config.mjs

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

0 commit comments

Comments
 (0)