Skip to content

Bug: Visitor keys for ExportSpecifier are not in source code order #655

@overlookmotel

Description

@overlookmotel

Which packages are affected?

  • espree
  • eslint-scope
  • eslint-visitor-keys

Environment

Node version: 24.1.0
npm version: 11.3.0
ESLint version: 9.28.0
Operating System: Mac OS 15.4.1

What did you do?

As far as I can see, it's not documented anywhere that visitor keys are always in source code order. However, in my opinion it's what a user would naturally expect, and this expectation seems to be confirmed because it's true for every single AST node type... With only one exception: ExportSpecifier.

export { local as exported };

In this case, exported is visited before local:

ExportSpecifier: [
"exported",
"local"
],

I have opened this issue as a bug report as I assume that this deviation from "visit in source code order" rule is an oversight rather than intentional. But there may be some context I am missing.

What did you expect to happen?

local to be visited before exported.

What actually happened?

exported is visited before local (more like ImportSpecifier).

Link to Minimal Reproducible Example

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy