-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 note(s) to docs about flat configs and/or no-unused-modules' unusedExports
not being supported in flat configs
#2964
Comments
Given that eslint's FlatCompat allows people to use this plugin before it actually supports flat config, I agree adding a note in the readme (linked to from the no-unused-modules docs) here would be good. |
I'm not using the Of all the plugins & rules I'm using,
My next step is trying to exclude this rule somehow from bundling. |
I’m not sure why you’d ever want to bundle an eslint config - and either way, this plugin requires everything to exist on disk to work properly, so it’s not going to work with that approach. |
I'm trying to create a zero dependency ESLint config, which hopefully speeds up ESLint's running time significantly. As far as I can tell, the paths that node-resolve complains about don't exist?! |
That seems like a really bizarre way to solve it; I'd suggest using jest-eslint-runner instead, it does the job without violating the expectations of basically every package. It seems like the error is coming from your rollup setup - the paths don't necessarily exist, which is why they're being conditionally required in the first place. |
For anyone else landing here looking for a solution, here's my const pluginImport = require('eslint-plugin-import');
module.exports = [
{
plugins: {
import: { rules: pluginImport.rules },
},
rules: {
'import/order': 'error',
'import/group-exports': 'error',
'import/exports-last': 'error',
},
},
// ... all your other other configurations
]; |
@lgenzelis that doesn't solve the problem, as trying to use
@ljharb any idea how to get this working with the compat? I've been trying various approaches (both with At this point I don't care how ugly my config gets as long as I can get this rule enabled 😭 |
is |
I think for most users of this plugin it's not immediately obvious that flat configs are not or only partially supported. See for example the mentions of this issue in various commits, PRs and issues: #2556.
If I understand correctly after going through some of the issues here, the flat config format in general is not "officially" supported by this plugin, however it's not clear to me what exactly breaks and what not. I only found this (which aims to add support but doesn't have a lot of information) and this comment here:
In my opinion it should be made clear somewhere in the readme what "we do not support flat config" actually means. For me personally at least everything except for setting
unusedExports
totrue
inno-unused-modules
"works" though.Which brings me to the main point of this issue: Can we document this fact in https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md? Especially because both the "In the future, these options will be enabled by default (see #1324)" and the example below might encourage readers to set
unusedExports
totrue
. Maybe a link to #2907 should be included.The text was updated successfully, but these errors were encountered: