Add back missing noShadowRestrictedNames test
ADD
packages/@romejs/js-compiler/transforms/lint/__rtests__/noShadowRestrictedNames.ts
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import {parseJS} from '@romejs/js-parser';
+import {createUnknownFilePath} from '@romejs/path';
+import test from '@romejs/test';
+import {
+ testLint,
+ LINT_ENABLED_FORMAT_DISABLED_CONFIG,
+} from '../../../__rtests__/lint';
+
+test('no shadow restricted names', async t => {
+ let failingCases = [
+ 'function NaN() {}',
+ 'let Set;',
+ '!function Array() {}',
+ 'function test(JSON) {}',
+ 'try { } catch(Object) {}',
+ ];
+ for (let failingCase of failingCases) {
+ const res = await testLint(
+ failingCase,
+ LINT_ENABLED_FORMAT_DISABLED_CONFIG,
+ );
+ if (
+ !res.diagnostics.some(d => d.category === 'lint/noShadowRestrictedNames')
+ ) {
+ t.fail(
+ `expected "\n${failingCase}\n" to report a lint/noShadowRestrictedNames diagnostic but it didn't`,
+ [
+ {
+ type: 'inspect',
+ data: parseJS({
+ input: failingCase,
+ sourceType: 'module',
+ path: createUnknownFilePath('unknown'),
+ }),
+ },
+ {type: 'inspect', data: res.diagnostics},
+ ],
+ );
+ }
+ }
+});

Add back missing noShadowRestrictedNames test