forked from kriasoft/react-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
101 lines (88 loc) · 2.77 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
/**
* 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: 'babel-eslint',
extends: [
'airbnb',
'plugin:flowtype/recommended',
'plugin:css-modules/recommended',
'prettier',
'prettier/flowtype',
'prettier/react',
],
plugins: ['flowtype', 'css-modules', 'prettier'],
globals: {
__DEV__: true,
},
env: {
browser: true,
},
rules: {
// 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: '.' }],
// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
// https://eslint.org/docs/rules/no-console
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
// 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,
},
],
// 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'],
},
],
// 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': ['error', { 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',
// ESLint plugin for prettier formatting
// https://github.com/prettier/eslint-plugin-prettier
'prettier/prettier': '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: {
moduleDirectory: ['node_modules', 'src'],
},
},
},
};