Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Eslint: use only on rule from plugin

I want to use a rule from an eslint plugin.
I want this to be the only rule to be used from that plugin. In my concrete case it’s about eslint-plugin-import and the ‘import/named’ rule. How can I achieve this with the minimum amount of custom config?
In my eslintrc I have

{
  extends: ['plugin:import/errors'],
  plugins: ['import'],
  rules: { 'import/named': 2 },
  // ... other settings
}

I know I could manually add 'import/no-unresolved': 0 and all the other rules from the plugin to the rules section but it would be nice to have an easier solution.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You are extending rules from the plugin with the extends setting. Just skip that part. To have no predefined rules, just add the plugin to the plugins array and define the rule(s) by yourself:

{
  plugins: ['import'],
  rules: { 'import/named': 2 },
  // ... other settings
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading