Skip to content

Commit 735f143

Browse files
G-RathSimenB
authored andcommitted
chore(lint): enable require-unicode-regexp rule (#520)
1 parent d813ea4 commit 735f143

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = {
4545
{ VariableDeclarator: { array: true, object: true } },
4646
],
4747
'sort-imports': ['error', { ignoreDeclarationSort: true }],
48+
'require-unicode-regexp': 'error',
4849
// TS covers this
4950
'node/no-missing-import': 'off',
5051
'node/no-unsupported-features/es-syntax': 'off',

src/rules/__tests__/no-large-snapshots.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ ruleTester.run('no-large-snapshots', rule, {
131131
options: [
132132
{
133133
whitelistedSnapshots: {
134-
'/another-mock-component.jsx.snap': [/a big component \d+/],
134+
'/another-mock-component.jsx.snap': [/a big component \d+/u],
135135
},
136136
},
137137
],
@@ -152,7 +152,7 @@ ruleTester.run('no-large-snapshots', rule, {
152152
options: [
153153
{
154154
whitelistedSnapshots: {
155-
'/mock-component.jsx.snap': [/a big component \d+/],
155+
'/mock-component.jsx.snap': [/a big component \d+/u],
156156
},
157157
},
158158
],
@@ -186,7 +186,7 @@ describe('no-large-snapshots', () => {
186186
options: [
187187
{
188188
whitelistedSnapshots: {
189-
'mock-component.jsx.snap': [/a big component \d+/],
189+
'mock-component.jsx.snap': [/a big component \d+/u],
190190
},
191191
},
192192
],

src/rules/no-commented-out-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TSESTree } from '@typescript-eslint/experimental-utils';
22
import { createRule } from './utils';
33

44
function hasTests(node: TSESTree.Comment) {
5-
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test(
5+
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(
66
node.value,
77
);
88
}

src/rules/no-export.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default createRule({
6262
'name' in object &&
6363
object.name === 'module' &&
6464
property.type === AST_NODE_TYPES.Identifier &&
65-
/^exports?$/.test(property.name)
65+
/^exports?$/u.test(property.name)
6666
) {
6767
exportNodes.push(node);
6868
}

src/rules/valid-title.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ export default createRule({
121121
fixer.replaceTextRange(
122122
argument.range,
123123
stringValue
124-
.replace(/^([`'"]) +?/, '$1')
125-
.replace(/ +?([`'"])$/, '$1'),
124+
.replace(/^([`'"]) +?/u, '$1')
125+
.replace(/ +?([`'"])$/u, '$1'),
126126
),
127127
];
128128
},
@@ -145,7 +145,7 @@ export default createRule({
145145
return [
146146
fixer.replaceTextRange(
147147
argument.range,
148-
stringValue.replace(/^([`'"]).+? /, '$1'),
148+
stringValue.replace(/^([`'"]).+? /u, '$1'),
149149
),
150150
];
151151
},

0 commit comments

Comments
 (0)