-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
120 lines (119 loc) · 3.02 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
// @ts-check
import eslint from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import astroParser from "astro-eslint-parser";
import eslintPluginAstro from "eslint-plugin-astro";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
{
ignores: ["**/*.astro", "**/dist", "**/node_modules", "dist/**/*"],
},
{
languageOptions: {
parserOptions: {
project: "./tsconfig.eslint.json",
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"no-shadow": [
"error",
{
builtinGlobals: true,
hoist: "functions",
allow: ["name"],
ignoreOnInitialization: false,
},
],
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
"no-unreachable-loop": "error",
"no-unused-expressions": [
"error",
{
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
enforceForJSX: true,
},
],
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
varsIgnorePattern: "^_",
},
],
},
},
{
files: ["**/*.astro"],
plugins: {
eslintPluginAstro,
},
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: [".astro"],
sourceType: "module",
},
},
rules: {
"consistent-return": "off",
},
},
{
files: ["**/*.astro", "**/*.ts", "**/*.tsx"],
rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
disallowTypeAnnotations: true,
},
],
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"@typescript-eslint/no-non-null-assertion": "error",
/**
* Typescript extension rules -- Core rules need to be disabled.
*/
"no-shadow": "off",
"@typescript-eslint/no-shadow": [
"error",
{
builtinGlobals: true,
hoist: "functions",
allow: ["name"],
ignoreOnInitialization: false,
},
],
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
enforceForJSX: true,
},
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
varsIgnorePattern: "^_",
},
],
},
},
);