UNPKG

@alifd/eslint-config-next

Version:

Next components ESLint config, following our styleguide.

106 lines (105 loc) 6.14 kB
module.exports = { "plugins": [ "react" ], "parserOptions": { "ecmaFeatures": { "jsx": true } }, // View link below for react rules documentation // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules "rules": { // Prevent multiple component definition per file // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md "react/no-multi-comp": [2, { "ignoreStateless": true }], // Require ES6 class declarations over React.createClass // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md "react/prefer-es6-class": [2, "always"], // Require stateless functions when not using lifecycle methods, setState or ref // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md "react/prefer-stateless-function": 1, // Prevent missing props validation in a React component definition // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md "react/prop-types": [2, { "ignore": [], "customValidators": [] }], // Prevent direct mutation of this.state // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md "react/no-direct-mutation-state": 2, // Restrict file extensions that may contain JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md "react/jsx-filename-extension": 2, // Enforce PascalCase for user-defined JSX components // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md "react/jsx-pascal-case": 2, // specify whether double or single quotes should be used in JSX attributes // http://eslint.org/docs/rules/jsx-quotes "jsx-quotes": [2, "prefer-double"], // Enforce or disallow spaces inside of curly braces in JSX attributes // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md "react/jsx-curly-spacing": [2, "never", { "allowMultiline": true }], // enforce spacing around jsx equals signs // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md "react/jsx-equals-spacing": 2, // Enforce boolean attributes notation in JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md "react/jsx-boolean-value": [2, "never"], // Validate JSX has key prop when in array or iterator // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md "react/jsx-key": 2, // Prevent usage of unknown DOM property // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md "react/no-unknown-property": 2, // Prevent duplicate props in JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md "react/jsx-no-duplicate-props": 2, // Prevent missing parentheses around multilines JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md "react/jsx-wrap-multilines": [1, { "declaration": true, "assignment": true, "return": true }], // Prevent extra closing tags for components without children // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md "react/self-closing-comp": [2, {"html": false}], // Require render() methods to return something // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md "react/require-render-return": 2, // Enforce component methods order // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md "react/sort-comp": 1, // Prevent usage of deprecated methods // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md "react/no-deprecated": 2, // Prevent usage of setState in componentDidMount // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md "react/no-did-mount-set-state": [2, "disallow-in-func"], // Prevent usage of setState in componentDidUpdate // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md "react/no-did-update-set-state": [2, "disallow-in-func"], // Prevent missing React when using JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md "react/react-in-jsx-scope": 2, // Disallow undeclared variables in JSX // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md "react/jsx-no-undef": [2, {"allowGlobals": true}], // Prevent React to be incorrectly marked as unused // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md "react/jsx-uses-react": 2, // Prevent variables used in JSX to be incorrectly marked as unused // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md "react/jsx-uses-vars": 2, // Prevent usage of isMounted // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md "react/no-is-mounted": 2, // Prevent usage of the return value of React.render // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md "react/no-render-return-value": 2 }, "settings": { "react": { "pragma": "React", "version": "16" } } };