-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.eslintrc.cjs
165 lines (163 loc) · 4.29 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
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
module.exports = {
root: true,
plugins: [
"unused-imports",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:jsx-a11y/recommended",
"plugin:astro/recommended",
"plugin:tailwindcss/recommended"
],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.astro']
},
ignorePatterns: [
"*.js", "*.cjs", "*.mjs", "*.mdx", "*.md"
],
rules: {
"no-console": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
},
],
"import/order": ["error", {
"groups": [
"external",
"internal"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc"
}
}],
"import/no-unresolved": [2, { ignore: [
'astro:.*$',
'.*?raw$'
]}]
},
settings: {
"import/resolver": {
"typescript": {
project: "./tsconfig.json"
},
"node": true,
},
"import/extensions": [
".ts",
".tsx"
],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
tailwindcss: {
whitelist: [
"circling-icon",
"circling-icons",
"circling-planets",
"hero-icon",
"text-primary",
"toast"
]
}
},
overrides: [
{
files: ["*.tsx"],
plugins: [
"@typescript-eslint",
"solid",
"prettier"
],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
rules: {
// Prettier
"prettier/prettier": "error",
// identifier usage is important
"solid/jsx-no-duplicate-props": 2,
"solid/jsx-no-undef": [2, { typescriptEnabled: true }],
"solid/jsx-uses-vars": 2,
// security problems
"solid/no-innerhtml": 2,
"solid/jsx-no-script-url": 2,
// reactivity
"solid/components-return-once": 1,
"solid/no-destructure": 2,
"solid/prefer-for": 2,
"solid/reactivity": 1,
"solid/event-handlers": 1,
// these rules are mostly style suggestions
"solid/imports": 1,
"solid/style-prop": 1,
"solid/no-react-deps": 1,
"solid/no-react-specific-props": 1,
"solid/self-closing-comp": 1,
"solid/no-array-handlers": 0,
"solid/no-unknown-namespaces": 0,
}
},
{
files: ["*.astro"],
plugins: ["astro"],
// This is required b/c astro files do their own fancy type checking.
// We run this via `astro check`, so it is unnecessary for eslint to run it
// AND eslint will actually incorrect certain imports (e.g., images) as any which
// will cause issues
extends: ['plugin:@typescript-eslint/disable-type-checked'],
env: {
node: true,
"astro/astro": true,
es2020: true,
},
processor: "astro/client-side-ts",
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
// The script of Astro components uses ESM.
sourceType: "module",
},
rules: {
"astro/no-conflict-set-directives": "error",
"astro/no-unused-define-vars-in-style": "error",
},
},
{
// Define the configuration for `<script>` tag when using `client-side-ts` processor.
// Script in `<script>` is assigned a virtual file name with the `.ts` extension.
files: ["**/*.astro/*.ts", "*.astro/*.ts"],
env: {
browser: true,
es2020: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
},
rules: {
// If you are using "prettier/prettier" rule,
// you don't need to format inside <script> as it will be formatted as a `.astro` file.
"prettier/prettier": "off",
},
},
],
}