-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
118 lines (117 loc) · 3.88 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
/*
tslint won't be supported: https://github.com/palantir/tslint/issues/4534
you should use typescript-eslint/eslint-plugin: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
but you can't do it with {parser: 'babel-eslint'}: https://github.com/typescript-eslint/typescript-eslint#what-about-babel-and-babel-eslint
*/
/** @type {import("eslint").Linter.Config} */
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
extends: ["eslint:recommended", "airbnb", "prettier", "plugin:@typescript-eslint/recommended"],
env: {
es6: true,
node: true,
browser: true,
},
globals: {
DEV: true,
},
plugins: ["json", "prettier", "import", "@typescript-eslint", "unused-imports"],
rules: {
"react/no-this-in-sfc": "off",
"react/function-component-definition": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-filename-extension": [1, { extensions: [".tsx", ".jsx"] }],
"react/static-property-placement": "off",
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off",
"react/no-access-state-in-setstate": "off",
"react/no-unknown-property": ["error", { ignore: ["w-confirm"] }],
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/no-explicit-any": "off", //["error", { ignoreRestArgs: true, }],
"@typescript-eslint/no-namespace": "off",
"prettier/prettier": ["error"],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"no-promise-executor-return": "off",
"no-continue": "off",
"no-shadow": "off",
"no-constant-condition": "off",
"no-await-in-loop": 0,
"no-bitwise": 0,
"no-param-reassign": 0,
"no-return-assign": ["error", "except-parens"],
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"no-unused-expressions": ["error", { allowShortCircuit: true, allowTernary: true }],
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
"no-plusplus": 0,
"class-methods-use-this": 0,
"max-len": [
"warn",
{
code: 120,
tabWidth: 2,
comments: 1000,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
"unused-imports/no-unused-imports": "error",
"import/no-extraneous-dependencies": "off",
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
},
overrides: [
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
},
},
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
project: ["./tsconfig.json"],
},
},
},
};