close

prefer-identifier-import-export-specifiers

Unreleased

Configuration

PresetConfigured Value
✅ unicornPlugin.configs.recommended"error"
rslint.config.ts
import { defineConfig, unicornPlugin } from '@rslint/core';

export default defineConfig([
  unicornPlugin.configs.recommended,
  {
    rules: {
      'unicorn/prefer-identifier-import-export-specifiers': 'error',
    },
  },
]);

Rule Details

Prefer identifier names over quoted strings in import/export specifiers and import attributes when the decoded string is a valid JavaScript identifier name.

Reserved words are valid module names and attribute keys. Strings containing spaces, punctuation, or invalid identifier characters remain quoted. Fixes preserve the spacing needed around neighboring keywords.

Examples of incorrect code:

import {"name" as local} from "module";

Examples of correct code:

import {name as local} from "module";

Options

This rule has no options. It is enabled at error severity in unicornPlugin.configs.recommended.

Original Documentation