Skip to content

Commit 4e6125d

Browse files
committed
Docs: document E052, E147
1 parent f708c09 commit 4e6125d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

docs/errors/E052.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# E052: unexpected '#'
2+
3+
```config-for-examples
4+
{
5+
"globals": {
6+
"encrypt": true,
7+
"sendMessage": true,
8+
9+
"synchronous": true,
10+
"blocking": true
11+
}
12+
}
13+
```
14+
15+
In JavaScript, `#` is used for shebangs at the beginning of a file (e.g.
16+
`#!/usr/bin/env node`) and private properties. (`#` does not start a comment.)
17+
It is an error to use `#` anywhere else:
18+
19+
class Auth {
20+
#password;
21+
22+
authenticate() {
23+
# synchronous (blocking)
24+
sendMessage(encrypt(this.# password));
25+
}
26+
}
27+
28+
To fix this error, write the property's name after `#`, and use `//` for line
29+
comments:
30+
31+
class Auth {
32+
#password;
33+
34+
authenticate() {
35+
// synchronous (blocking)
36+
sendMessage(encrypt(this.#password));
37+
}
38+
}

docs/errors/E147.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# E147: unexpected identifier in expression; missing operator before
2+
3+
```config-for-examples
4+
{
5+
"globals": {
6+
"add": true,
7+
"dos": true,
8+
"two": true
9+
}
10+
}
11+
```
12+
13+
It is an error to write two variable names without an operator in between:
14+
15+
const quatro = (dos dos);
16+
const four = add(two two);
17+
18+
To fix this error, remove one of the variables, or add an operator:
19+
20+
const quatro = (dos + dos);
21+
const four = add(two, two);

0 commit comments

Comments
 (0)