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

Add support to new ESLint flat config #115

Open
Alex-Sokolov opened this issue Sep 1, 2023 · 10 comments
Open

Add support to new ESLint flat config #115

Alex-Sokolov opened this issue Sep 1, 2023 · 10 comments

Comments

@Alex-Sokolov
Copy link

Now eslint-nibble finished with error when trying to run with new flat config

"lint": "eslint-nibble --config eslint.config.js . --ext .js,.ts,.vue",

https://eslint.org/docs/latest/use/configure/configuration-files-new

@IanVS
Copy link
Owner

IanVS commented Sep 1, 2023

Thanks for the heads-up. I'll try to add support soon, but if anyone wants to submit a PR that would be excellent.

@kobizz
Copy link

kobizz commented Sep 19, 2024

@IanVS any updates?

@IanVS
Copy link
Owner

IanVS commented Sep 19, 2024

I haven't had time to dig into it so far. If anyone is interested, please feel free. Or, if you're willing to set up a reproduction repo that I can use as a starting point, that would also be helpful.

@johannes-lindgren
Copy link

johannes-lindgren commented Sep 23, 2024

To me, it seems like it doesn't work without the flat config. I have an .eslintrc.cjs file with .eslintignore, and get this error:

(node:14980) ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files

I'm on eslint v8.56.0

@ljharb
Copy link
Contributor

ljharb commented Sep 23, 2024

i mean, even in eslintrc, you should really be using ignorePatterns instead of an .eslintignore file - what happens if you make that change?

@johannes-lindgren
Copy link

johannes-lindgren commented Sep 23, 2024

@ljharb, I forgot to mention: it gave me another error:

throw new ESLintInvalidOptionsError(errors);
^

ESLintInvalidOptionsError: Invalid Options:

  • Unknown options: extensions
  • 'extensions' has been removed.

I don't have any extension option in my .eslintrc.cjs file, but perhaps it's somewhere in a plugin.

@ljharb
Copy link
Contributor

ljharb commented Sep 23, 2024

What plugins are you using? not all plugins are compatible yet with flat config.

@johannes-lindgren
Copy link

I disabled all plugins, yet I get the error.

In this package, I am not using a flat config, hence why I didn't really expect and error message around that. I am migrating gradually in a monorepo. eslint-nibble used to work though, and I don't think I changed anything in this workspace

@IanVS
Copy link
Owner

IanVS commented Sep 23, 2024

@johannes-lindgren eslint-nibble always sets extensions (until I have time to cut a new version, at least). I think it used to be required when interacting directly with the eslint API, but I could be wrong.

I don't think extensions support was removed until v9 though, so since you mention you've got a monorepo, I wonder if perhaps version 9 of eslint is being pulled in from somewhere. If you're sure it's broken with v8 and standard config files, please create a minimal reproduction so I can investigate.

@johannes-lindgren
Copy link

@IanVS thanks for the swift reply; I was just about to post that I managed to work around the issue, and I think it's exactly what you suggested. In ESLint v9, the flat config file is the default. Though I didn't use ESLint v9 anywhere in the monorepo, when running eslint-nibble with npx, it somehow seems to resolve ESLint to version 9 (that's my guess at least). If I declare eslint-nibble indevDependencies, it works as expected.

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

5 participants