This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
121 lines (121 loc) · 2.84 KB
/
.eslintrc.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
/**
* @type {import('@types/eslint').Linter.BaseConfig}
*/
const config = {
env: {
browser: true,
es2022: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:astro/recommended",
"airbnb-base",
"plugin:prettier/recommended",
],
overrides: [
{
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"airbnb-typescript/base",
"plugin:prettier/recommended",
],
files: ["*.{astro,tsx,ts}"],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
extraFileExtensions: [".astro"],
parser: "@typescript-eslint/parser",
project: ["./tsconfig.json"],
sourceType: "module",
tsconfigRootDir:
__dirname /* This line is the only reason why the entire file is JS :vomiting_face: */,
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-non-null-assertion":
"off" /* Required as TypeScript doesn't recognize complex type assertions */,
},
},
{
files: ["*.astro"],
parser: "astro-eslint-parser",
},
{
files: ["*.{tsx,ts}"],
parser: "@typescript-eslint/parser",
},
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
sourceType: "module",
},
plugins: ["import"],
root: true,
rules: {
/* Shared Rules for both JS and TS */
"import/no-cycle":
"off" /* False positives :*( A litte too conservative with ES6 modules */,
"import/order": [
"warn",
{
alphabetize: {
order: "asc",
},
groups: [
"type",
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"unknown",
],
pathGroups: [
{
group: "internal",
pattern: "~**",
position: "before",
},
],
},
] /* Custom settings */,
"import/prefer-default-export": "off" /* This makes no sense */,
"no-cond-assign": [
"error",
"except-parens",
] /* Added 'except-parens' option */,
"no-dupe-else-if": "warn" /* airbnb: not enabled yet */,
"no-empty": [
"error",
{ allowEmptyCatch: true },
] /* airbnb: added allowEmptyCatch option */,
"no-import-assign": "warn" /* airbnb: not enabled yet */,
"no-void": "off" /* False positives + outdated */,
"require-await": "error" /* Prevent unnecessary async functions */,
"sort-keys": "warn" /* sort object keys */,
"sort-vars": "warn" /* sort variable declarations */,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".tsx", ".ts"],
"astro-eslint-parser": [".astro"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code
},
},
},
};
module.exports = config;