Skip to main content
Skip to Content
interlace
Plugin: import-nextRules

imports-first

`imports-first` is the old name of `first`.

Next step

imports-first ships in eslint-plugin-import-next, with 13 of its 59 rules in the recommended preset.

Install
npm install -D eslint-plugin-import-next
eslint.config.js
import { configs } from 'eslint-plugin-import-next';

export default [configs.recommended];

Plugin pagenpmSource on GitHub

❌ This rule is deprecated. It was replaced by first.

imports-first is the old name of first. eslint-plugin-import 2.32.0 still exports it, deprecated, as first with a deprecated meta; this plugin does the same. It reports what first reports, for the same options. Use first in new configs.

Rule Details

AspectDetails
StatusDeprecated (meta.deprecated: true), replaced by first
ReportsExactly what first reports, with the same options
In presetsNo preset enables it
OptionsThe same as first: "absolute-first" or "disable-absolute-first"

Why it exists

A config that registers this plugin under the import key and names import/imports-first, or a // eslint-disable-next-line import/imports-first comment, would otherwise stop ESLint with "Could not find rule". With this entry it loads and behaves as first.

Configuration

// eslint.config.js
import importNext from 'eslint-plugin-import-next';

export default [
  {
    plugins: { 'import-next': importNext },
    rules: { 'import-next/imports-first': 'error' },
  },
];

Prefer the replacement:

rules: { 'import-next/first': 'error' }

Further Reading

Use this rule

npm install -D eslint-plugin-import-next
eslint.config.js
import importNext from 'eslint-plugin-import-next';export default [  {    plugins: { 'import-next': importNext },    rules: {      'import-next/imports-first': 'error'    },  },];
npm install -D oxlint-plugin-import-next
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-import-next"],  "rules": {    "import-next/imports-first": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-import-next'],    rules: {      'import-next/imports-first': 'error',    },  },});

oxlint-plugin-import-next re-exports eslint-plugin-import-next/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.