Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint for React #63

Open
xuya227939 opened this issue Jun 13, 2019 · 0 comments
Open

Eslint for React #63

xuya227939 opened this issue Jun 13, 2019 · 0 comments
Labels

Comments

@xuya227939
Copy link
Owner

xuya227939 commented Jun 13, 2019

React脚手架配置eslint

Install

npm install -g eslint

.eslintrc.json

{
    "extends": "eslint:recommended",
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true
    },
    "globals": {
        "$": true,
        "process": true,
        "__dirname": true
    },
    "parser": "babel-eslint",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true,
            "modules": true
        },
        "sourceType": "module",
        "ecmaVersion": 6
    },
    "plugins": [
        "react",
        "standard",
        "promise"
    ],
    "rules": {
        "quotes": [
            2,
            "single"
        ],
        "no-console": 0,
        "no-debugger": 1,
        "no-var": 2,
        "semi": 2,
        "no-irregular-whitespace": 0,
        "no-trailing-spaces": 0,
        "eol-last": 0,
        "no-unused-vars": [
            2,
            {
                "vars": "all",
                "args": "after-used"
            }
        ],
        "no-case-declarations": 0,
        "no-underscore-dangle": 0,
        "no-alert": 2,
        "no-lone-blocks": 0,
        "no-class-assign": 2,
        "no-cond-assign": 2,
        "no-const-assign": 2,
        "no-delete-var": 2,
        "no-dupe-keys": 0,
        "no-duplicate-case": 2,
        "no-dupe-args": 2,
        "no-empty": 2,
        "no-func-assign": 2,
        "no-invalid-this": 0,
        "no-redeclare": 2,
        "no-spaced-func": 2,
        "no-this-before-super": 0,
        "no-undef": 2,
        "no-return-assign": 0,
        "no-script-url": 2,
        "no-use-before-define": 2,
        "jsx-quotes": [
            2,
            "prefer-double"
        ],
        "react/display-name": 0,
        "react/forbid-prop-types": [
            2,
            {
                "forbid": [
                    "any"
                ]
            }
        ],
        "react/jsx-boolean-value": 0,
        "react/jsx-closing-bracket-location": 1,
        "react/jsx-curly-spacing": [
            2,
            {
                "when": "never",
                "children": true
            }
        ],
        "indent": ["error", 4, {"SwitchCase": 1}],
        "react/jsx-indent": ["error", 4],
        "react/jsx-key": 2,
        "react/jsx-no-bind": 0,
        "react/jsx-no-duplicate-props": 2,
        "react/jsx-no-literals": 0,
        "react/jsx-no-undef": 1,
        "react/jsx-pascal-case": 0,
        "react/jsx-sort-props": 0,
        "react/jsx-uses-react": 1,
        "react/jsx-uses-vars": 2,
        "react/no-danger": 0,
        "react/no-did-mount-set-state": 0,
        "react/no-did-update-set-state": 0,
        "react/no-direct-mutation-state": 2,
        "react/no-multi-comp": 0,
        "react/no-set-state": 0,
        "react/no-unknown-property": 2,
        "react/prefer-es6-class": 2,
        "react/prop-types": 0,
        "react/react-in-jsx-scope": 2,
        "react/self-closing-comp": 0,
        "react/sort-comp": 0,
        "no-extra-boolean-cast": 0,
        "react/no-array-index-key": 0,
        "react/no-deprecated": 1,
        "react/jsx-equals-spacing": 2,
        "no-unreachable": 1,
        "comma-dangle": 2,
        "no-mixed-spaces-and-tabs": 2,
        "prefer-arrow-callback": 0,
        "arrow-parens": 0,
        "arrow-spacing": 0,
        "camelcase": 0
    },
    "settings": {
        "import/ignore": [
            "node_modules"
        ],
        "react": {
            "version": "latest"
        }
    }
}
@xuya227939 xuya227939 added Technology 技术分享 React and removed Technology 技术分享 labels Jun 26, 2019
@xuya227939 xuya227939 changed the title eslint for react Eslint for React Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant