-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
75 lines (73 loc) · 2.53 KB
/
eslint.config.mjs
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
import eslint from '@eslint/js'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
...tseslint.config({
files: ['**/*.{ts,cts,mts,tsx}'],
extends: [...tseslint.configs.recommendedTypeChecked],
languageOptions: {
parserOptions: {
projectService: true,
},
},
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'default', format: ['camelCase'] },
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'variable', types: ['function'], format: ['camelCase', 'PascalCase'] },
{ selector: 'typeParameter', format: ['PascalCase'], prefix: ['T'] },
{ selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },
{ selector: 'import', format: null },
// typestyle does not play well with this rule.
{ selector: 'property', format: null, leadingUnderscore: 'allow' },
],
},
}),
...tseslint.config({
files: ['**/*.{js,mjs,cjs}'],
extends: [eslint.configs.recommended],
}),
{
files: ['*.{js,cjs}'],
languageOptions: {
globals: {
module: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
},
},
},
{
files: ['plugins/**/gatsby-browser.js'],
languageOptions: {
globals: {
document: 'readonly',
},
},
},
{
// MEMO: Do not put any extra keys here otherwise it will not work.
// https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores
ignores: [
'public/*', // build output
'.cache/*', // cache
'src/types/graphql-types.d.ts', // type generated by gatsby
],
},
)