Parsing error: Unexpected character '#' (ES11)
See original GitHub issueWith this source code on VSCode:
class P {
#p = 0;
ppp() {
return this.#p;
}
}
It does detect an error that shouldn’t be so in ES11:
Parsing error: Unexpected character '#'
My .eslintrc.json
is:
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es2020": true
//"es6": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 11
},
"rules": {
}
}
I have eslint installed globabally:
$ eslint --version
v6.8.0
$ node --version
v13.11.0
$ npm --version
6.14.4
VSCODE Version: 1.43.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
eslint - Parsing error: Unexpected character '#' while declaring ...
When using '#' to declare a private member in a javascript class, eslint throws an error Parsing error: Unexpected character '#' .
Read more >Please help me fix this error Parse error - WordPress.org
Please help me fix this error Parse error: syntax error, unexpected character · 1. Download the latest version of WordPress CMS. · 2....
Read more >JSHint Options Reference
This can lead to unexpected warnings/errors in when upgrading between minor versions of JSHint. This option is a short hand for the most...
Read more >SonarJS fails parsing a file: Unexpected character '#'
This is because SonarJS relies on babel-eslint which fails to recognize the “@babel/plugin-proposal-class-properties” plugin properly and ...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse('[1, 2, 3, 4,]'); JSON.parse('{"foo": 1,}'); // SyntaxError JSON.parse: unexpected character // at line 1 column 14 of the JSON data
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JavierRSobrino The private fields(
#
) proposal is in stage3, And the ESLint default parser didn’t support it now. So, as @anikethsaha mentioned, you can use other parsers (e.g.babel-eslint) to support it.@greggman stage 3 is when browsers ship; stage 4 is when it’s in the spec (after it’s been shipped in at least 2 impls). As unfortunate as it is, eslint doesn’t support anything until it’s in a spec document, even if it’s already shipped on the web.