1 |
|
2 |
|
3 | module.exports = {
|
4 | parser: 'babel-eslint',
|
5 | parserOptions: {
|
6 | ecmaVersion: 6,
|
7 | ecmaFeatures: {
|
8 | jsx: true
|
9 | }
|
10 | },
|
11 | plugins: [
|
12 | 'eslint-plugin-react'
|
13 | ],
|
14 | env: {
|
15 | browser: true,
|
16 | es6: true
|
17 | },
|
18 | rules: {
|
19 | 'react/display-name': [ 2, {
|
20 | ignoreTranspilerName: true
|
21 | }], // Force displayName on components
|
22 | 'react/forbid-prop-types': 2, // Disallow `any`, `array`, and `object` propTypes
|
23 | 'react/no-danger': 2, // prevent usage of <div dangerouslySetInnerHTML={{ __html: "Hello World" }}></div>;
|
24 | 'react/no-deprecated': 2, // prevent usage of deprecated methods
|
25 | 'react/no-did-mount-set-state': 2, // prevent usage of .setState in componentDidMount
|
26 | 'react/no-did-update-set-state': 2, // prevent usage of .componentDidUpdate
|
27 | 'react/no-direct-mutation-state': 2, // prevent direct mutation of this.state
|
28 | 'react/no-is-mounted': 2, // prevent usage of this.isMounted()
|
29 | 'react/no-multi-comp': 2, // prevent multiple component definition per file
|
30 | 'react/no-set-state': 0, // allow .setState
|
31 | 'react/no-string-refs': 0, // allow string refs
|
32 | 'react/no-unknown-property': 2, // prevent class=
|
33 | 'react/prefer-es6-class': 2, // prefer es6 classes
|
34 | 'react/prefer-stateless-function': 0, // don't prefer stateless functions
|
35 | 'react/prop-types': 2, // Require propTypes when props are used
|
36 | 'react/react-in-jsx-scope': 2, // Require react in jsx scope
|
37 | 'react/require-extension': 0, // Don't require extensions
|
38 | 'react/self-closing-comp': 2, // prefer to use single self-closing tag
|
39 | 'react/sort-comp': 2, // prefer sorted component methods
|
40 | 'react/sort-prop-types': 2, // prefer sorted propTypes
|
41 | 'react/wrap-multilines': 2, // prevent multiline jsx without parens
|
42 | 'react/jsx-boolean-value': [ 2, 'always' ], // always use bracket notation with boolean values
|
43 | 'react/jsx-closing-bracket-location': 1, // prefer closing bracket location on same indent as opening
|
44 | 'react/jsx-curly-spacing': [ 2, 'never' ], // never have extra spacing in JSX props
|
45 | 'react/jsx-equals-spacing': [ 2, 'never' ], // never have spacing around prop equals sign
|
46 | 'react/jsx-handler-names': 0, // allow handler names to be named however
|
47 | 'react/jsx-indent-props': [ 2, 2 ], // prefer to indent props by two spaces
|
48 | 'react/jsx-indent': [ 2, 2 ], // indent jsx components by 2 spaces
|
49 | 'react/jsx-key': 2, // verify that there is a key in arrays of jsx elements
|
50 | 'react/jsx-max-props-per-line': [ 2, { 'maximum': 2 } ], // maximum of two props per line
|
51 | 'react/jsx-no-bind': 2, // prevent `.bind` and arrow functions in the `render()` function
|
52 | 'react/jsx-no-duplicate-props': 2, // prevent duplicate prop declarations
|
53 | 'react/jsx-no-literals': 0, // allows string literals
|
54 | 'react/jsx-no-undef': 2, // prevent use of undefined components
|
55 | 'react/jsx-pascal-case': 2, // prefer PascalCase
|
56 | 'react/jsx-sort-props': 0, // don't worry about sorting props
|
57 | 'react/jsx-space-before-closing': [ 2, 'always' ], // add spacing before closing tags
|
58 | 'react/jsx-uses-react': 2, // Prevent React to be incorrectly marked as unused
|
59 | 'react/jsx-uses-vars': 2, // Prevent variables used in JSX to be incorrectly marked as unused
|
60 | }
|
61 | }
|