chiefmikey / eslint-plugin-disable-autofix

Disable autofix for ESLint rules without turning them off
https://www.npmjs.com/eslint-plugin-disable-autofix
MIT License
13 stars 7 forks source link

feat(src): limit plugin load #5

Open chiefmikey opened 2 years ago

chiefmikey commented 2 years ago

Pull rules from config Find ones prefixed with 'disable-autofix' If plugin scope exists, extract name and import etc. If no plugin scope, assume builtin and import etc. This solution should at least minimize packages being imported to just the ones with rules being disabled vs doing a full dir search.

Not sure about lazy loading to the rule level and pulling individual rule objects off packages without importing the entire thing.

chiefmikey commented 7 months ago

New flow: Read eslint config Pull plugin rules with disable-autofix/ and remove prefix Read node modules eslint plugins Match plugins to pulled config plugins and import Disable as usual

dominics commented 7 months ago

This would be a great improvement, it's a good idea

At the moment, I can't use the plugin on my monorepo, because it's using Yarn workspaces, with all the plugins from all the different eslint setups hoisted to the root. So, when the plugin reads node_modules/, it sees all the plugins I haven't got configured on this particular .eslintrc.cjs, and tries to load them. But then those fail to load because they require non-optional configuration.

chiefmikey commented 7 months ago

@dominics thanks for the feedback, that's a great use case to consider. This update should solve that issue and I will circle back with you after it's released to make sure.