Comments (14)
@MichaelDeBoey the airbnb config defines every single rule in eslint core, eslint-plugin-import, eslint-plugin-react, and eslint-plugin-jsx-a11y. It's a one-time cost that eslint-find-rules helps keep up to date with minimal incremental effort.
In your case, you could easily define them once in a JS object, and then add that object in two places: the root, off; and overrides, as "error".
from eslint-find-rules.
Hi @ljharb 👋 It's been a while! Hope you're doing awesome.
Are you opposed to someone adding support for this? Seems like what you're suggesting is more of a workaround than a desirable "feature" 🙃
from eslint-find-rules.
@kentcdodds to be specific, it seems like what you're asking is for --unused
to also check for the presence of rules in overrides
?
Based on the existence of --include=deprecated
, it seems reasonable to allow for providing something like --consider=overrides
, but I'd still encourage you to define every rule for every file, to comply with the spirit of the "unused" check.
from eslint-find-rules.
A new use-case we have on eslint-config-kentcdodds
is wanting to enable all Jest related rules only for testing files (as can be seen in kentcdodds/eslint-config-kentcdodds#98).
Enabling all the rules in the root just to make our tests happy isn't the preferred way, so this feature could benefit us a lot.
@leepowelldev Do you have the time to create a PR with working version of this or should we look into it ourselves?
from eslint-find-rules.
My workaround is to define high-level configurations (containing overrides
) and move all plugin rules into separate files:
root
- config-all.js
- react.js
- nodejs.js
- plugins
- base.js
- jest.js
- typescript.js
So while react.js
uses overrides
to apply typescript
rules only to TS(X) files, there's a special config file config-all.js that contains all rules without overrides
:
module.exports = {
extends: [
"../plugins/base.js",
"../plugins/jest.js",
"../plugins/typescript.js",
],
plugins: ["@typescript-eslint"],
};
When checking config-all.js
, eslint-find-rules
will now check all referenced plugins/rules.
from eslint-find-rules.
The intention is generally for all rules to be defined for every file; in your case, you could define them all at the root, and only enable them in the overrides?
from eslint-find-rules.
@ljharb That would be really cumbersome to duplicate all rules.
1 time for just having it there (disabled) and make eslint-find-rules
happy and 1 time to enable them.
For now it's only for @typescript-eslint rules, but this can become more in the future.
Like I said: I'm happy to implement it myself if you could point me in the right direction. 🙂
from eslint-find-rules.
That makes sense :) I'd definitely use a --consider=overrides
flag and I'm ok with that being an opt-in thing personally :)
from eslint-find-rules.
@ljharb Could you point me into the right direction please?
I'd love to work on this.
from eslint-find-rules.
I'm not entirely sure :-) i'd start with tests tho
from eslint-find-rules.
@MichaelDeBoey did you ever figure this out?
from eslint-find-rules.
@saiichihashimoto I never had the time to look into this.
If you want to, be my guest! 🙂
from eslint-find-rules.
I spent some time on this today, and have it working - ESLint v7 added better support for merging in override rules when building the config. The downside is it would require v7 as the lowest peer dependency to support as CLIEngine is now deprecated. Also it doesn't seem to pickup any plugins that are defined in an overrides
block - not sure if this is expected behaviour of ESLint.
from eslint-find-rules.
@darekkay This comes down to the same proposal @ljharb did, which is not really preferred in our use-case.
Thanks for the proposal though! 👊
from eslint-find-rules.
Related Issues (20)
- print as list HOT 2
- Scoped plugin error HOT 4
- eslint v6 support HOT 15
- Security warning for "mem" HOT 12
- Doesn't find unused rules in @typescript-eslint/eslint-plugin HOT 4
- eslint v7 support
- Handle typescript-eslint configuration HOT 1
- git clone error on windows HOT 6
- I'm not sure how to deal with renamed rule in ESLint 7.4.0 HOT 7
- Find unused plugin rules
- CHANGELOG missing HOT 3
- Breaks with ESLint 7.8.0 HOT 4
- Update dependencies HOT 5
- Support ESLint 8.x HOT 2
- Add support to the `rule.meta.docs.url` property to get URLs in verbose mode
- Rules in the "rules" json key are not being considered HOT 1
- No Option Provided with `--option` described in docs HOT 1
- Not able to save output as single column HOT 1
- bump `cliui` to resolve `ansi-regex` ReDoS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-find-rules.