Skip to content

linter: importing css files (common with vite projects) triggers no-unassigned-import #11629

@KieranP

Description

@KieranP

What version of Oxlint are you using?

1.1.0

What command did you run?

oxlint

What does your .oxlintrc.json config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "ignorePatterns": ["/node_modules", "/dist"],
  "plugins": ["eslint", "oxc", "typescript", "import", "promise", "unicorn"],
  "categories": {
    "correctness": "error",
    "suspicious": "error",
    "perf": "error"
  },
  "env": {
    "builtin": true,
    "browser": true
  }
}

What happened?

no-unassigned-import doesn't let an import occur without assigning to something.

Which makes sense for JS/TS/JSON etc files, but for CSS, this isn't the case.

When importing CSS files, vite will put them into a compiled stylesheet.

But oxlint is picking them up with the no-unassigned-import rule

  × eslint-plugin-import(no-unassigned-import): Imported module should be assigned
   ╭─[src/main.ts:1:1]
 1 │ import './reset.css'
   · ────────────────────
 2 │ import './global.css'
   ╰────
  help: Consider assigning the import to a variable or removing it if it's unused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions