Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
[fixed] flowtype - prefer shorthand array
Browse files Browse the repository at this point in the history
  • Loading branch information
thealjey committed Jan 30, 2017
1 parent 33a0c97 commit e56d58c
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion interfaces/chai.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
type Assert = {
not: Assert;
a(type: string): void;
calledWith(...args: Array<any>): void;
calledWith(...args: any[]): void;
called: void;
equal(obj: any): void;
eql(obj: any): void;
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cheerio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

type DOM = {
toArray(): Array<Object>;
toArray(): Object[];
html(): string;
children(): DOM;
each(iteratee: (i: number, el: Object) => any): DOM;
Expand Down
4 changes: 2 additions & 2 deletions interfaces/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ type ESLintMessage = {
};
type ESLintResult = {
filePath: string;
messages: Array<ESLintMessage>;
messages: ESLintMessage[];
};

declare module 'eslint' {
declare class CLIEngine {
options: {configFile: string};
constructor(config: Object): void;
executeOnFiles(files: Array<string>): {results: Array<ESLintResult>};
executeOnFiles(files: string[]): {results: ESLintResult[]};
}
}
60 changes: 30 additions & 30 deletions interfaces/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare class Request {
fresh: boolean;
hostname: string;
ip: string;
ips: Array<string>;
ips: string[];
method: string;
params: Object | any[];
path: string;
Expand All @@ -22,12 +22,12 @@ declare class Request {
secure: boolean;
signedCookies: Object;
stale: boolean;
subdomains: Array<string>;
subdomains: string[];
xhr: boolean;
accepts(types: string | string[]): ?string;
acceptsCharsets(...charset: Array<string>): ?string;
acceptsEncodings(...encoding: Array<string>): ?string;
acceptsLanguages(...lang: Array<string>): ?string;
acceptsCharsets(...charset: string[]): ?string;
acceptsEncodings(...encoding: string[]): ?string;
acceptsLanguages(...lang: string[]): ?string;
get(field: string): ?string;
is(type: string): boolean;
range(size: number, options?: {combine: boolean}): number | Array<{start: number; end: number}>;
Expand Down Expand Up @@ -99,15 +99,15 @@ type ExpressMiddleware = (req: Request, res: Response, next?: Function) => void;
declare class ExpressApplication extends EventEmitter {
locals: Object;
mountpath: string | string[];
all(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
delete(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
all(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
delete(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
disable(name: string): ExpressApplication;
disabled(name: string): boolean;
enable(name: string): ExpressApplication;
enabled(name: string): boolean;
engine(ext: string, callback: (path: string, options: Object, callback: Function) => void): ExpressApplication;
get(name: string): any;
get(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
get(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
listen(port: number): ExpressApplication;
listen(port: number, hostname: string): ExpressApplication;
listen(port: number, backlog: number): ExpressApplication;
Expand All @@ -116,33 +116,33 @@ declare class ExpressApplication extends EventEmitter {
listen(port: number, hostname: string, callback: Function): ExpressApplication;
listen(port: number, backlog: number, callback: Function): ExpressApplication;
listen(port: number, hostname: string, backlog: number, callback: Function): ExpressApplication;
checkout(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
copy(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
head(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
lock(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
merge(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
mkactivity(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
mkcol(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
move(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
notify(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
options(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
patch(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
purge(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
report(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
search(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
subscribe(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
trace(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
unlock(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
unsubscribe(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
checkout(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
copy(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
head(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
lock(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
merge(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
mkactivity(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
mkcol(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
move(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
notify(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
options(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
patch(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
purge(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
report(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
search(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
subscribe(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
trace(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
unlock(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
unsubscribe(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
param(callback: (req: Request, res: Response, next: Function, id: string) => void): ExpressApplication;
param(name: string, callback: (req: Request, res: Response, next: Function, id: string) => void): ExpressApplication;
path(): string;
post(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
put(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
post(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
put(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
render(view: string, callback: RenderCallback): ExpressApplication;
render(view: string, locals: Object, callback: RenderCallback): ExpressApplication;
route(path: string): ExpressApplication;
set(name: string, value: any): ExpressApplication;
use(...callback: Array<ExpressMiddleware>): ExpressApplication;
use(path: string, ...callback: Array<ExpressMiddleware>): ExpressApplication;
use(...callback: ExpressMiddleware[]): ExpressApplication;
use(path: string, ...callback: ExpressMiddleware[]): ExpressApplication;
}
2 changes: 1 addition & 1 deletion interfaces/fb-watchman.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import EventEmitter from 'events';
declare module 'fb-watchman' {
declare class Client extends EventEmitter {
capabilityCheck(config: Object, callback: (error: ?Error) => void): void;
command(cmd: Array<any>, callback: ObjectOrErrorCallback): void;
command(cmd: any[], callback: ObjectOrErrorCallback): void;
}
}
2 changes: 1 addition & 1 deletion interfaces/jsdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare module 'jsdom' {
setEnd(): void;
setStart(): void;
getBoundingClientRect(): Object;
getClientRects(): Array<any>;
getClientRects(): any[];
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions interfaces/postcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import type {PostCSSWarning} from '../src/typedef';
type PostCSSResult = {
css: string;
map: Object;
warnings(): Array<PostCSSWarning>;
warnings(): PostCSSWarning[];
};

type PostCSSPromise = {
then(onFulfilled: (result: PostCSSResult) => void, onRejected: (error: Error) => void): void;
};

declare module 'postcss' {
declare function exports(plugins: Array<any>): {process: (code: string, config: Object) => PostCSSPromise};
declare function exports(plugins: any[]): {process: (code: string, config: Object) => PostCSSPromise};
}
2 changes: 1 addition & 1 deletion interfaces/serve-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare module 'serve-static' {
declare function exports(root: string, options?: {
dotfiles?: string;
etag?: boolean;
extensions?: boolean | Array<string>;
extensions?: boolean | string[];
fallthrough?: boolean;
index?: any;
lastModified?: boolean;
Expand Down
8 changes: 4 additions & 4 deletions interfaces/sinon.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* @flow */

type Spy = {
(...args: Array<any>): any;
(...args: any[]): any;
callCount: number;
};

type Stub = {
(...args: Array<any>): any;
(...args: any[]): any;
returns(obj: any): any;
returnsArg(i: number): any;
throws(err: Error): any;
callsArg(i: number): any;
callsArgWith(i: number, ...args: Array<any>): any;
callsArgWith(i: number, ...args: any[]): any;
};

declare module 'sinon' {
declare function spy(obj: ?any, method: ?string): Spy;
declare function stub(obj: ?any, method: ?string, func: ?(...args: Array<any>) => any): Stub;
declare function stub(obj: ?any, method: ?string, func: ?(...args: any[]) => any): Stub;
declare var match: {
(callback: (value: any) => boolean): void;
func: void;
Expand Down
24 changes: 12 additions & 12 deletions interfaces/webcompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare module 'webcompiler' {

declare class NativeProcess {
constructor(task: string): void;
run(callback: ?StringOrErrorCallback, args: ?Array<string>, opts: ?Object): void;
run(callback: ?StringOrErrorCallback, args: ?string[], opts: ?Object): void;
kill(): void;
}

Expand All @@ -16,12 +16,12 @@ declare module 'webcompiler' {
run(callback: () => void): void;
}

declare function flatten(...args: Array<any>): Array<any>;
declare function arrayToJSX(arr: ?Array<string | Object>): Array<any>;
declare function flatten(...args: any[]): any[];
declare function arrayToJSX(arr: ?Array<string | Object>): any[];
declare function htmlToArray(html: ?string): Array<string | Object>;
declare function htmlToJSX(html: ?string): Array<any>;
declare function htmlToJSX(html: ?string): any[];
declare function markdownToArray(markdown: ?string): Array<string | Object>;
declare function markdownToJSX(markdown: ?string): Array<any>;
declare function markdownToJSX(markdown: ?string): any[];
declare function markdownToHTML(markdown: ?string): string;
declare function highlightHTML(code: ?string): string;
declare function highlightArray(code: ?string): Array<string | Object>;
Expand Down Expand Up @@ -72,7 +72,7 @@ declare module 'webcompiler' {

declare class JSLint {
constructor(rules: ?Object): void;
run(paths: Array<string>, callback: LintCallback): void;
run(paths: string[], callback: LintCallback): void;
}

declare class JSCompiler {
Expand All @@ -83,7 +83,7 @@ declare module 'webcompiler' {

declare class SASSLint {
constructor(...excludeLinter: Array<string>): void;
run(paths: Array<string>, callback: LintCallback): void;
run(paths: string[], callback: LintCallback): void;
}

declare class SASSCompiler {
Expand All @@ -96,17 +96,17 @@ declare module 'webcompiler' {
compiler: JSCompiler;
constructor(compress: ?boolean, lintRules: ?Object): void;
typecheck(callback: () => void): void;
lint(paths: Array<string>, callback: () => void): void;
be(inPath: string, outPath: string, lintPaths: ?Array<string>, callback: ?() => void): void;
fe(inPath: string, outPath: string, lintPaths: ?Array<string>, callback: ?() => void): void;
lint(paths: string[], callback: () => void): void;
be(inPath: string, outPath: string, lintPaths: ?string[], callback: ?() => void): void;
fe(inPath: string, outPath: string, lintPaths: ?string[], callback: ?() => void): void;
}

declare class SASS {
compiler: SASSCompiler;
constructor(compress: ?boolean, includePaths: ?Array<string>, excludeLinter: ?Array<string>,
importOnceOptions: ?Object): void;
lint(paths: Array<string>, callback: () => void): void;
fe(inPath: string, outPath: string, lintPaths: ?Array<string>, callback: ?() => void): void;
lint(paths: string[], callback: () => void): void;
fe(inPath: string, outPath: string, lintPaths: ?string[], callback: ?() => void): void;
}

declare class DevServer {
Expand Down
2 changes: 1 addition & 1 deletion interfaces/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare module 'webpack-dev-server' {
declare class exports {
app: ExpressApplication;
constructor(webpack: Object): void;
use(...callback: Array<ExpressMiddleware>): void;
use(...callback: ExpressMiddleware[]): void;
listen(port: number, host: string, callback: (error: ?Error) => void): void;
}
}
4 changes: 2 additions & 2 deletions interfaces/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

type WebPackStats = {
toJson(): {
errors: Array<string>;
warnings: Array<string>;
errors: string[];
warnings: string[];
};
};
type WebPackCallback = (error: ?Error, stats: WebPackStats) => void;
Expand Down
8 changes: 4 additions & 4 deletions src/JS.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class JS {
* // successfully linted
* });
*/
lint(paths: Array<string>, callback: () => void) {
lint(paths: string[], callback: () => void) {
this.linter.run(paths, linterErr => {
if (linterErr) {
return logLintingErrors(linterErr, 'JavaScript');
Expand All @@ -119,7 +119,7 @@ export class JS {
* // successfully validated
* });
*/
validate(inPath: string, lintPaths: Array<string>, callback: () => void) {
validate(inPath: string, lintPaths: string[], callback: () => void) {
JS.typecheck(() => {
this.lint(lintPaths.concat([inPath]), callback);
});
Expand All @@ -141,7 +141,7 @@ export class JS {
* // the code has passed all the checks and has been compiled successfully
* });
*/
be(inPath: string, outPath: string, lintPaths: Array<string> = [], callback: () => void = noop) {
be(inPath: string, outPath: string, lintPaths: string[] = [], callback: () => void = noop) {
this.validate(inPath, lintPaths, () => {
this.compiler.be(inPath, outPath, callback);
});
Expand All @@ -163,7 +163,7 @@ export class JS {
* // the code has passed all the checks and has been compiled successfully
* });
*/
fe(inPath: string, outPath: string, lintPaths: Array<string> = [], callback: () => void = noop) {
fe(inPath: string, outPath: string, lintPaths: string[] = [], callback: () => void = noop) {
this.validate(inPath, lintPaths, () => {
this.compiler.fe(inPath, outPath, callback);
});
Expand Down
2 changes: 1 addition & 1 deletion src/JSLint.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class JSLint {
* // there were no linting errors
* });
*/
run(paths: Array<string>, callback: LintCallback) {
run(paths: string[], callback: LintCallback) {
const {results} = this.linter.executeOnFiles(paths),
errors = [];

Expand Down
2 changes: 1 addition & 1 deletion src/NativeProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class NativeProcess {
* // created a directory named "example" in cwd
* }, ['example']);
*/
run(callback: StringOrErrorCallback = noop, args: Array<string> = [], opts: Object = {}) {
run(callback: StringOrErrorCallback = noop, args: string[] = [], opts: Object = {}) {
if (this.proc) {
return callback(new Error('Still working'), '');
}
Expand Down
6 changes: 3 additions & 3 deletions src/SASS.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class SASS {
linter: SASSLint;

/* eslint-disable require-jsdoc */
constructor(compress: boolean = true, includePaths: Array<string> = [], configFile: string = defaultConfigFile,
constructor(compress: boolean = true, includePaths: string[] = [], configFile: string = defaultConfigFile,
importOnceOptions: Object = {}) {
/* eslint-enable require-jsdoc */
this.compiler = new SASSCompiler(compress, includePaths, importOnceOptions);
Expand All @@ -80,7 +80,7 @@ export class SASS {
* // successfully linted
* });
*/
lint(paths: Array<string>, callback: () => void) {
lint(paths: string[], callback: () => void) {
this.linter.run(paths, linterErr => {
if (linterErr) {
return logLintingErrors(linterErr, 'SASS');
Expand All @@ -107,7 +107,7 @@ export class SASS {
* // the code has passed all the checks and has been compiled successfully
* });
*/
fe(inPath: string, outPath: string, lintPaths: Array<string> = [], callback: () => void = noop) {
fe(inPath: string, outPath: string, lintPaths: string[] = [], callback: () => void = noop) {
this.lint(lintPaths.concat([inPath]), () => {
this.compiler.fe(inPath, outPath, callback);
});
Expand Down
4 changes: 2 additions & 2 deletions src/SASSCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class SASSCompiler extends Compiler {
* @private
* @instance
*/
includePaths: Array<string>;
includePaths: string[];

/**
* importOnce resolver configuration
Expand All @@ -68,7 +68,7 @@ export class SASSCompiler extends Compiler {
importOnce: Object;

/* eslint-disable require-jsdoc */
constructor(compress: boolean = true, includePaths: Array<string> = [], importOnceOptions: Object = {}) {
constructor(compress: boolean = true, includePaths: string[] = [], importOnceOptions: Object = {}) {
/* eslint-enable require-jsdoc */
super(compress);
this.includePaths = defaultIncludePaths.concat(includePaths);
Expand Down
2 changes: 1 addition & 1 deletion src/SASSLint.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class SASSLint {
* // there were no linting errors
* });
*/
run(paths: Array<string>, callback: LintCallback) {
run(paths: string[], callback: LintCallback) {
lint({configFile: this.configFile, files: paths}).then(({results}) => {
const errors = [];

Expand Down
Loading

0 comments on commit e56d58c

Please sign in to comment.