quick-lint-js

Find bugs in JavaScript programs.

E0249: computed enum member name must be a simple string

TypeScript enum members can be named using a string literal. The string literal must not contain parentheses, concatenation, or anything other than a basic string:

enum LogLevel {
  // Our obfuscation scripts get confused by the
  // term "DEBUG" here, so work around it with +.
  ['DE' + 'BUG'] = 'DE' + 'BUG',
}

To fix this error, simplify the member name into a string literal:

enum LogLevel {
  // Our obfuscation scripts get confused by the
  // term "DEBUG" here, so work around it with
  // a Unicode escape sequence.
  ['DE\u{66}UG'] = 'DE\u{66}UG',
}

Documentation for other errors