xojs/xo

Unable to satisfy `xo`

fisker opened this issue · 5 comments

fisker commented
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

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 commented

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?

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

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

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.