Skip to content
Permalink
Browse files
fix: styles
  • Loading branch information
gajus committed May 15, 2020
1 parent 8f52ab8 commit fc5563d2f3653cb5fbe03bec14f24a095f2aac50
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
@@ -9,7 +9,7 @@
},
"description": "Flowtype linting rules for ESLint.",
"devDependencies": {
"ajv": "^6.10.2",
"ajv": "^6.12.2",
"babel-cli": "^6.26.0",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
@@ -20,13 +20,13 @@
"eclint": "^2.8.1",
"eslint": "^7.0.0",
"eslint-config-canonical": "^19.0.4",
"gitdown": "^3.1.1",
"glob": "^7.1.4",
"husky": "^3.0.3",
"gitdown": "^3.1.3",
"glob": "^7.1.6",
"husky": "^4.2.5",
"jsonlint": "^1.6.3",
"mocha": "^6.2.0",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.19"
"mocha": "^7.1.2",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.7"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
@@ -90,7 +90,7 @@ const checkDocs = (rulesNames) => {
throw new Error(
'Docs checker encountered an error in: ' + invalidList + '. ' +
'Make sure that for every rule you created documentation file with assertions placeholder in camelCase ' +
'and included the file path in `.README/README.md` file.'
'and included the file path in `.README/README.md` file.',
);
}
};
@@ -58,7 +58,7 @@ const checkTests = (rulesNames) => {

throw new Error(
'Tests checker encountered an error in: ' + invalidList + '. ' +
'Make sure that for every rule you created test suite and included the rule name in `tests/rules/index.js` file.'
'Make sure that for every rule you created test suite and included the rule name in `tests/rules/index.js` file.',
);
}
};
@@ -18,7 +18,7 @@ const create = (context) => {
globalScope.__defineGeneric(
ident.name,
globalScope.set,
globalScope.variables
globalScope.variables,
);
const variable = globalScope.set.get(ident.name);

@@ -25,7 +25,7 @@ const create = (context) => {
context.getAllComments(),
(comment) => {
return looksLikeFlowFileAnnotation(comment.value);
}
},
);

if (potentialFlowFileAnnotation) {
@@ -37,7 +37,7 @@ const create = (context) => {
fix: (fixer) => {
return fixer.insertTextAfter(
potentialFlowFileAnnotation,
newline
newline,
);
},
message: 'Expected newline after flow annotation',
@@ -57,7 +57,7 @@ const create = (context) => {
lineBreak === '\r' ? 2 : 1
),
],
''
'',
);
},
message: 'Expected no newline after flow annotation',
@@ -52,7 +52,7 @@ const create = (context) => {
const element = analizeElement(
property.type === 'ObjectTypeSpreadProperty' ?
property.argument :
property.value
property.value,
);

return {
@@ -100,7 +100,7 @@ const create = (context) => {
fix: (fixer) => {
return fixer.replaceTextRange(
[potentialFlowFileAnnotation.range[0], potentialFlowFileAnnotation.range[1]],
annotation
annotation,
);
},
message: 'Flow file annotation style must be `' + annotation + '`',
@@ -186,7 +186,7 @@ const generateFix = (node, context, sort) => {
property.range[0];
const subString = source.getText().slice(
startIndex,
beforePunctuator.range[1]
beforePunctuator.range[1],
);

nodeText = nodeText.replace(subString, '$' + index);
@@ -1,13 +1,13 @@
import isFlowFileAnnotation from './isFlowFileAnnotation';
/* eslint-disable flowtype/require-valid-file-annotation */

/**
* Checks whether a file has an @flow or @noflow annotation.
*
* @param context
* @param [strict] - By default, the function returns true if the file starts with @flow but not if it
* starts by @noflow. When the strict flag is set to false, the function returns true if the flag has @noflow also.
*/
/* eslint-enable flowtype/require-valid-file-annotation */

export default (context, strict = true) => {
const comments = context.getAllComments();

@@ -3,7 +3,6 @@ import _ from 'lodash';
const FLOW_MATCHER = /^@(?:no)?flow$/;

export default (comment, strict) => {
// eslint-disable-next-line flowtype/require-valid-file-annotation
// 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) => {

0 comments on commit fc5563d

Please sign in to comment.