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

Add exception support to no-mutation rule #15

Merged
merged 2 commits into from
Jan 29, 2018
Merged

Add exception support to no-mutation rule #15

merged 2 commits into from
Jan 29, 2018

Conversation

scottnonnenberg
Copy link
Contributor

By adding a { object: 'module', property: 'exports' } exception, fixes #6.
By adding a { property: 'propTypes' } exception, fixes #14.

You can now provide an exceptions array in the options for no-mutation in your eslint config:

{
  'no-mutation': ['error', {
    exceptions: [{
      object: 'module',
      property: 'exports',
    }]
  }]
}

Also adds tests with 100% code coverage to the project. :0)

@jfmengels
Copy link

Seeing as there is no maintenance of the plugin, I've written my own that has this exception system.

@scottnonnenberg
Copy link
Contributor Author

I've also got a plugin available with these exceptions. :0) It has a little bit of extra code to special-case 'this', which you might want to pull into your plugin as well: https://github.com/scottnonnenberg/eslint-plugin-thehelp/blob/master/src/rules/no_mutation.js

@jfmengels
Copy link

jfmengels commented Jun 20, 2016

Hmm... Yeah. For an app written in a FP way, the use this is strongly discouraged, but for a React app, it might be useful. I'll add the exception behind a flag, good idea. Thanks :)

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

Successfully merging this pull request may close these issues.

React stateless components: propTypes conflicts with no-mutation not compatible with commonjs
3 participants