import-js / import-js/eslint-plugin-import

import order rule not working

Open
#3,134 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

import jsPlugin from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import jsx11yPlugin from "eslint-plugin-jsx-a11y";
import prettierPluginRecommended from "eslint-plugin-prettier/recommended";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import reactRefreshPlugin from "eslint-plugin-react-refresh";
import eslintConfigPrettier from "eslint-config-prettier";
import { includeIgnoreFile } from "@eslint/compat";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

/** @type { import("eslint").Linter.Config[] } */
export default [
  includeIgnoreFile(gitignorePath),
  jsPlugin.configs.recommended,
  importPlugin.flatConfigs.recommended,
  importPlugin.flatConfigs.typescript,
  jsx11yPlugin.flatConfigs.recommended,
  reactPlugin.configs.flat.recommended,
  eslintConfigPrettier,
  //! make prettierPlugin the last plugin to override previous rules.
  prettierPluginRecommended,
  {
    plugins: {
      "react-hooks": reactHooksPlugin.configs.recommended,
      "react-refresh": reactRefreshPlugin,
    },
    rules: {
      "import/order": [
        "error",
        {
          groups: [
            "builtin",
            "external",
            "internal",
            "parent",
            "sibling",
            "index",
            "object",
            "type",
          ],
          "newlines-between": "always",
        },
      ],
    },
    settings: {
    "import/resolver": {
      "typescript": true,
      "node": true,
    },
  },
    ignores: ["eslint.config.js", "commitlint.config.js"],
  },
];

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied eslint.config.js configuration and checking the import/order rule against the listed imports. No repository files or tests are named, so inspect the rule implementation and existing rule tests to determine why the configured ordering is not reported; done means the intended ordering is enforced by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.