Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: wrong ImportAttribute#parent type #10254

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
4 tasks done
ota-meshi opened this issue Oct 31, 2024 · 0 comments · Fixed by #10258
Closed
4 tasks done

Bug: wrong ImportAttribute#parent type #10254

ota-meshi opened this issue Oct 31, 2024 · 0 comments · Fixed by #10258
Labels
accepting prs Go ahead, send a pull request that resolves this issue AST PRs and Issues about the AST structure bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

Comments

@ota-meshi
Copy link
Contributor

ota-meshi commented Oct 31, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

ast-spec

Playground Link

https://typescript-eslint.io/play/#ts=5.4.3&showAST=es&fileType=.tsx&code=JYWwDg9gTgLgBAQzgMyhEcDkA6A9AzOAd2BgAs4BvGATzAFMAuLAKwGcIA7TAXwG4AUPQAekWFTgAjODxRoMOXJMIlyVWg2aZ2XXoJFj4AKjnoseAMYrSFanSasO3fgNCGAFIoAmmADQTVMmZKOA0HbSdCWR4ASkEgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

Looking at the source code, the types are currently defined as follows:

  interface ImportAttribute {
    parent: TSESTree.ImportDeclaration | TSESTree.ImportExpression;
  }

parent: TSESTree.ImportDeclaration | TSESTree.ImportExpression;

However, I think the correct way to follow ESTree is as follows:

  interface ImportAttribute {
-    parent: TSESTree.ImportDeclaration | TSESTree.ImportExpression;
+    parent: TSESTree.ImportDeclaration | TSESTree. ExportNamedDeclaration | TSESTree. ExportAllDeclaration;
  }

https://github.com/estree/estree/blob/master/es2025.md

What do you think?

ESLint Config

module.exports = {
  /* This is not necessary. */
};

tsconfig

{
  "compilerOptions": {
    // This is not necessary.
  }
}

Expected Result

I think ImportAttribute#parent needs to be TSESTree.ImportDeclaration | TSESTree. ExportNamedDeclaration | TSESTree. ExportAllDeclaration.

Actual Result

Currently, ImportAttribute#parent is TSESTree.ImportDeclaration | TSESTree.ImportExpression, but I think this is wrong.

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 8.12.2
@typescript-eslint/parser 8.12.2
@typescript-eslint/rule-tester 8.12.2
@typescript-eslint/scope-manager 8.12.2
@typescript-eslint/typescript-estree 8.12.2
@typescript-eslint/type-utils 8.12.2
@typescript-eslint/utils 8.12.2
TypeScript 5.6.2
ESLint 9.3.0
node 22.4.1
@ota-meshi ota-meshi added bug Something isn't working triage Waiting for team members to take a look labels Oct 31, 2024
@Josh-Cena Josh-Cena added AST PRs and Issues about the AST structure accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Nov 1, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Nov 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue AST PRs and Issues about the AST structure bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants