Skip to content

linter: False positive of no-unused-private-class-members when the private member is used in spread #13628

@cnshenj

Description

@cnshenj

What version of Oxlint are you using?

1.14.0

What command did you run?

oxlint -c ../.oxlintrc.json --tsconfig ./tsconfig.json src

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

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "plugins": [
    "typescript",
    "import",
    "unicorn"
  ],
  "categories": {
    "correctness": "off"
  },
  "env": {
    "builtin": true
  },
  "rules": {
    "no-unused-private-class-members": "error"
  }
}

What happened?

This following is reported as an violation of no-unused-private-class-members, which is wrong:

class Foo { private #privateMember: MyType; private func(): MyType { return { ...this.#privateMember }; } }

Adding a simple console.log(this.#privateMember); to func will fix it, which means oxlint doesn't properly recognize { ...this.#privateMember } as usage. eslint doesn't have the false positive.

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