UNPKG

4.51 kBJavaScriptView Raw
1const OFF = 0
2const ERROR = 2
3
4module.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-elements': [ OFF, { forbid: [] } ],
33 'react/forbid-prop-types': [ OFF, { forbid: [ 'any', 'array', 'object' ] } ],
34 'react/forbid-foreign-prop-types': OFF,
35 'react/no-array-index-key': ERROR,
36 'react/no-children-prop': ERROR,
37 'react/no-danger': OFF,
38 'react/no-danger-with-children': OFF,
39 'react/no-deprecated': [ ERROR ],
40 'react/no-did-mount-set-state': ERROR,
41 'react/no-did-update-set-state': ERROR,
42 'react/no-direct-mutation-state': ERROR,
43 'react/no-find-dom-node': ERROR,
44 'react/no-is-mounted': ERROR,
45 'react/no-multi-comp': [ ERROR, { ignoreStateless: true } ],
46 'react/no-render-return-value': ERROR,
47 'react/no-set-state': OFF,
48 'react/no-string-refs': ERROR,
49 'react/no-unescaped-entities': ERROR,
50 'react/no-unknown-property': ERROR,
51 'react/no-unused-prop-types': ERROR,
52 'react/no-will-update-set-state': ERROR,
53 'react/prefer-es6-class': [ ERROR, 'always' ],
54 'react/prefer-stateless-function': [ ERROR, { ignorePureComponents: true } ],
55 'react/prop-types': [ ERROR, { ignore: [], customValidators: [], skipUndeclared: false } ],
56 'react/react-in-jsx-scope': ERROR,
57 'react/require-default-props': ERROR,
58 'react/require-optimization': ERROR,
59 'react/require-render-return': ERROR,
60 'react/self-closing-comp': ERROR,
61 'react/sort-comp': [ ERROR, {
62 order: [
63 'static-methods',
64 'lifecycle',
65 '/^on.+$/',
66 '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
67 'everything-else',
68 '/^render.+$/',
69 'render'
70 ]
71 } ],
72 'react/sort-prop-types': [ ERROR, {
73 ignoreCase: true,
74 callbacksLast: false,
75 requiredFirst: true
76 } ],
77 'react/style-prop-object': ERROR,
78 'react/void-dom-elements-no-children': ERROR,
79 'react/jsx-boolean-value': [ ERROR, 'never' ],
80 'react/jsx-closing-bracket-location': [ ERROR, 'line-aligned' ],
81 'react/jsx-curly-spacing': [ ERROR, 'never', { allowMultiline: true } ],
82 'react/jsx-equals-spacing': [ ERROR, 'never' ],
83 'react/jsx-filename-extension': OFF,
84 'react/jsx-first-prop-new-line': [ ERROR, 'multiline-multiprop' ],
85 'react/jsx-handler-names': [ OFF, {
86 eventHandlerPrefix: 'handle',
87 eventHandlerPropPrefix: 'on'
88 } ],
89 'react/jsx-indent': [ ERROR, 2 ],
90 'react/jsx-indent-props': [ ERROR, 2 ],
91 'react/jsx-key': OFF,
92 'react/jsx-max-props-per-line': [ ERROR, { maximum: 1, when: 'multiline' } ],
93 'react/jsx-no-bind': [ ERROR, {
94 ignoreRefs: true,
95 allowArrowFunctions: true,
96 allowBind: false
97 } ],
98 'react/jsx-no-comment-textnodes': ERROR,
99 'react/jsx-no-duplicate-props': [ ERROR, { ignoreCase: true } ],
100 'react/jsx-no-literals': OFF,
101 'react/jsx-no-target-blank': ERROR,
102 'react/jsx-no-undef': ERROR,
103 'react/jsx-pascal-case': [ ERROR, {
104 allowAllCaps: true,
105 ignore: []
106 } ],
107 'react/jsx-sort-props': [ OFF, {
108 ignoreCase: true,
109 callbacksLast: false,
110 shorthandFirst: false,
111 shorthandLast: false,
112 noSortAlphabetically: false,
113 reservedFirst: true
114 } ],
115 'react/jsx-space-before-closing': [ OFF, 'always' ],
116 'react/jsx-tag-spacing': [ ERROR, {
117 closingSlash: 'never',
118 beforeSelfClosing: 'always',
119 afterOpening: 'never'
120 } ],
121 'react/jsx-uses-react': [ ERROR ],
122 'react/jsx-uses-vars': ERROR,
123 'react/jsx-wrap-multilines': [ ERROR, {
124 declaration: true,
125 assignment: true,
126 return: true,
127 arrow: true
128 } ]
129 },
130
131 settings: {
132 'import/resolver': {
133 node: {
134 extensions: [ '.js', '.jsx', '.json' ]
135 }
136 },
137 react: {
138 pragma: 'React',
139 version: '15.0'
140 }
141 }
142}