Skip to content

linter: is import/import-no-namespace's ignore option working properly? #15007

@sebastienbarre

Description

@sebastienbarre

What version of Oxlint are you using?

latest

What command did you run?

Through VSCode's oxc 1.24.0 extension

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

No response

What happened?

One my TypeScript file has the following import:

import * as z from 'zod';

Another one has:

import type * as DrizzleKit from 'drizzle-kit/api';

Both lines are getting flagged by the import/import-no-namespace rule. This is a rule I'd like to use, but as far as Zod is concerned, importing the whole namespace is the recommended way.

Now instead of littering my code with // oxlint-disable-line import/no-namespace each time I use Zod (which seems to trigger Copilot too), I figured I would add an exception for that rule straight into my .oxlintrc.json.

The documentation confuses me though (besides ignore being spelled ignores in the example):

ignore: array of glob strings for modules that should be ignored by the rule :

{
  "ignore": ["*.json"]
}

I can't read Rust for the life of me, so I'm not sure what's going on with the ignore parameter, but this:

"import/no-namespace": ["warn", { "ignore": ["zod"] }],

will disable the rule for BOTH 'zod' and 'drizzle-kit/api', whereas it should only disable it for 'zod' and still warn me about the second one.

What kind of globbing is really performed here?

Thank you

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