forked from zeromicro/portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
90 lines (89 loc) · 2.7 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
const path = require("path")
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
"standard-with-typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
"prettier",
"prettier/@typescript-eslint",
"prettier/babel",
"prettier/react",
"prettier/standard",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {},
ecmaVersion: 2018,
project: path.resolve(__dirname, "./tsconfig.json"),
tsconfigRootDir: __dirname,
sourceType: "module",
},
plugins: ["@typescript-eslint", "babel", "prettier", "react", "standard"],
rules: {
"react/sort-comp": [
"error",
{
order: [
"static-methods",
"lifecycle",
"/^on.+$/",
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
"everything-else",
"/^render.+$/",
"render",
],
},
],
"react/no-deprecated": "error",
"react/style-prop-object": "error",
"react/self-closing-comp": "error",
"react/require-render-return": "error",
"react/prefer-stateless-function": "error",
"react/no-unused-prop-types": "warn",
"react/no-unused-state": "warn",
"react/no-this-in-sfc": "error",
"react/no-typos": "error",
"react/no-redundant-should-component-update": "error",
"react/no-access-state-in-setstate": "error",
"react/jsx-closing-bracket-location": "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-equals-spacing": "error",
"react/jsx-first-prop-new-line": "error",
"react/jsx-indent": ["error", 2],
"react/jsx-indent-props": ["error", 2],
"react/jsx-pascal-case": "error",
"react/jsx-sort-default-props": "error",
"react/jsx-wrap-multilines": "error",
"react/jsx-tag-spacing": [
"error",
{
closingSlash: "never",
beforeSelfClosing: "always",
afterOpening: "never",
beforeClosing: "never",
},
],
"react/jsx-boolean-value": "error",
"react/jsx-curly-spacing": "error",
"react/jsx-no-comment-textnodes": "warn",
"react/jsx-curly-brace-presence": "error",
"react/prop-types": "off",
"jsx-quotes": ["error", "prefer-double"],
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"quote-props": ["error", "as-needed"],
"object-shorthand": ["error", "always"],
"no-var": ["error"],
"no-console": ["warn", { allow: ["warn", "error", "info"] }],
"prettier/prettier": ["warn"],
},
settings: {
react: { version: "detect" },
},
}