This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
116 lines (116 loc) · 2.93 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
/**
* @type {import('@types/eslint').Linter.BaseConfig}
*/
const config = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"eslint:recommended",
"@remix-run/eslint-config",
"@remix-run/eslint-config/node",
"airbnb",
"airbnb/hooks",
"plugin:prettier/recommended",
],
ignorePatterns: ["package-lock.json", ".*ignore", "db/migrations"],
overrides: [
{
excludedFiles: ["*.js", "*.jsx"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"airbnb-typescript",
"plugin:prettier/recommended",
],
files: ["*.{tsx,ts}"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
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 */,
"@typescript-eslint/no-throw-literal":
"off" /* Remix encourages throwing methods to escape execution */,
},
},
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
sourceType: "module",
},
plugins: ["react", "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-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": [
"error",
{ allowAsStatement: true },
] /* airbnb: allowAsStatement not enabled */,
"react/jsx-props-no-spreading":
"off" /* Prevents elegant pass-through of props to children */,
"react/react-in-jsx-scope":
"off" /* Framework provides React in the global scope already */,
"react/require-default-props":
"off" /* Better: https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/default_props/ */,
"require-await": "error" /* Prevent unnecessary async functions */,
"sort-keys": "warn" /* sort object keys */,
"sort-vars": "warn" /* sort variable declarations */,
},
settings: {
react: {
version: "detect",
},
},
};
module.exports = config;