Skip to content
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

Support eslint flat config #396

Open
peachest opened this issue Mar 21, 2024 · 4 comments
Open

Support eslint flat config #396

peachest opened this issue Mar 21, 2024 · 4 comments

Comments

@peachest
Copy link

Currently this project is not support eslint's new flat config feature. Is there any plan?

@KristjanTammekivi
Copy link

As a temporary solution the following seems to work:

import youDontNeedLodashUnderscorePlugin from 'eslint-plugin-you-dont-need-lodash-underscore';
import { fixupPluginRules } from '@eslint/compat';
        ...
        plugins: {
            'you-dont-need-lodash-underscore': fixupPluginRules(youDontNeedLodashUnderscorePlugin)
        },
        ...

@mickbut-ler
Copy link

@KristjanTammekivi does this work for you?

@KristjanTammekivi
Copy link

During testing months ago yes, but I haven't merged it yet because one specific rule in eslint-plugin-import still doesn't work

@jfairley
Copy link

What I'm about to say seems obvious now that I have my config properly set up, but when I first came across this issue, I misunderstood that the recommended config only registers the plugin but doesn't enable any rules.

To take the provided example one step further, here's a snippet from my config referencing the rules configs (in my case all-warn):

import { fixupPluginRules } from "@eslint/compat";
import youDontNeedLodashUnderscorePlugin from "eslint-plugin-you-dont-need-lodash-underscore";

export default [
  // ...
  {
    plugins: {
      "you-dont-need-lodash-underscore": fixupPluginRules(
        youDontNeedLodashUnderscorePlugin,
      ),
    },
    rules: {
      ...youDontNeedLodashUnderscorePlugin.configs["all-warn"].rules,
    },
  },
  // ...
];

Alternative to all-warn, there is also all, compatible, and compatible-warn, as can be seen in index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants