Skip to main content

no-at-sign-import

Disallow importing exactly from "@".

Targeted pattern scopeโ€‹

This rule inspects module source strings in imports/exports and reports sources that match "@" exactly.

What this rule reportsโ€‹

This rule reports source strings that are exactly "@". It is useful when @ is a namespace root marker and should not be imported as a module by itself.

Why this rule existsโ€‹

When @ is used as a path alias prefix, importing the bare root can be invalid or ambiguous. This rule blocks that bare specifier.

โŒ Incorrectโ€‹

import value from "@";

โœ… Correctโ€‹

import value from "@/feature";

Behavior and migration notesโ€‹

This rule reports only and does not provide an autofix.

Typical migration is replacing "@" with a concrete module path like "@/feature".

Optionsโ€‹

type Options = {
allow?: string[];
disallow?: string[];
};

Default:

{
"disallow": ["@"]
}

Additional examplesโ€‹

export { value } from "@";
// โŒ reported

export { value } from "@/core/value";
// โœ… valid

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-at-sign-import": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your tooling resolves "@" as a valid direct module import.

Package documentationโ€‹

Rule catalog ID: R017

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.