Skip to content
Permalink
Browse files
style: fix style issues
  • Loading branch information
gajus committed May 15, 2020
1 parent 353dce4 commit a1f7920925b36a80f85b91a04e27a1ec9968bd06
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
@@ -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];
@@ -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;
@@ -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 === '];') {
@@ -22,7 +22,7 @@ export const getRules = () => {
export const isFile = (filepath) => {
try {
return fs.statSync(filepath).isFile();
} catch (error) {
} catch {
return false;
}
};
@@ -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);
};
@@ -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) {

0 comments on commit a1f7920

Please sign in to comment.