Skip to content

Commit

Permalink
fix: all keywords, reserved
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxiemeihao committed May 23, 2023
1 parent f120e84 commit 0cc3de0
Showing 1 changed file with 85 additions and 36 deletions.
121 changes: 85 additions & 36 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,92 @@ export interface Options {
conflict?: string;
}

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words
const keywords = [
'break',
'case',
'catch',
'class',
'const',
'continue',
'debugger',
'default',
'delete',
'do',
'else',
'export',
'extends',
'false',
'finally',
'for',
'function',
'if',
'import',
'in',
'instanceof',
'new',
'null',
'return',
'super',
'switch',
'this',
'throw',
'true',
'try',
'typeof',
'var',
'void',
'while',
'with',
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words
...[
'break',
'case',
'catch',
'class',
'const',
'continue',
'debugger',
'default',
'delete',
'do',
'else',
'export',
'extends',
'false',
'finally',
'for',
'function',
'if',
'import',
'in',
'instanceof',
'new',
'null',
'return',
'super',
'switch',
'this',
'throw',
'true',
'try',
'typeof',
'var',
'void',
'while',
'with',
// The following are only reserved when they are found in strict mode code
'const',
'let',
'static',
'yield',
// The following are only reserved when they are found in module code or async function bodies
'await',
],
...[
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#future_reserved_words
'enum',
// The following are only reserved when they are found in strict mode code
'implements',
'interface',
'package',
'private',
'protected',
'public',
// Future reserved words in older standards
// The following are reserved as future keywords by older ECMAScript specifications (ECMAScript 1 till 3).
'abstract',
'boolean',
'byte',
'char',
'double',
'final',
'float',
'goto',
'int',
'long',
'native',
'short',
'synchronized',
'throws',
'transient',
'volatile',
],
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers_with_special_meanings
...[
'arguments',
'as',
'async',
'eval',
'from',
'get',
'of',
'set',
],
]

/** Lib to ESM code snippets */
Expand Down

0 comments on commit 0cc3de0

Please sign in to comment.