close

sort-imports

Unreleased

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'sort-imports': 'error',
    },
  },
]);

Rule Details

This rule enforces a consistent order for import declarations and for named members within an import declaration.

Examples of incorrect code for this rule:

import b from "b";
import a from "a";
import { z, a } from "values";

Examples of correct code for this rule:

import "setup";
import * as namespace from "namespace";
import { a, z } from "values";
import value from "value";

The declaration order can be customized with memberSyntaxSortOrder. ignoreCase, ignoreDeclarationSort, ignoreMemberSort, and allowSeparatedGroups provide the same controls as ESLint.

Original Documentation