Skip to content

Commit e73dd98

Browse files
anthony-redFoxtmcw
authored andcommitted
chore: Updated Flow.js dependency on 0.52.0 (#862)
1 parent aa3496a commit e73dd98

File tree

6 files changed

+24
-19
lines changed

6 files changed

+24
-19
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"eslint": "^4.1.1",
7171
"eslint-config-prettier": "^2.3.0",
7272
"eslint-plugin-flowtype": "^2.34.1",
73-
"flow-bin": "^0.46.0",
73+
"flow-bin": "^0.52.0",
7474
"fs-extra": "^4.0.0",
7575
"husky": "^0.14.0",
7676
"jest": "^20.0.4",
@@ -102,7 +102,7 @@
102102
"precommit": "lint-staged --verbose",
103103
"prepublish": "npm run build",
104104
"format": "prettier --write '{src,__tests__,declarations,bin,default_theme}/**/*.js' --single-quote",
105-
"doc": "./bin/documentation.js build src/index.js -f md --access=public > docs/NODE_API.md",
105+
"doc": "node ./bin/documentation.js build src/index.js -f md --access=public > docs/NODE_API.md",
106106
"self-lint": "node ./bin/documentation.js lint src",
107107
"test": "npm run build && eslint . && are-we-flow-yet src && flow check && jest",
108108
"test-ci": "npm run build && eslint . && are-we-flow-yet src && flow check && jest --runInBand"
@@ -139,4 +139,4 @@
139139
"yargs"
140140
]
141141
}
142-
}
142+
}

src/commands/readme.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ module.exports.description = 'inject documentation into your README.md';
1717
* @private
1818
*/
1919
module.exports.builder = {
20-
usage: 'Usage: documentation readme [--readme-file=README.md] --section "API"' +
20+
usage:
21+
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
2122
' [--compare-only] [other documentationjs options]',
2223
example: 'documentation readme index.js -s "API Docs" --github',
2324
'readme-file': {
@@ -26,12 +27,14 @@ module.exports.builder = {
2627
},
2728
section: {
2829
alias: 's',
29-
describe: 'The section heading after which to inject generated documentation',
30+
describe:
31+
'The section heading after which to inject generated documentation',
3032
required: true
3133
},
3234
'diff-only': {
3335
alias: 'd',
34-
describe: 'Instead of updating the given README with the generated documentation,' +
36+
describe:
37+
'Instead of updating the given README with the generated documentation,' +
3538
' just check if its contents match, exiting nonzero if not.',
3639
default: false
3740
},
@@ -42,8 +45,6 @@ module.exports.builder = {
4245
}
4346
};
4447

45-
function noop() {}
46-
4748
/**
4849
* Insert API documentation into a Markdown readme
4950
* @private
@@ -68,9 +69,11 @@ module.exports.handler = function readme(argv: Object) {
6869

6970
argv.format = 'remark';
7071
/* eslint no-console: 0 */
71-
var log = argv.q
72-
? noop
73-
: console.log.bind(console, '[documentation-readme] ');
72+
const log: Function = (...data: Array<string>) => {
73+
if (!argv.q) {
74+
console.log.apply(console, data);
75+
}
76+
};
7477

7578
var readmeContent = fs.readFileSync(argv.readmeFile, 'utf8');
7679

src/extractors/exported.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function getCachedData(dataCache, filePath) {
184184
var value = dataCache.get(path);
185185
if (!value) {
186186
var input = fs.readFileSync(path, 'utf-8');
187-
var ast = parseToAst(input, path);
187+
var ast = parseToAst(input);
188188
value = {
189189
data: {
190190
file: path,

src/parse.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,10 @@ function todo() {}
414414
* @param {string} key the eventual destination key
415415
* @returns {Function} a flattener that remembers that key
416416
*/
417-
function synonym(key) {
418-
return function(result, tag) {
419-
return flatteners[key](result, tag, key);
417+
function synonym(key: string) {
418+
return function(result: Object, tag: Object) {
419+
const fun = flatteners[key];
420+
fun.apply(null, [result, tag, key].slice(0, fun.length));
420421
};
421422
}
422423

src/parsers/javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function leftPad(str, width) {
3737
function parseJavaScript(data: Object, config: DocumentationConfig) {
3838
var visited = new Set();
3939

40-
var ast = parseToAst(data.source, data.file);
40+
var ast = parseToAst(data.source);
4141
var addComment = _addComment.bind(null, visited);
4242

4343
return _.flatMap(

src/smart_glob.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ function resolveFileGlobPatterns(patterns, extensions) {
8686
* @returns Resolved absolute filenames.
8787
*/
8888
function listFilesToProcess(globPatterns: Array<string>): Array<string> {
89-
var files = [], added = new Set();
89+
var files = [],
90+
added = new Set();
9091

9192
var cwd = process.cwd();
9293

@@ -107,7 +108,7 @@ function listFilesToProcess(globPatterns: Array<string>): Array<string> {
107108
globPatterns.forEach(function(pattern) {
108109
var file = path.resolve(cwd, pattern);
109110
if (shell.test('-f', file)) {
110-
addFile(fs.realpathSync(file), !shell.test('-d', file));
111+
addFile(fs.realpathSync(file));
111112
} else {
112113
var globOptions = {
113114
nodir: true,
@@ -116,7 +117,7 @@ function listFilesToProcess(globPatterns: Array<string>): Array<string> {
116117
};
117118

118119
glob.sync(pattern, globOptions).forEach(function(globMatch) {
119-
addFile(path.resolve(cwd, globMatch), false);
120+
addFile(path.resolve(cwd, globMatch));
120121
});
121122
}
122123
});

0 commit comments

Comments
 (0)