Skip to content

Commit a26e3c7

Browse files
authored
chore: enable prefer-regexp-test (typescript-eslint#9658)
prefer-regexp-test
1 parent 2645946 commit a26e3c7

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export default tseslint.config(
322322
'jsdoc/informative-docs': 'error',
323323
'unicorn/no-typeof-undefined': 'error',
324324
'unicorn/no-useless-spread': 'error',
325+
'unicorn/prefer-regexp-test': 'error',
325326
},
326327
},
327328
{

packages/eslint-plugin/src/util/getWrappingFixer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function getWrappingFixer(
6767
}
6868

6969
// check if we need to insert semicolon
70-
if (/^[`([]/.exec(code) && isMissingSemicolonBefore(node, sourceCode)) {
70+
if (/^[`([]/.test(code) && isMissingSemicolonBefore(node, sourceCode)) {
7171
code = `;${code}`;
7272
}
7373

packages/parser/tests/test-utils/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function createSnapshotTestBlock(
5959
* If we are deliberately throwing because of encountering an unknown
6060
* AST_NODE_TYPE, we rethrow to cause the test to fail
6161
*/
62-
if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) {
62+
if ((error as Error).message.includes('Unknown AST_NODE_TYPE')) {
6363
throw error;
6464
}
6565
expect(parse).toThrowErrorMatchingSnapshot();

packages/typescript-estree/tests/test-utils/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function createSnapshotTestBlock(
4444
* If we are deliberately throwing because of encountering an unknown
4545
* AST_NODE_TYPE, we rethrow to cause the test to fail
4646
*/
47-
if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) {
47+
if ((error as Error).message.includes('Unknown AST_NODE_TYPE')) {
4848
throw error;
4949
}
5050
expect(parse).toThrowErrorMatchingSnapshot();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy