mysticatea / eslint-plugin-eslint-comments

Additional ESLint rules for directive comments of ESLint.
https://mysticatea.github.io/eslint-plugin-eslint-comments/
MIT License
354 stars 44 forks source link

Add option "excludePaths" to "no-unlimited-disable" rule #36

Closed jaroslav-kubicek closed 4 years ago

jaroslav-kubicek commented 4 years ago

Hello! 👋

Thanks for this awesome plugin. We use most of the rules except no-unlimited-disable - we had to disable it as our application contains autogenerated javascript files - this is relevant mostly to all apps which use relay client for GraphQL server - see example here of such file: https://github.com/adeira/relay-example/blob/master/src/LocalForm/__generated__/LocalFormQuery.graphql.js#L6

For that reason, I got an idea we could still turn on no-unlimited-disable while excluding these autogenerated files, what do you think?

bmish commented 4 years ago

ESLint already supports per-directory overrides:

// .eslintrc.js
module.exports = {
  ...
  overrides: [
    {
      files: ['__generated__/**/*.js'],
      rules: {
        'eslint-comments/no-unlimited-disable': 'off'
      }
    },
  ]
}

Or equivalently, you could add an .eslintrc.js inside the __generated__ folder to turn off the rule.

jaroslav-kubicek commented 4 years ago

Alright, perfect! I haven't noticed, TIL 💯