1 | module.exports = {
|
2 | extends: [
|
3 | 'airbnb'
|
4 | ],
|
5 | parser: 'babel-eslint',
|
6 | parserOptions: {
|
7 | ecmaVersion: 7,
|
8 | ecmaFeatures: {
|
9 | jsx: true
|
10 | }
|
11 | },
|
12 | env: {
|
13 | browser: true,
|
14 | mocha: true,
|
15 | node: true
|
16 | },
|
17 | globals: {
|
18 | benchmark: true,
|
19 | chai: true,
|
20 | expect: true,
|
21 | geminiReact: true,
|
22 | React: true,
|
23 | suite: true
|
24 | },
|
25 | plugins: [
|
26 | 'chai-friendly',
|
27 | 'class-methods-use-this-regexp',
|
28 | 'jsdoc',
|
29 | 'sort-class-members'
|
30 | ],
|
31 | rules: {
|
32 | 'class-methods-use-this': 0,
|
33 | 'class-methods-use-this-regexp/class-methods-use-this': [2, {
|
34 | exceptMethods: [
|
35 | 'blur',
|
36 | 'render*',
|
37 | 'getInitialState',
|
38 | 'getDefaultProps',
|
39 | 'componentWillMount',
|
40 | 'componentDidMount',
|
41 | 'componentWillReceiveProps',
|
42 | 'shouldComponentUpdate',
|
43 | 'componentWillUpdate',
|
44 | 'componentDidUpdate',
|
45 | 'componentWillUnmount',
|
46 | 'componentDidCatch'
|
47 | ]
|
48 | }],
|
49 | 'chai-friendly/no-unused-expressions': 2,
|
50 | 'comma-dangle': [2, 'never'],
|
51 | 'default-case': 0,
|
52 | 'func-names': 0,
|
53 | 'function-paren-newline': 0,
|
54 | indent: [2, 4, { SwitchCase: 1 }],
|
55 | 'jsdoc/newline-after-description': 2,
|
56 | 'jsx-quotes': [2, 'prefer-single'],
|
57 | 'max-len': [2, 120, 4, { ignoreComments: true }],
|
58 | 'no-param-reassign': 0,
|
59 | 'no-plusplus': [2, { allowForLoopAfterthoughts: true }],
|
60 | 'no-shadow': 0,
|
61 | 'no-unused-expressions': 0,
|
62 | 'prefer-arrow-callback': 0,
|
63 | 'prefer-const': 0,
|
64 | 'react/jsx-boolean-value': [2, 'always'],
|
65 | 'react/jsx-curly-spacing': [2, { when: 'always', children: true }],
|
66 | 'react/jsx-filename-extension': [2, { extensions: ['.jsx'] }],
|
67 | 'react/jsx-indent': [2, 4],
|
68 | 'react/jsx-indent-props': [2, 4],
|
69 | 'react/jsx-no-target-blank': 2,
|
70 | 'react/no-unused-prop-types': 0,
|
71 | 'react/prefer-stateless-function': 0,
|
72 | 'react/require-default-props': 0,
|
73 | 'react/sort-comp': 0,
|
74 | 'jsx-a11y/href-no-hash': 'off',
|
75 | 'jsx-a11y/anchor-is-valid': ['warn', { aspects: ['invalidHref'] }],
|
76 | 'jsx-a11y/label-has-for': ['error', { components: ['label'], allowChildren: true }],
|
77 | 'sort-class-members/sort-class-members': [2, {
|
78 | order: [
|
79 | '[static-properties]',
|
80 | '[static-methods]',
|
81 | '[static-stuff]',
|
82 | '[properties]',
|
83 | '[lifecycle]',
|
84 | '[rendering]',
|
85 | '[handling]',
|
86 | '[everything-else]'
|
87 | ],
|
88 | groups: {
|
89 | 'static-stuff': [
|
90 | { type: 'property', static: true, name: 'propTypes' },
|
91 | { type: 'property', static: true, name: 'defaultProps' },
|
92 | { type: 'property', static: true, name: 'contextTypes' },
|
93 | { type: 'property', static: true, name: 'childContextTypes' },
|
94 | { type: 'property', static: false, name: 'state' }
|
95 | ],
|
96 | lifecycle: [
|
97 | { type: 'method', static: false, name: 'constructor' },
|
98 | { type: 'method', static: false, name: 'getChildContext' },
|
99 | { type: 'method', static: false, name: 'componentWillMount' },
|
100 | { type: 'method', static: false, name: 'componentDidMount' },
|
101 | { type: 'method', static: false, name: 'componentWillReceiveProps' },
|
102 | { type: 'method', static: false, name: 'shouldComponentUpdate' },
|
103 | { type: 'method', static: false, name: 'componentWillUpdate' },
|
104 | { type: 'method', static: false, name: 'componentDidUpdate' },
|
105 | { type: 'method', static: false, name: 'componentWillUnmount' },
|
106 | { type: 'method', static: false, name: 'componentDidCatch' }
|
107 | ],
|
108 | rendering: [
|
109 | { type: 'method', static: false, name: 'render' },
|
110 | { type: 'method', static: false, name: '/^render.+$/' }
|
111 | ],
|
112 | handling: [
|
113 | { type: 'method', static: false, name: '/^handle.+$/' }
|
114 | ]
|
115 | },
|
116 | accessorPairPositioning: 'getThenSet'
|
117 | }],
|
118 | 'valid-jsdoc': [2, {
|
119 | matchDescription: '(.+\\.)|^$',
|
120 | prefer: { return: 'returns' },
|
121 | preferType: {
|
122 | boolean: 'Boolean', number: 'Number', object: 'Object', string: 'String'
|
123 | },
|
124 | requireReturn: false,
|
125 | requireReturnDescription: false
|
126 | }],
|
127 | 'no-use-before-define': ['error', { functions: false }]
|
128 | }
|
129 | };
|