UNPKG

2.33 kBJavaScriptView Raw
1/**
2 * React.js Apps and Components
3 */
4module.exports = {
5 extends: [
6 'eslint-config-mongodb-js',
7 'eslint-config-mongodb-js/rules/ecmascript-6'
8 ],
9 parser: 'babel-eslint',
10 plugins: [
11 'react'
12 ],
13 ecmaFeatures: {
14 jsx: true
15 },
16 rules: {
17 // Prevent missing displayName in a React component definition
18 'react/display-name': 0,
19 // Enforce boolean attributes notation in JSX
20 'react/jsx-boolean-value': 2,
21 // Enforce or disallow spaces inside of curly braces in JSX attributes
22 'react/jsx-curly-spacing': 0,
23 // Prevent duplicate props in JSX
24 'react/jsx-no-duplicate-props': 0,
25 // Disallow undeclared variables in JSX
26 'react/jsx-no-undef': 2,
27 // Enforce quote style for JSX attributes
28 'react/jsx-quotes': 0,
29 // Enforce propTypes declarations alphabetical sorting
30 'react/jsx-sort-prop-types': 0,
31 // Enforce props alphabetical sorting
32 'react/jsx-sort-props': 0,
33 // Prevent React to be incorrectly marked as unused
34 'react/jsx-uses-react': 2,
35 // Prevent variables used in JSX to be incorrectly marked as unused
36 'react/jsx-uses-vars': 2,
37 // Prevent usage of dangerous JSX properties
38 'react/no-danger': 0,
39 // Prevent usage of setState in componentDidMount
40 'react/no-did-mount-set-state': 2,
41 // Prevent usage of setState in componentDidUpdate
42 'react/no-did-update-set-state': 2,
43 // Prevent multiple component definition per file
44 'react/no-multi-comp': 2,
45 // Prevent usage of unknown DOM property
46 'react/no-unknown-property': 2,
47 // Prevent missing props validation in a React component definition
48 'react/prop-types': 2,
49 // Prevent missing React when using JSX
50 'react/react-in-jsx-scope': 2,
51 // Restrict file extensions that may be required
52 'react/require-extension': 0,
53 // Prevent extra closing tags for components without children
54 'react/self-closing-comp': [2, {
55 component: true
56 }],
57 // Enforce component methods order
58 'react/sort-comp': [2, {
59 order: [
60 'lifecycle',
61 '/^on.+$/',
62 '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
63 'everything-else',
64 '/^render.+$/',
65 'render'
66 ]
67 }],
68 // Prevent missing parentheses around multilines JSX
69 'react/wrap-multilines': 2
70 }
71};