Skip to content

[consistent-type-definitions] invalid fixer for declare type #4333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
armano2 opened this issue Dec 20, 2021 · 0 comments · Fixed by #4334
Closed

[consistent-type-definitions] invalid fixer for declare type #4333

armano2 opened this issue Dec 20, 2021 · 0 comments · Fixed by #4334
Assignees
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@armano2
Copy link
Collaborator

armano2 commented Dec 20, 2021

Fixer incorrectly changes declare keyword to interface

issue is present for type and interface options and its related to sourceCode.getFirstToken(node);

Repro

Playground

Code

export declare type LocalStorageOption = {
  blurb: string;
  flag: string;
};

Eslint config

{
  "rules": {
    "@typescript-eslint/consistent-type-definitions": "error"
  }
}

Expected Result

export declare interface LocalStorageOption {
  blurb: string;
  flag: string;
};

Actual Result

export interface type LocalStorageOption {
  blurb: string;
  flag: string;
};

Versions

package version
@typescript-eslint/eslint-plugin 5.8.0
@typescript-eslint/parser 5.8.0
TypeScript 4.5.2
ESLint 8.1.0
Env web
@armano2 armano2 added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin accepting prs Go ahead, send a pull request that resolves this issue and removed accepting prs Go ahead, send a pull request that resolves this issue labels Dec 20, 2021
@armano2 armano2 self-assigned this Dec 20, 2021
@armano2 armano2 added the has pr there is a PR raised to close this label Dec 20, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
1 participant