Closed AkatQuas closed 2 years ago
https://github.com/bryanrsmith/eslint-plugin-sort-class-members/blob/aa1c1f3e896fe39dc730311c5da3a6c551e82935/src/rules/sort-class-members.js#L171
I have a class statement like
class { private _a = () => {} }
However, the AST show _a has a field accessibility: 'private' other than PrivateName in its key.type.
_a
accessibility: 'private'
PrivateName
key.type
So what's the difference ?
Is there any issue with the parser ? I'm using @typescript-eslint/parser now.
@typescript-eslint/parser
I have a small test project for JavaScript files.
It turns out the type for private property #b is PrivateIdentifier.
#b
PrivateIdentifier
So, where does PrivateName come from?
Never mind.
I realize the issue with the parser . So I use the @babel/eslint-parser to check the type.
@babel/eslint-parser
Maybe the RFC has update.
https://github.com/babel/babel/blob/2e2d202694df8ec485ac2bae79e5258b9e552fd9/packages/babel-parser/src/plugins/estree.js#L194-L203
babel parser has convert PrivateName to PrivateIdentifier .
https://github.com/bryanrsmith/eslint-plugin-sort-class-members/blob/aa1c1f3e896fe39dc730311c5da3a6c551e82935/src/rules/sort-class-members.js#L171
I have a class statement like
However, the AST show
_a
has a fieldaccessibility: 'private'
other thanPrivateName
in itskey.type
.So what's the difference ?
Is there any issue with the parser ? I'm using
@typescript-eslint/parser
now.I have a small test project for JavaScript files.
It turns out the type for private property
#b
isPrivateIdentifier
.So, where does
PrivateName
come from?