-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
88 lines (79 loc) · 2.65 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
module.exports = {
parser: "babel-eslint",
extends: ["airbnb", "prettier", "prettier/react"],
env: {
es6: true,
browser: true,
node: true,
jest: true
},
plugins: ["react", "prettier"],
parserOptions: {
sourceType: "module",
allowImportExportEverywhere: true
},
rules: {
// don't force es6 functions to include space before parenthesis
"space-before-function-paren": 0,
// allow specifying true explicitly for boolean props
"react/jsx-boolean-value": 0,
// allow imports mixed with non-import statements at top of file
"import/first": 0,
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
"import/no-extraneous-dependencies": ["error", { packageDir: "." }],
// Prefer destructuring from arrays and objects
// http://eslint.org/docs/rules/prefer-destructuring
"prefer-destructuring": [
"error",
{
VariableDeclarator: {
array: false,
object: true
},
AssignmentExpression: {
array: false,
object: false
}
},
{
enforceForRenamedProperties: false
}
],
// Allow .js files to use JSX syntax
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
// Functional and class components are equivalent from React’s point of view
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
"react/prefer-stateless-function": "off",
// Ensure <a> tags are valid
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md
"jsx-a11y/anchor-is-valid": [
"error",
{
components: ["Link"],
specialLink: ["to"],
aspects: ["noHref", "invalidHref", "preferButton"]
}
],
// ESLint plugin for prettier formatting
// https://github.com/prettier/eslint-plugin-prettier
"prettier/prettier": "error",
// Disable no-param-reassign only for param properties
// https://stackoverflow.com/a/35637900
"no-param-reassign": [2, { props: false }],
"import/no-extraneous-dependencies": [
"error",
{ packageDir: ["./", "./example/"] }
]
},
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: {
moduleDirectory: ["node_modules", "src"]
}
}
}
};