1 | const OFF = 0
|
2 | const ERROR = 2
|
3 |
|
4 | module.exports = {
|
5 | plugins: [
|
6 | 'react'
|
7 | ],
|
8 | parserOptions: {
|
9 | ecmaFeatures: {
|
10 | jsx: true
|
11 | }
|
12 | },
|
13 | rules: {
|
14 | 'jsx-quotes': [ ERROR, 'prefer-double' ],
|
15 | 'class-methods-use-this': [ ERROR, {
|
16 | exceptMethods: [
|
17 | 'render',
|
18 | 'getInitialState',
|
19 | 'getDefaultProps',
|
20 | 'getChildContext',
|
21 | 'componentWillMount',
|
22 | 'componentDidMount',
|
23 | 'componentWillReceiveProps',
|
24 | 'shouldComponentUpdate',
|
25 | 'componentWillUpdate',
|
26 | 'componentDidUpdate',
|
27 | 'componentWillUnmount'
|
28 | ]
|
29 | } ],
|
30 | 'react/display-name': [ OFF, { ignoreTranspilerName: false } ],
|
31 | 'react/forbid-component-props': [ OFF, { forbid: [ 'className', 'style' ] } ],
|
32 | 'react/forbid-prop-types': [ OFF, { forbid: [ 'any', 'array', 'object' ] } ],
|
33 | 'react/no-array-index-key': ERROR,
|
34 | 'react/no-children-prop': ERROR,
|
35 | 'react/no-danger': OFF,
|
36 | 'react/no-danger-with-children': OFF,
|
37 | 'react/no-deprecated': [ ERROR ],
|
38 | 'react/no-did-mount-set-state': [ ERROR ],
|
39 | 'react/no-did-update-set-state': [ ERROR ],
|
40 | 'react/no-direct-mutation-state': ERROR,
|
41 | 'react/no-find-dom-node': ERROR,
|
42 | 'react/no-is-mounted': ERROR,
|
43 | 'react/no-multi-comp': [ ERROR, { ignoreStateless: true } ],
|
44 | 'react/no-render-return-value': ERROR,
|
45 | 'react/no-set-state': OFF,
|
46 | 'react/no-string-refs': ERROR,
|
47 | 'react/no-unescaped-entities': ERROR,
|
48 | 'react/no-unknown-property': ERROR,
|
49 | 'react/no-unused-prop-types': ERROR,
|
50 | 'react/prefer-es6-class': [ ERROR, 'always' ],
|
51 | 'react/prefer-stateless-function': [ ERROR, { ignorePureComponents: true } ],
|
52 | 'react/prop-types': [ ERROR, { ignore: [], customValidators: [] } ],
|
53 | 'react/react-in-jsx-scope': ERROR,
|
54 | 'react/require-default-props': ERROR,
|
55 | 'react/require-optimization': ERROR,
|
56 | 'react/require-render-return': ERROR,
|
57 | 'react/self-closing-comp': ERROR,
|
58 | 'react/sort-comp': [ ERROR, {
|
59 | order: [
|
60 | 'static-methods',
|
61 | 'lifecycle',
|
62 | '/^on.+$/',
|
63 | '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
64 | 'everything-else',
|
65 | '/^render.+$/',
|
66 | 'render'
|
67 | ]
|
68 | } ],
|
69 | 'react/sort-prop-types': [ ERROR, {
|
70 | ignoreCase: true,
|
71 | callbacksLast: false,
|
72 | requiredFirst: true
|
73 | } ],
|
74 | 'react/style-prop-object': ERROR,
|
75 | 'react/jsx-boolean-value': [ ERROR, 'never' ],
|
76 | 'react/jsx-closing-bracket-location': [ ERROR, 'line-aligned' ],
|
77 | 'react/jsx-curly-spacing': [ ERROR, 'never', { allowMultiline: true } ],
|
78 | 'react/jsx-equals-spacing': [ ERROR, 'never' ],
|
79 | 'react/jsx-filename-extension': OFF,
|
80 | 'react/jsx-first-prop-new-line': [ ERROR, 'multiline' ],
|
81 | 'react/jsx-handler-names': [ OFF, {
|
82 | eventHandlerPrefix: 'handle',
|
83 | eventHandlerPropPrefix: 'on'
|
84 | } ],
|
85 | 'react/jsx-indent': [ ERROR, 2 ],
|
86 | 'react/jsx-indent-props': [ ERROR, 2 ],
|
87 | 'react/jsx-key': OFF,
|
88 | 'react/jsx-max-props-per-line': [ OFF, { maximum: 1 } ],
|
89 | 'react/jsx-no-bind': [ ERROR, {
|
90 | ignoreRefs: true,
|
91 | allowArrowFunctions: true,
|
92 | allowBind: false
|
93 | } ],
|
94 | 'react/jsx-no-comment-textnodes': ERROR,
|
95 | 'react/jsx-no-duplicate-props': [ ERROR, { ignoreCase: true } ],
|
96 | 'react/jsx-no-literals': OFF,
|
97 | 'react/jsx-no-target-blank': ERROR,
|
98 | 'react/jsx-no-undef': ERROR,
|
99 | 'react/jsx-pascal-case': [ ERROR, {
|
100 | allowAllCaps: true,
|
101 | ignore: []
|
102 | } ],
|
103 | 'react/jsx-sort-props': [ OFF, {
|
104 | ignoreCase: true,
|
105 | callbacksLast: false
|
106 | } ],
|
107 | 'react/jsx-space-before-closing': [ ERROR, 'always' ],
|
108 | 'react/jsx-tag-spacing': [ ERROR, {
|
109 | closingSlash: 'never',
|
110 | beforeSelfClosing: 'always',
|
111 | afterOpening: 'never'
|
112 | } ],
|
113 | 'react/jsx-uses-react': [ ERROR ],
|
114 | 'react/jsx-uses-vars': ERROR,
|
115 | 'react/jsx-wrap-multilines': [ ERROR, {
|
116 | declaration: true,
|
117 | assignment: true,
|
118 | return: true
|
119 | } ]
|
120 | },
|
121 |
|
122 | settings: {
|
123 | 'import/resolver': {
|
124 | node: {
|
125 | extensions: [ '.js', '.jsx', '.json' ]
|
126 | }
|
127 | },
|
128 | react: {
|
129 | pragma: 'React',
|
130 | version: '15.3.0'
|
131 | }
|
132 | }
|
133 | }
|