jsx-ast-utils
jsx-ast-utils copied to clipboard
The prop value with an expression type of `TSPrivateIdentifier` could not be resolved.
I'm seeing some logging related to TSPrivateIdentifier
while testing eslint-plugin-jsx-a11y
.
https://github.com/AriPerkkio/eslint-remote-tester/actions/workflows/lint-eslint-plugin-jsx-a11y.yml
2021-09-09T05:45:12.5777054Z The prop value with an expression type of TSPrivateIdentifier could not be resolved. Please file issue to get this fixed immediately.
2021-09-09T05:45:13.4113986Z The prop value with an expression type of TSPrivateIdentifier could not be resolved. Please file issue to get this fixed immediately.
Minimal repro:
import React from "react";
export class MyLink extends React.Component {
#urls = { submit: "/submit" };
render() {
return <a href={this.#urls.submit}>Submit</a>;
}
}
{
"root": true,
"env": {
"es6": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "16.13.1"
}
},
"extends": ["plugin:jsx-a11y/recommended"]
}
{
"scripts": {
"lint": "eslint index.tsx"
},
"devDependencies": {
"@typescript-eslint/parser": "^4.31.1",
"eslint": "7.32.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "7.21.5",
"react": "16",
"typescript": "^4.4.3"
}
}
oof, why would they use a different node type for a standard thing? thanks, i'll take a look
Unfortunately this repo doesn't have any TS testing yet, so I'm not sure how easy it'll be to reproduce.
Seems like maybe the TS eslint parser doesn't yet support class private fields? https://github.com/typescript-eslint/typescript-eslint/issues/1666 cc @bradzacher
The implication is that it shouldn't work until v5 is released (eslint's default parser won't support it until eslint v8)
Yup - v5 of ts-eslint will support it fully, but that won't be released until ESLint v8 releases (as we're waiting until all of the v8 breaking changes have settled so we don't have to do multiple majors).
Also (as you mentioned) ESLint v8 will also come with support private fields.
Relevant issue is typescript-eslint/typescript-eslint#3430
Same here, but without "TS":
The prop value with an expression type of PrivateIdentifier could not be resolved.