Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
style: fix style issues
  • Loading branch information
gajus committed May 15, 2020
1 parent 353dce4 commit a1f7920
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/bin/addAssertions.js
Expand Up @@ -61,7 +61,7 @@ const updateDocuments = (assertions) => {

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

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

const ruleName = assertionsBlock.match(/assertions ([a-z]+)/i)[1];
Expand Down
2 changes: 1 addition & 1 deletion src/bin/checkDocs.js
Expand Up @@ -44,7 +44,7 @@ const getDocIndexRules = () => {
const hasCorrectAssertions = (docPath, name) => {
const content = fs.readFileSync(docPath, 'utf-8');

const match = /<!-- assertions ([a-zA-Z]+) -->/.exec(content);
const match = /<!-- assertions ([A-Za-z]+) -->/.exec(content);

if (match === null) {
return false;
Expand Down
1 change: 1 addition & 0 deletions src/bin/checkTests.js
Expand Up @@ -10,6 +10,7 @@ import {
const getTestIndexRules = () => {
const content = fs.readFileSync(path.resolve(__dirname, '../../tests/rules/index.js'), 'utf-8');

// eslint-disable-next-line unicorn/no-reduce
const result = content.split('\n').reduce((acc, line) => {
if (acc.inRulesArray) {
if (line === '];') {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/utilities.js
Expand Up @@ -22,7 +22,7 @@ export const getRules = () => {
export const isFile = (filepath) => {
try {
return fs.statSync(filepath).isFile();
} catch (error) {
} catch {
return false;
}
};
6 changes: 3 additions & 3 deletions src/rules/arrayStyle/needWrap.js
@@ -1,10 +1,10 @@
import isSimpleType from './isSimpleType';

const complexTypesWithoutWrap = [
const complexTypesWithoutWrap = new Set([
'TupleTypeAnnotation',
'ObjectTypeAnnotation',
];
]);

export default (node) => {
return !isSimpleType(node) && !complexTypesWithoutWrap.includes(node.type);
return !isSimpleType(node) && !complexTypesWithoutWrap.has(node.type);
};
2 changes: 1 addition & 1 deletion src/utilities/isFlowFileAnnotation.js
Expand Up @@ -5,7 +5,7 @@ const FLOW_MATCHER = /^@(?:no)?flow$/;
export default (comment, strict) => {
// The flow parser splits comments with the following regex to look for the @flow flag.
// See https://github.com/facebook/flow/blob/a96249b93541f2f7bfebd8d62085bf7a75de02f2/src/parsing/docblock.ml#L39
return _.some(comment.split(/[ \t\r\n\\*/]+/), (commentPart) => {
return _.some(comment.split(/[\t\n\r */\\]+/), (commentPart) => {
const match = commentPart.match(FLOW_MATCHER);

if (match === null) {
Expand Down

0 comments on commit a1f7920

Please sign in to comment.