format changes with prettier
MODIFY
packages/@romejs/js-compiler/__rtests__/lint.ts
packages/@romejs/js-compiler/__rtests__/lint.ts
@@ -255,7 +255,7 @@ test('disallow var', async t => {
test('no empty character class in regular expression', async t => {
const validTestCases = [
'let foo = /^abc[a-zA-Z]/;foo;',
- 'let regExp = new RegExp(\"^abc[]\");regExp;',
+ 'let regExp = new RegExp("^abc[]");regExp;',
'let foo = /^abc/;foo;',
'let foo = /[\\[]/;foo;',
'let foo = /[\\]]/;foo;',
@@ -265,8 +265,8 @@ test('no empty character class in regular expression', async t => {
'let foo = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g;foo;',
'let foo = /[\\]]/uy;foo;',
'let foo = /[\\]]/s;foo;',
- 'let foo = /\\[]/;foo;'
- ]
+ 'let foo = /\\[]/;foo;',
+ ];
const invalidTestCases = [
'let foo = /^abc[]/;foo;',
@@ -274,8 +274,8 @@ test('no empty character class in regular expression', async t => {
'let foo = "";if (foo.match(/^abc[]/)) { foo; }',
'let foo = /[]]/;foo;',
'let foo = /\\[[]/;foo;',
- 'let foo = /\\[\\[\\]a-z[]/;foo;'
- ]
+ 'let foo = /\\[\\[\\]a-z[]/;foo;',
+ ];
for (const validTestCase of validTestCases) {
const {diagnostics} = await testLint(
@@ -286,7 +286,10 @@ test('no empty character class in regular expression', async t => {
}
for (const invalidTestCase of invalidTestCases) {
- let res = await testLint(invalidTestCase, LINT_ENABLED_FORMAT_DISABLED_CONFIG)
+ let res = await testLint(
+ invalidTestCase,
+ LINT_ENABLED_FORMAT_DISABLED_CONFIG,
+ );
t.snapshot(res);
}
});

MODIFY
packages/@romejs/js-compiler/transforms/lint/index.ts
packages/@romejs/js-compiler/transforms/lint/index.ts
@@ -28,5 +28,5 @@ export const lintTransforms = [
noLabelVar,
noDuplicateKeys,
disallowVar,
- noEmptyCharacterClass
+ noEmptyCharacterClass,
];

MODIFY
packages/@romejs/js-compiler/transforms/lint/noEmptyCharacterClass.ts
packages/@romejs/js-compiler/transforms/lint/noEmptyCharacterClass.ts
* LICENSE file in the root directory of this source tree.
*/
-
import {AnyNode} from '@romejs/js-ast';
import {Path} from '@romejs/js-compiler';
@@ -26,10 +25,11 @@ export default {
enter(path: Path): AnyNode {
const {context, node} = path;
- if (node.type === "RegExpLiteral" && !regex.test(node.pattern)) {
+ if (node.type === 'RegExpLiteral' && !regex.test(node.pattern)) {
context.addNodeDiagnostic(node, {
category: 'lint/noEmptyCharacterClass',
- message: 'Empty character classes in regular expressions are not allowed',
+ message:
+ 'Empty character classes in regular expressions are not allowed',
});
}

format changes with prettier