From 6b0c9d84618f4a693c9c067983ba56a5226474ac Mon Sep 17 00:00:00 2001 From: kptil <ktiley@ufl.edu> Date: Sun, 18 Sep 2022 11:10:24 -0400 Subject: [PATCH 1/2] added new diag type --- src/quick-lint-js/fe/diagnostic-types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/quick-lint-js/fe/diagnostic-types.h b/src/quick-lint-js/fe/diagnostic-types.h index 80ece6624b..edc2a9e21b 100644 --- a/src/quick-lint-js/fe/diagnostic-types.h +++ b/src/quick-lint-js/fe/diagnostic-types.h @@ -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; }, \ From f76fe4e35b8be26e3fb0e319d1daa136a7df23bc Mon Sep 17 00:00:00 2001 From: Kat <47299685+kptil@users.noreply.github.com> Date: Sun, 18 Sep 2022 11:12:29 -0400 Subject: [PATCH 2/2] Create E0292.md --- docs/errors/E0292.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docs/errors/E0292.md diff --git a/docs/errors/E0292.md b/docs/errors/E0292.md new file mode 100644 index 0000000000..27b7cca33f --- /dev/null +++ b/docs/errors/E0292.md @@ -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.