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

Create "eslint-plugin-react:recommended" for use with eslint's new "extends" property. #192

Closed
jimbolla opened this issue Aug 19, 2015 · 3 comments

Comments

@jimbolla
Copy link

A recently added feature of eslint is extends. It would be useful if eslint-plugin-react created their own preset so that one could do this:

{
    "extends": [ "eslint:recommended", "eslint-plugin-react:recommended" ],
}

This would eliminate the need to add all the react rules explicitly.

@bbirand
Copy link

bbirand commented Aug 20, 2015

👍

@yannickcr
Copy link
Member

Good idea 👍

@jimbolla
Copy link
Author

Digging through the eslint source code, I found this line where it seems to resolve that alias. It looks like right now, that functionality is hardcoded to that one name, with no obvious way of adding your own aliases. I'm guessing in v1, use of this feature would look something like:

{
    "extends": [ "eslint:recommended", "node_modules/eslint-plugin-react/conf/recommended.json" ],
}

And then conf/recommended.json would be something like:

{
    "ecmaFeatures": {
        "jsx": true,
    },
    "rules": {
        "react/display-name": 1,
        "react/jsx-boolean-value": 1,
        "react/jsx-curly-spacing": 1,
        "react/jsx-max-props-per-line": 1,
        "react/jsx-indent-props": 1,
        "react/jsx-no-duplicate-props": 1,
        "react/jsx-no-undef": 1,
        "react/jsx-quotes": 1,
        "react/jsx-sort-prop-types": 1,
        "react/jsx-sort-props": 1,
        "react/jsx-uses-react": 1,
        "react/jsx-uses-vars": 1,
        "react/no-danger": 1,
        "react/no-did-mount-set-state": 1,
        "react/no-did-update-set-state": 1,
        "react/no-multi-comp": 1,
        "react/no-unknown-property": 1,
        "react/prop-types": 1,
        "react/react-in-jsx-scope": 1,
        "react/require-extension": 1,
        "react/self-closing-comp": 1,
        "react/sort-comp": 1,
        "react/wrap-multilines": 1
    }
}

... or whatever is decided to be the "recommended" rules to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants