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

Conversation

Projects
None yet
3 participants
@scottnonnenberg
Contributor

scottnonnenberg commented May 28, 2016

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

This comment has been minimized.

Show comment
Hide comment
@jfmengels

jfmengels Jun 20, 2016

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

jfmengels commented Jun 20, 2016

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

@scottnonnenberg

This comment has been minimized.

Show comment
Hide comment
@scottnonnenberg

scottnonnenberg Jun 20, 2016

Contributor

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

Contributor

scottnonnenberg commented Jun 20, 2016

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

This comment has been minimized.

Show comment
Hide comment
@jfmengels

jfmengels 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 :)

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 :)

@jhusain jhusain merged commit 6a05764 into jhusain:master Jan 29, 2018

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