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

Unable to satisfy xo #713

Closed
fisker opened this issue Apr 7, 2023 · 5 comments · Fixed by #714
Closed

Unable to satisfy xo #713

fisker opened this issue Apr 7, 2023 · 5 comments · Fixed by #714

Comments

@fisker
Copy link
Contributor

fisker commented Apr 7, 2023

import {createRequire} from 'node:module';

const require = createRequire(import.meta.url);
const packageJson = require('../../package.json');
×   1:1   There should be no empty line between import groups  import/order
import {createRequire} from 'node:module';
const require = createRequire(import.meta.url);
const packageJson = require('../../package.json');
×   1:1   Expected 1 empty line after import statement not followed by another import.  import/newline-after-import
@sindresorhus
Copy link
Member

This is really a eslint-plugin-import rule bug. It should not apply to a created require. I don't see any way of resolving this other than disabling one of the rules.

@fisker
Copy link
Contributor Author

fisker commented Apr 7, 2023

I was going to report to eslint-plugin-import at fire. Then I realized they are different rules. Not sure what to do. Maybe use eslint-plugin-simple-import-sort to replace import/order?

@Primajin
Copy link
Contributor

Primajin commented Apr 7, 2023

The same issue occurs to me after the upgrade from 0.53.1 to 0.54.

https://github.com/Primajin/eyesbound/actions/runs/4618195244/jobs/8165338365?pr=520

So could it be that something was changed about the rule setting?

https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#groups-array

Because when I add this:

      "import/order": [
        "error",
        {
          "groups": [
            "builtin",
            "external",
            "parent",
            "sibling",
            "index"
          ]
        }
      ],

to my package I don't get any more issues.

See: https://github.com/Primajin/eyesbound/actions/runs/4639759677/jobs/8210970043?pr=520
Primajin/eyesbound@fc3f7b2

Primajin added a commit to Primajin/xo that referenced this issue Apr 7, 2023
Primajin added a commit to Primajin/xo that referenced this issue Apr 7, 2023
sindresorhus pushed a commit that referenced this issue Apr 11, 2023
@Primajin
Copy link
Contributor

Hmm I wonder though, do we also maybe need to add this to https://github.com/xojs/eslint-config-xo ? 🤔

@sindresorhus
Copy link
Member

Hmm I wonder though, do we also maybe need to add this to https://github.com/xojs/eslint-config-xo ? 🤔

No. It does not define any import rules.

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

Successfully merging a pull request may close this issue.

3 participants