-
Notifications
You must be signed in to change notification settings - Fork 8
/
.eslintrc.js
128 lines (113 loc) · 3.33 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
122
123
124
125
126
127
128
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
// ESLint configuration
// http://eslint.org/docs/user-guide/configuring
module.exports = {
parser: "@typescript-eslint/parser",
extends: [
"airbnb",
"plugin:css-modules/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
plugins: ["css-modules", "@typescript-eslint", "import"],
globals: {
__DEV__: true,
},
env: {
browser: true,
},
root: true,
rules: {
// `js` and `jsx` are common extensions
// `mjs` is for `universal-router` only, for now
"import/extensions": [
"error",
{
js: "never",
jsx: "never",
mjs: "never",
ts: "never",
json: "always",
},
],
// Not supporting nested package.json yet
// https://github.com/benmosher/eslint-plugin-import/issues/458
"import/no-extraneous-dependencies": "off",
"jsx-a11y/anchor-is-valid": [
"error",
{
specialLink: ["to"],
},
],
// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
"no-console": [
"error",
{
allow: ["warn", "error", "info"],
},
],
"prefer-destructuring": 0,
// Allow js files to use jsx syntax, too
"react/jsx-filename-extension": [
"error",
{ extensions: [".js", ".jsx", ".tsx"] },
],
// Automatically convert pure class to function by
// babel-plugin-transform-react-pure-class-to-function
// https://github.com/kriasoft/react-starter-kit/pull/961
"react/prefer-stateless-function": "off",
"comma-dangle": 0,
"key-spacing": 0,
"no-confusing-arrow": 0,
"react/jsx-quotes": 0,
"react/jsx-props-no-spreading": 0,
"max-len": 0,
"jsx-quotes": [2, "prefer-double"],
"arrow-parens": "off",
"generator-star-spacing": "off",
"import/prefer-default-export": 0,
"react/forbid-prop-types": "off",
"react/destructuring-assignment": "off",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
"react/static-property-placement": "off",
"import/no-relative-packages": "off",
"import/no-import-module-exports": "off",
"no-use-before-define": "off",
"no-param-reassign": [
"error",
{ props: true, ignorePropertyModificationsFor: ["draftState"] },
],
"@typescript-eslint/no-use-before-define": ["error"],
},
settings: {
// Allow absolute paths in imports, e.g. import Button from 'components/Button'
// https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
moduleDirectory: ["node_modules", "src"],
},
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
extensions: [".ts", ".tsx"],
},
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
};