Skip to content

Commit 5f6f9aa

Browse files
committed
fix: restore eslint canonical
1 parent e9a334b commit 5f6f9aa

21 files changed

+32
-31
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"ajv": "^8.6.3",
2323
"babel-plugin-add-module-exports": "^1.0.4",
2424
"eslint": "^8.1.0",
25-
"eslint-config-canonical": "^32.0.1",
25+
"eslint-config-canonical": "^32.1.1",
2626
"eslint-plugin-eslint-plugin": "^4.0.1",
2727
"gitdown": "^3.1.4",
2828
"glob": "^7.2.0",

src/bin/addAssertions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ const updateDocuments = (assertions) => {
6161

6262
documentBody = fs.readFileSync(readmeDocumentPath, 'utf8');
6363

64-
documentBody = documentBody.replace(/<!-- assertions ([a-z]+?) -->/gi, (assertionsBlock) => {
64+
documentBody = documentBody.replace(/<!-- assertions ([a-z]+?) -->/ugi, (assertionsBlock) => {
6565
let exampleBody;
6666

67-
const ruleName = assertionsBlock.match(/assertions ([a-z]+)/i)[1];
67+
const ruleName = assertionsBlock.match(/assertions ([a-z]+)/ui)[1];
6868

6969
const ruleAssertions = assertions[ruleName];
7070

src/bin/checkDocs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const getDocIndexRules = () => {
2323
const content = fs.readFileSync(path.resolve(__dirname, '../../.README/README.md'), 'utf-8');
2424

2525
const rules = content.split('\n').map((line) => {
26-
const match = /^{"gitdown": "include", "file": "([^"]+)"}$/.exec(line);
26+
const match = /^{"gitdown": "include", "file": "([^"]+)"}$/u.exec(line);
2727

2828
if (match === null) {
2929
return null;
@@ -44,7 +44,7 @@ const getDocIndexRules = () => {
4444
const hasCorrectAssertions = (docPath, name) => {
4545
const content = fs.readFileSync(docPath, 'utf-8');
4646

47-
const match = /<!-- assertions ([A-Za-z]+) -->/.exec(content);
47+
const match = /<!-- assertions ([A-Za-z]+) -->/u.exec(content);
4848

4949
if (match === null) {
5050
return false;

src/bin/checkTests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getTestIndexRules = () => {
1515
if (line === '];') {
1616
acc.inRulesArray = false;
1717
} else {
18-
acc.rules.push(line.replace(/^\s*'([^']+)',?$/, '$1'));
18+
acc.rules.push(line.replace(/^\s*'([^']+)',?$/u, '$1'));
1919
}
2020
} else if (line === 'const reportingRules = [') {
2121
acc.inRulesArray = true;

src/rules/arrayStyle/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const schema = [
99
];
1010

1111
const inlineType = (type) => {
12-
const inlined = type.replace(/\s+/g, ' ');
12+
const inlined = type.replace(/\s+/ug, ' ');
1313

1414
if (inlined.length <= 50) {
1515
return inlined;

src/rules/arrayStyle/isSimpleType.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020

2121
const simpleTypePatterns = [
22-
/^(?:Any|Array|Boolean|Generic|Mixed|Number|String|Void)TypeAnnotation$/,
23-
/.+LiteralTypeAnnotation$/,
22+
/^(?:Any|Array|Boolean|Generic|Mixed|Number|String|Void)TypeAnnotation$/u,
23+
/.+LiteralTypeAnnotation$/u,
2424
];
2525

2626
export default (node) => {

src/rules/interfaceIdMatch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const schema = [
55
];
66

77
const create = (context) => {
8-
const pattern = new RegExp(context.options[0] || '^([A-Z][a-z0-9]*)+Type$');
8+
const pattern = new RegExp(context.options[0] || '^([A-Z][a-z0-9]*)+Type$', 'u');
99

1010
const checkInterface = (interfaceDeclarationNode) => {
1111
const interfaceIdentifierName = interfaceDeclarationNode.id.name;

src/rules/newlineAfterFlowAnnotation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22

33
const looksLikeFlowFileAnnotation = (comment) => {
4-
return /@(?:no)?flo/i.test(comment);
4+
return /@(?:no)?flo/ui.test(comment);
55
};
66

77
const schema = [

src/rules/noFlowFixMeComments.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const isIdentifier = function (node, name) {
1111
};
1212

1313
const create = (context) => {
14-
const allowedPattern = context.options[0] ? new RegExp(context.options[0]) : null;
14+
const allowedPattern = context.options[0] ? new RegExp(context.options[0], 'u') : null;
1515
const extraMessage = allowedPattern ? ' Fix it or match `' + allowedPattern.toString() + '`.' : '';
1616

1717
const passesExtraRegex = function (value) {
@@ -25,14 +25,14 @@ const create = (context) => {
2525
const handleComment = function (comment) {
2626
const value = comment.value.trim();
2727

28-
if (value.match(/\$FlowFixMe/) && !passesExtraRegex(value)) {
28+
if (value.match(/\$FlowFixMe/u) && !passesExtraRegex(value)) {
2929
context.report(comment, message + extraMessage);
3030
}
3131
};
3232

3333
return {
3434
GenericTypeAnnotation (node) {
35-
if (isIdentifier(node.id, /\$FlowFixMe/)) {
35+
if (isIdentifier(node.id, /\$FlowFixMe/u)) {
3636
context.report({
3737
message,
3838
node: node.id,

src/rules/noInternalFlowType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ReactComponents = [
2222
const create = (context) => {
2323
return {
2424
Identifier (node) {
25-
const match = node.name.match(/^React\$(?<internalTypeName>.+)/);
25+
const match = node.name.match(/^React\$(?<internalTypeName>.+)/u);
2626
if (match !== null && match.groups !== null && match.groups !== undefined) {
2727
const {internalTypeName} = match.groups;
2828
if (ReactComponents.includes(internalTypeName)) {

0 commit comments

Comments
 (0)