Skip to content

Commit

Permalink
chore(lint): enable require-unicode-regexp rule (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and SimenB committed Jan 19, 2020
1 parent d813ea4 commit 735f143
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -45,6 +45,7 @@ module.exports = {
{ VariableDeclarator: { array: true, object: true } },
],
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'require-unicode-regexp': 'error',
// TS covers this
'node/no-missing-import': 'off',
'node/no-unsupported-features/es-syntax': 'off',
Expand Down
6 changes: 3 additions & 3 deletions src/rules/__tests__/no-large-snapshots.test.ts
Expand Up @@ -131,7 +131,7 @@ ruleTester.run('no-large-snapshots', rule, {
options: [
{
whitelistedSnapshots: {
'/another-mock-component.jsx.snap': [/a big component \d+/],
'/another-mock-component.jsx.snap': [/a big component \d+/u],
},
},
],
Expand All @@ -152,7 +152,7 @@ ruleTester.run('no-large-snapshots', rule, {
options: [
{
whitelistedSnapshots: {
'/mock-component.jsx.snap': [/a big component \d+/],
'/mock-component.jsx.snap': [/a big component \d+/u],
},
},
],
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('no-large-snapshots', () => {
options: [
{
whitelistedSnapshots: {
'mock-component.jsx.snap': [/a big component \d+/],
'mock-component.jsx.snap': [/a big component \d+/u],
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-commented-out-tests.ts
Expand Up @@ -2,7 +2,7 @@ import { TSESTree } from '@typescript-eslint/experimental-utils';
import { createRule } from './utils';

function hasTests(node: TSESTree.Comment) {
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test(
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(
node.value,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-export.ts
Expand Up @@ -62,7 +62,7 @@ export default createRule({
'name' in object &&
object.name === 'module' &&
property.type === AST_NODE_TYPES.Identifier &&
/^exports?$/.test(property.name)
/^exports?$/u.test(property.name)
) {
exportNodes.push(node);
}
Expand Down
6 changes: 3 additions & 3 deletions src/rules/valid-title.ts
Expand Up @@ -121,8 +121,8 @@ export default createRule({
fixer.replaceTextRange(
argument.range,
stringValue
.replace(/^([`'"]) +?/, '$1')
.replace(/ +?([`'"])$/, '$1'),
.replace(/^([`'"]) +?/u, '$1')
.replace(/ +?([`'"])$/u, '$1'),
),
];
},
Expand All @@ -145,7 +145,7 @@ export default createRule({
return [
fixer.replaceTextRange(
argument.range,
stringValue.replace(/^([`'"]).+? /, '$1'),
stringValue.replace(/^([`'"]).+? /u, '$1'),
),
];
},
Expand Down

0 comments on commit 735f143

Please sign in to comment.