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

Regression: plugin cannot be required in v4.1.1 because of extra default in CommonJS #94

Closed
abrahamguo opened this issue Aug 8, 2024 · 3 comments

Comments

@abrahamguo
Copy link
Contributor

abrahamguo commented Aug 8, 2024

Given require('eslint-plugin-unused-imports'), in v4.0.1, this was returned:

{
  meta: {},
  configs: {},
  rules: {
    'no-unused-vars': { create: [Function: create], schema: undefined, meta: [Object] },
    'no-unused-imports': { create: [Function: create], schema: undefined, meta: [Object] }
  },
  processors: {}
}

However, in v4.1.1, this is returned:

{
  default: {
    meta: { name: 'unused-imports' },
    rules: { 'no-unused-vars': [Object], 'no-unused-imports': [Object] }
  }
}

This means that v4.1.1 cannot be used with ESLint 8 classic config (whereas v4.0.1 could), because classic config uses require() behind the scenes to pull in plugins.
As a result of this, when using v4.1.1 with ESLint classic config, ESLint reports

  1:1  error  Definition for rule 'unused-imports/no-unused-imports' was not found  unused-imports/no-unused-imports
  1:1  error  Definition for rule 'unused-imports/no-unused-vars' was not found     unused-imports/no-unused-vars

I believe this is an unintentional breaking change for a semver-minor release.

@Pito1992
Copy link

Pito1992 commented Aug 9, 2024

Oh my god, have installed it in a couple of minutes and found this issue. I temporarily fixed it by changing the eslint extension to json.

@yunsii
Copy link

yunsii commented Aug 10, 2024

576c770 v4.1.3 is still not released 😂

@antfu
Copy link
Collaborator

antfu commented Aug 10, 2024

AH, sorry, my bad. Just released.

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