You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

check-flow-annotation

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-flow-annotation - npm Package Compare versions

Comparing version

to
1.0.1

2

package.json
{
"name": "check-flow-annotation",
"version": "1.0.0",
"version": "1.0.1",
"description": "A basic flow type annotation checker",

@@ -5,0 +5,0 @@ "keywords": [

[![Build Status](https://travis-ci.org/DavidBabel/check-flow-annotation.svg?branch=master)](https://travis-ci.org/DavidBabel/check-flow-annotation)
[![codecov](https://codecov.io/gh/DavidBabel/check-flow-annotation/branch/master/graph/badge.svg)](https://codecov.io/gh/DavidBabel/check-flow-annotation)
<!-- [![codecov](https://codecov.io/gh/DavidBabel/check-flow-annotation/branch/master/graph/badge.svg)](https://codecov.io/gh/DavidBabel/check-flow-annotation) -->

@@ -16,4 +16,5 @@ [![npm](http://img.shields.io/npm/v/check-flow-annotation.svg)](https://www.npmjs.com/package/check-flow-annotation)

```bash
# install
# install with yarn
yarn add check-flow-annotation -D
# install with npm
npm install check-flow-annotation --save-dev

@@ -23,5 +24,17 @@

check-flow-annotation ./my/path ./my/other/path
# with options
check-flow-annotation ./my/path --strict
check-flow-annotation ./my/path --exclude ['build*', '.src/static/*']
check-flow-annotation ./my/path --check '@flow weak'
check-flow-annotation --strict ./my/path # same
# exclude some paths
check-flow-annotation ./my/path --exclude='build*','.src/static/*'
check-flow-annotation ./my/path -x 'build*','.src/static/*' #same, small version
check-flow-annotation ./my/path -x 'build*' -x '.src/static/*' #same
# exclude jsx files
check-flow-annotation ./my/path --exclude='*.jsx'
# check another anotation on first line
check-flow-annotation ./my/path --check='@flow weak'
```

@@ -34,4 +47,7 @@

Usage: check-flow-annotation.js [options] path1 path2 path3 etc
by default it checks every ".js" and ".jsx" in your project, but you can filter it with exclude option
By default it checks every ".js" and ".jsx" in your project, but you can filter it with exclude option
Note that options are written "--option=value" but short version are written "-o value"
--help, -h

@@ -49,5 +65,5 @@ Displays help information about this script

--exclude, -x
Allow to exclude certain paths or extensions
example: ['build*', '.src/static/*', '*.jsx']
will be merged with default: ['node_modules*', '.git*', 'flow-typed*', '.*', '!*.+(js|jsx)']
Allow to exclude certain paths or extensions, it‘s a comma separated value
example: 'build*','.src/static/*'
will be merged with default array: ['node_modules*', '.git*', 'flow-typed*', '.*', '!*.+(js|jsx|mjs)']

@@ -57,4 +73,2 @@ --check, -c

'@flow weak' or '@no flow'
```

@@ -14,3 +14,6 @@ #!/usr/bin/env node

`Usage: check-flow-annotation.js [options] path1 path2 path3 etc
by default it checks every ".js" and ".jsx" in your project, but you can filter it with exclude option`
By default it checks every ".js" and ".jsx" in your project, but you can filter it with exclude option
Note that options are written "--option=value" but short versions are written "-o value"`
)

@@ -29,5 +32,6 @@ .version('v1.0')

type: 'list,csv',
description: 'Allow to exclude certain paths or extensions',
example: `example: ['build*', '.src/static/*', '*.jsx']
will be merged with default: ['node_modules*', '.git*', 'flow-typed*', '.*', '!*.+(js|jsx)']`
description:
'Allow to exclude certain paths or extensions, it‘s a comma separated value',
example: `example: 'build*','.src/static/*'
will be merged with default array: ['node_modules*', '.git*', 'flow-typed*', '.*', '!*.+(js|jsx|mjs)']`
},

@@ -74,35 +78,33 @@ {

const excludeDirs = [
'node_modules*',
'.git*',
'flow-typed*',
'.*',
'!*.+(js|jsx|mjs)',
...flatten(exclude)
];
targets.forEach(target => {
readDir(
target,
[
'node_modules*',
'.git*',
'flow-typed*',
'.*',
'!*.+(js|jsx)',
...flatten(exclude)
],
(err, files) => {
if (err) {
console.error(err);
process.exit(1);
}
readDir(target, excludeDirs, (err, files) => {
if (err) {
console.error(err);
process.exit(1);
}
promises.push(
...files.map(async file => {
const line = await firstline(file);
if (!checkRegexp.test(line)) {
return `${`missing ${annotation} annotation:`.red} ${file}`;
}
return null;
})
);
promises.push(
...files.map(async file => {
const line = await firstline(file);
if (!checkRegexp.test(line)) {
return `${`missing ${annotation} annotation:`.red} ${file}`;
}
return null;
})
);
pathsLeft--;
if (pathsLeft === 0) {
printResult();
}
pathsLeft--;
if (pathsLeft === 0) {
printResult();
}
);
});
});

@@ -109,0 +111,0 @@ }