Skip to content

no-duplicate-at-import-rules

Reports an @import that repeats an earlier one in the same file (same url, same media list; 'a.css' and url(a.css) are the same url).

The second import is wasted: the browser fetches the file once, and the stylesheet is still parsed twice in some engines. It also hides which of the two position in the cascade is meant.

To fix, delete the repeat.

Reported
@charset "utf-8";
@import "a.css";
@import url(a.css);
@import "a.css" screen;
@layer base;
@import "b.css";
...
css:
lint:
rules:
no-duplicate-at-import-rules: warn # off (default), warn, error
less:
lint:
rules:
no-duplicate-at-import-rules: warn # off (default), warn, error
scss:
lint:
rules:
no-duplicate-at-import-rules: warn # off (default), warn, error

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line no-duplicate-at-import-rules in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint no-duplicate-at-import-rules full