Skip to content

linter: implicit .oxlintrc.json parse error uses default lint rules #12258

@simonbuchan

Description

@simonbuchan

What version of Oxlint are you using?

1.6.0

What command did you run?

oxlint

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

see below

What happened?

Given a simple input:

var x = 123

and a valid .oxlintrc.json that disables the unused lint:

{
  "plugins": ["eslint"],
  "rules": {
    "no-unused-vars": "off"
  }
}

you get the expected clean output:

Found 0 warnings and 0 errors.
Finished in 5ms on 2 files using 16 threads

But with a syntax error in the config file (note missing comma after plugins array):

{
  "plugins": ["eslint"]
  "rules": {
    "no-unused-vars": "off"
  }
}

You get the default config:

  ⚠ eslint(no-unused-vars): Variable 'x' is declared but never used. Unused variables should start with a '_'.
   ╭─[test.ts:1:5]
 1 │ var x = 123
   ·     ┬
   ·     ╰── 'x' is declared here
   ╰────
  help: Consider removing this declaration.

Found 1 warning and 0 errors.
Finished in 5ms on 2 files with 87 rules using 16 threads.

I'd expect the output to immediately fail with an "invalid config file" type error, rather than falling back to a default config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions