support bigInt literals in noDuplicateCase
MODIFY
packages/@romejs/compiler/lint/rules/js/noDuplicateCase.test.ts
packages/@romejs/compiler/lint/rules/js/noDuplicateCase.test.ts
@@ -48,6 +48,21 @@ test(
break;
}
`,
+ dedent`
+ const expr = 3;
+ switch (expr) {
+ case 1:
+ break;
+ case 2n:
+ break;
+ case 3:
+ break;
+ case 2n:
+ break;
+ default:
+ break;
+ }
+ `,
],
valid: [
dedent`
@@ -65,6 +80,21 @@ test(
break;
}
`,
+ dedent`
+ const expr = 3;
+ switch (expr) {
+ case 1:
+ break;
+ case 2:
+ break;
+ case 3:
+ break;
+ case 2n:
+ break;
+ default:
+ break;
+ }
+ `,
// Currently no diagnostic for duplicate identifiers
dedent`
const foo = 'a';

MODIFY
packages/@romejs/compiler/lint/rules/js/noDuplicateCase.ts
packages/@romejs/compiler/lint/rules/js/noDuplicateCase.ts
@@ -21,7 +21,8 @@ export default {
if (
param.test &&
(param.test.type === "JSStringLiteral" ||
- param.test.type === "JSNumericLiteral")
+ param.test.type === "JSNumericLiteral" ||
+ param.test.type === "JSBigIntLiteral")
) {
const {test} = param;

support bigInt literals in noDuplicateCase (#564)