Skip to content

Commit d6d445d

Browse files
authored
chore: create base eslint config (#7057)
* chore: create base eslint config * chore(eslint): remove typescript from base config * fix: ts parser * chore: remove typescript-eslint from root * chore: update package-lock.json
1 parent 64db5a2 commit d6d445d

File tree

7 files changed

+3363
-3735
lines changed

7 files changed

+3363
-3735
lines changed

apps/site/eslint.config.js

+6-47
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { FlatCompat } from '@eslint/eslintrc';
2-
import js from '@eslint/js';
32
import importX from 'eslint-plugin-import-x';
43
import * as mdx from 'eslint-plugin-mdx';
5-
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
64
import react from 'eslint-plugin-react';
75
import storybook from 'eslint-plugin-storybook';
86
import tseslint from 'typescript-eslint';
97

8+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
9+
import baseConfig from '../../eslint.config.js';
10+
1011
const compat = new FlatCompat();
1112

1213
const compatConfig = compat.config({
@@ -20,62 +21,20 @@ const compatConfig = compat.config({
2021
});
2122

2223
export default tseslint.config(
23-
{
24-
ignores: [
25-
'node_modules',
26-
'.next',
27-
'.swc',
28-
'.turbo',
29-
'build',
30-
'coverage',
31-
'global.d.ts',
32-
'junit.xml',
33-
'storybook-static/**',
34-
],
35-
},
24+
...baseConfig,
3625
{
3726
extends: [
38-
js.configs.recommended,
39-
importX.flatConfigs.recommended,
40-
importX.flatConfigs.typescript,
4127
react.configs.flat['jsx-runtime'],
4228
...tseslint.configs.recommended,
29+
importX.flatConfigs.typescript,
4330
...compatConfig,
4431
],
4532
files: ['**/*.{js,md,mdx,mjs,ts,tsx}'],
46-
plugins: {
47-
'no-relative-import-paths': noRelativeImportPaths,
48-
},
4933
rules: {
50-
'@next/next/no-duplicate-head': 'off',
5134
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
5235
'@typescript-eslint/consistent-type-imports': 'error',
5336
'@typescript-eslint/no-require-imports': 'off',
54-
'import-x/namespace': 'off',
55-
'import-x/no-named-as-default-member': 'off',
56-
'import-x/no-unresolved': 'off',
57-
'import-x/order': [
58-
'error',
59-
{
60-
groups: [
61-
'builtin',
62-
'external',
63-
'internal',
64-
['sibling', 'parent'],
65-
'index',
66-
'unknown',
67-
],
68-
'newlines-between': 'always',
69-
alphabetize: {
70-
order: 'asc',
71-
caseInsensitive: true,
72-
},
73-
},
74-
],
75-
'no-relative-import-paths/no-relative-import-paths': [
76-
'warn',
77-
{ allowSameFolder: true, prefix: '@' },
78-
],
37+
'@next/next/no-duplicate-head': 'off',
7938
},
8039
settings: {
8140
react: {

apps/site/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@
103103
"@types/react": "^18.3.11",
104104
"@types/react-dom": "^18.3.0",
105105
"@types/semver": "~7.5.8",
106-
"eslint": "~9.10.0",
107106
"eslint-config-next": "15.0.0-rc.1",
108107
"eslint-import-resolver-typescript": "~3.6.3",
109-
"eslint-plugin-import-x": "~4.3.1",
110108
"eslint-plugin-mdx": "~3.1.5",
111-
"eslint-plugin-no-relative-import-paths": "~1.5.5",
112109
"eslint-plugin-react": "~7.37.1",
113110
"eslint-plugin-react-hooks": "5.0.0",
114111
"eslint-plugin-storybook": "0.10.0--canary.156.ce8985b.0",

eslint.config.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import js from '@eslint/js';
2+
import importX from 'eslint-plugin-import-x';
3+
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
4+
5+
export default [
6+
js.configs.recommended,
7+
importX.flatConfigs.recommended,
8+
{
9+
ignores: [
10+
'node_modules',
11+
'.turbo',
12+
'.next',
13+
'build',
14+
'coverage',
15+
'global.d.ts',
16+
'junit.xml',
17+
'storybook-static/**',
18+
],
19+
},
20+
{
21+
files: ['**/*.{js,mjs,ts,tsx}'],
22+
plugins: {
23+
'no-relative-import-paths': noRelativeImportPaths,
24+
},
25+
rules: {
26+
'import-x/namespace': 'off',
27+
'import-x/no-named-as-default-member': 'off',
28+
'import-x/no-unresolved': 'off',
29+
'import-x/order': [
30+
'error',
31+
{
32+
groups: [
33+
'builtin',
34+
'external',
35+
'internal',
36+
['sibling', 'parent'],
37+
'index',
38+
'unknown',
39+
],
40+
'newlines-between': 'always',
41+
alphabetize: {
42+
order: 'asc',
43+
caseInsensitive: true,
44+
},
45+
},
46+
],
47+
'no-relative-import-paths/no-relative-import-paths': [
48+
'warn',
49+
{ allowSameFolder: true, prefix: '@' },
50+
],
51+
},
52+
},
53+
];

0 commit comments

Comments
 (0)