-
Notifications
You must be signed in to change notification settings - Fork 78
/
eslint.config.js
178 lines (161 loc) · 5.48 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import { includeIgnoreFile } from "@eslint/compat";
import path from "node:path";
import { fileURLToPath } from "node:url";
// import simpleImportSort from "eslint-plugin-simple-import-sort";
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");
export default tseslint.config(
eslint.configs.recommended,
// ...tseslint.configs.strictTypeChecked,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
},
includeIgnoreFile(gitignorePath),
{
ignores: [
'.prettierrc.cjs',
'**/*.mjs', // scripts
'**/codegen.ts',
]
},
{
rules: {
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/consistent-type-definitions': 'warn',
// '@typescript-eslint/explicit-function-return-type': 'off',
// // Doesn't work for FC: https://github.com/yannickcr/eslint-plugin-react/issues/2353
// 'react/prop-types': 'off',
// // Prefer non-default exports
// 'import/no-default-export': 'off',
// 'import/prefer-default-export': 'off',
// Unary operators are ok
'no-plusplus': 'off',
// // Using a type system makes it safe enough to spread props
// 'react/jsx-props-no-spreading': 'off',
// // We want to be able to use functions before definition
// '@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
minimumDescriptionLength: 5,
},
],
'no-bitwise': 'off',
},
},
// {
// files: ['**/pages/**/*.{ts,tsx}'],
// rules: {
// 'react/react-in-jsx-scope': 'off', // react is a global in this folder
// 'import/no-default-export': 'off', // pages have to have a default export
// 'import/prefer-default-export': 'off',
// '@typescript-eslint/explicit-module-boundary-types': [
// // So we can infer prop types
// 'warn',
// { allowedNames: ['getStaticProps'] },
// ],
// },
// },
// {
// files: ['**/*.stories.*'],
// rules: {
// // Storybook requires default exports for stories
// 'import/no-default-export': 'off',
// '@typescript-eslint/explicit-module-boundary-types': 'off',
// },
// },
)
// export default [
// {
// root: true,
// extends: [
// // doesn't support EWSLint v9: https://github.com/airbnb/javascript/issues/2961
// // 'airbnb-base',
// // 'airbnb-typescript/base',
// // 'airbnb/hooks',
// 'plugin:@typescript-eslint/eslint-recommended',
// 'plugin:@typescript-eslint/recommended',
// 'plugin:jest/recommended',
// 'prettier',
// ],
// parserOptions: {
// project: 'tsconfig.json',
// tsconfigRootDir: __dirname,
// ecmaVersion: 6,
// },
// ignorePatterns: [
// '**/codegen.ts',
// '**/next.config.mjs',
// '**/vite.config.ts',
// '**/jest.config.js',
// ],
// plugins: { 'simple-import-sort': simpleImportSort },
// settings: {
// 'import/resolver': { typescript: {} },
// },
// rules: {
// '@typescript-eslint/explicit-function-return-type': 'off',
// // Doesn't work for FC: https://github.com/yannickcr/eslint-plugin-react/issues/2353
// 'react/prop-types': 'off',
// // Prefer non-default exports
// 'import/no-default-export': 'off',
// 'import/prefer-default-export': 'off',
// // Auto-sort imports
// 'sort-imports': 'off',
// 'import/order': 'off',
// 'simple-import-sort/imports': 'error',
// 'simple-import-sort/exports': 'error',
// // unary operators are ok
// 'no-plusplus': 'off',
// // Using a type system makes it safe enough to spread props
// 'react/jsx-props-no-spreading': 'off',
// // we want to be able to use functions before definition
// '@typescript-eslint/no-use-before-define': 'off',
// '@typescript-eslint/ban-ts-comment': [
// 'error',
// {
// 'ts-expect-error': 'allow-with-description',
// minimumDescriptionLength: 5,
// },
// ],
// 'no-bitwise': 'off',
// },
// overrides: [
// {
// // assuming Next.js application
// files: '**/pages/**/*.{ts,tsx}',
// rules: {
// 'react/react-in-jsx-scope': 'off', // react is a global in this folder
// 'import/no-default-export': 'off', // pages have to have a default export
// 'import/prefer-default-export': 'off',
// '@typescript-eslint/explicit-module-boundary-types': [
// // So we can infer prop types
// 'warn',
// { allowedNames: ['getStaticProps'] },
// ],
// },
// },
// {
// files: ['**/*.stories.*'],
// rules: {
// // Storybook requires default exports for stories
// 'import/no-default-export': 'off',
// '@typescript-eslint/explicit-module-boundary-types': 'off',
// },
// },
// ],
// parser: '@typescript-eslint/parser',
// }
// ]