-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
82 lines (78 loc) · 2.06 KB
/
.eslintrc.cjs
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
/** @type {import("eslint").Linter.BaseConfig} */
const config = {
env: {
browser: true,
es2022: true
},
extends: [
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:jsx-a11y/recommended',
'plugin:tailwindcss/recommended',
'prettier' // Has to be set last!
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json'
},
settings: {
'import/resolver': {
typescript: {}
}
},
plugins: [
'import',
'promise',
'jsx-a11y',
'tailwindcss',
'simple-import-sort'
],
rules: {
'tailwindcss/no-custom-classname': 'off', // Has to be disabled because the usage of tailwindcss plugins triggers this rule
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error'
}
};
config.overrides?.push({
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
extends: ['standard-with-typescript', ...(config.extends ?? [])],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off'
}
});
config.overrides?.push({
files: ['*.astro'],
extends: [
'plugin:astro/recommended',
'plugin:astro/jsx-a11y-recommended',
'standard-with-typescript',
...(config.extends ?? [])
],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro']
},
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off'
}
});
config.overrides?.push({
files: ['*.mdx'],
extends: ['plugin:mdx/recommended', ...(config.extends ?? [])],
rules: {
// Not all imported components are always used in the posts
'no-unused-vars': 'off'
}
});
module.exports = config;