Skip to content

Inconsistent import/order behavior with Node v25 #3235

@Sekhmet

Description

@Sekhmet

I noticed change of import/order behavior since upgrading to Node v25.
What previously (on Node v24) was considered correct order of imports on Node v25 shows up as an error - this is already probably an issue, but main problem is that suggested autofix still fails, and it just keeps switching between two variants of broken code.

Source code

import ExecutionStrategyAbi from './abis/executionStrategy.json';
import { FullConfig } from './config';
import { handleVotingPowerValidationMetadata } from '../common/ipfs';
import L1AvatarExecutionStrategyAbi from './abis/l1/L1AvatarExectionStrategy';
import { Space } from '../../.checkpoint/models';

.eslintrc.json

{
  "extends": ["eslint:recommended", "plugin:import/recommended"],
  "rules": {
    "no-unused-vars": "off",
    "import/no-unresolved": "off",
    "import/order": [
      "error",
      {
        "groups": ["builtin", "external", "internal", "type"],
        "alphabetize": {
          "order": "asc",
          "caseInsensitive": true
        }
      }
    ]
  }
}

Result:

➜  eslint-plugin-import-node-25 git:(master) ✗ pnpm eslint file.js --fix

/Users/sekhmet/Workspace/eslint-plugin-import-node-25/file.js
  4:1  error  `./config` import should occur before import of `../common/ipfs`                  import/order
  5:1  error  `../../.checkpoint/models` import should occur before import of `../common/ipfs`  import/order

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

➜  eslint-plugin-import-node-25 git:(master) ✗ pnpm eslint file.js --fix

/Users/sekhmet/Workspace/eslint-plugin-import-node-25/file.js
  4:1  error  `./abis/l1/L1AvatarExectionStrategy` import should occur before import of `./config`  import/order
  5:1  error  `../../.checkpoint/models` import should occur before import of `../common/ipfs`      import/order

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

Reproducible demo

I created simple demo in this repository.

This repository runs lint on Node 22, Node 24, and Node 25 and it fails only on Node 25:

https://github.com/Sekhmet/eslint-plugin-import-node-25/actions/runs/22451365590

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions