Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/errors/E0292.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# E0292: character is not allowed in global identifiers

Certain characters generate errors when used in JSON global variables in config files, such as the ```.``` below.

```example-invalid-period
{
"globals": {
"jest.": true
}
}
```

Leading spaces and numbers are also disallowed:

```example-invalid-nums
{
"globals": {
"123ABC": true
}
}
```

As are certain unicode characters:

```example-invalid-unicode
{
"globals": {
"\u2604": true
}
}
```

To fix this error, rename variables to exclude disallowed characters and leading numbers or spaces.
7 changes: 7 additions & 0 deletions src/quick-lint-js/fe/diagnostic-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@
QLJS_TRANSLATABLE("commas are not allowed between class methods"), \
unexpected_comma)) \
\
QLJS_DIAG_TYPE( \
diag_config_character_disallowed_in_identifiers, "E0292", \
diagnostic_severity::error, { source_code_span character; }, \
MESSAGE( \
QLJS_TRANSLATABLE("character is not allowed in global identifiers"), \
character)) \
\
QLJS_DIAG_TYPE( \
diag_config_json_syntax_error, "E0164", diagnostic_severity::error, \
{ source_code_span where; }, \
Expand Down