Skip to content

removes the constructor when decorators are on #17584

Description

@y-nk

Hello (and happy new year),

I'm having a problem with oxlint auto-fix feature on class constructor linting.

The sample code is something like:

@injectable()
export class SomeRepository extends Repository<SomeModel> {
  constructor(@inject(SomeModel) model: SomeModel) {
    super(model)
  }
}

...for which running oxlint in fix mode removes the constructor entirely.

i do understand that a constructor with a single super() call is something which we could normally optimize (= 100% remove) but not here since it has a decorator used for dependency injection.

i think it's kind of an edge case, because i think people using DI are not the majority, therefore i think it could be a bug of a case not handled yet. i wish i could help but i don't master rust and i don't think proposing a claude PR would help (but i could be wrong and i'd be happy to try if you agreed to it)

please let me know what can be done 🙏

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions