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

Commit

Permalink
[fixed] lint the interface files
Browse files Browse the repository at this point in the history
  • Loading branch information
thealjey committed Jul 9, 2016
1 parent 8310319 commit d2cc0aa
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 67 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/config/**
/coverage/**
/docs/**
/interfaces/**
/node_modules/**
3 changes: 2 additions & 1 deletion bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ const rootDir = join(__dirname, '..'),
srcDir = join(rootDir, 'src'),
libDir = join(rootDir, 'lib'),
testDir = join(rootDir, 'test'),
interfacesDir = join(rootDir, 'interfaces'),
js = new JS(),
npm = new NativeProcess('npm');

js.be(srcDir, libDir, [testDir, binDir], () => {
js.be(srcDir, libDir, [testDir, binDir, interfacesDir], () => {
npm.run(stderr => {
if (stderr) {
return console.error(stderr);
Expand Down
2 changes: 2 additions & 0 deletions interfaces/autoprefixer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* @flow */

/* eslint-disable no-empty */

declare module 'autoprefixer' {}
28 changes: 14 additions & 14 deletions interfaces/chai.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* @flow */

type Assert = {
not: Assert,
a: (type: string) => void,
calledWith: (...args: Array<any>) => void,
called: void,
equal: (obj: any) => void,
eql: (obj: any) => void,
instanceof: (obj: any) => void,
contain: (obj: Object|string|number) => void,
returned: (obj: any) => void,
calledOnce: void,
calledTwice: void,
null: void,
false: void,
true: void
not: Assert;
a(type: string): void;
calledWith(...args: Array<any>): void;
called: void;
equal(obj: any): void;
eql(obj: any): void;
instanceof(obj: any): void;
contain(obj: Object|string|number): void;
returned(obj: any): void;
calledOnce: void;
calledTwice: void;
null: void;
false: void;
true: void;
};

declare module 'chai' {
Expand Down
16 changes: 8 additions & 8 deletions interfaces/cheerio.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* @flow */

type DOM = {
toArray: () => Array<Object>,
html: () => string,
children: () => DOM,
each: (iteratee: (i: number, el: Object) => any) => DOM,
find: (selector: string) => DOM,
removeAttr: (attr: string) => void
toArray(): Array<Object>;
html(): string;
children(): DOM;
each(iteratee: (i: number, el: Object) => any): DOM;
find(selector: string): DOM;
removeAttr(attr: string): void;
};

declare module 'cheerio' {
declare function load(html: string): {
(): DOM,
root: () => DOM
(): DOM;
root(): DOM;
};
}
2 changes: 2 additions & 0 deletions interfaces/codemirror.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* @flow */

/* eslint-disable no-empty */

declare module 'codemirror' {
declare function exports(el: any, options: ?Object): void;
}
Expand Down
15 changes: 12 additions & 3 deletions interfaces/eslint.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
/* @flow */

type ESLintMessage = {message: string, ruleId?: string, line: number, column: number, filePath: string};
type ESLintResult = {filePath: string, messages: Array<ESLintMessage>};
type ESLintMessage = {
message: string;
ruleId?: string;
line: number;
column: number;
filePath: string;
};
type ESLintResult = {
filePath: string;
messages: Array<ESLintMessage>;
};

declare module 'eslint' {
declare class CLIEngine {
options: {rules: Object};
constructor(config: Object): void;
executeOnFiles(files: Array<string>): {results: Array<ESLintResult>}
executeOnFiles(files: Array<string>): {results: Array<ESLintResult>};
}
}
2 changes: 2 additions & 0 deletions interfaces/fb-watchman.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* @flow */

/* eslint-disable no-unused-vars */

import type {ObjectOrErrorCallback} from '../src/typedef';
import EventEmitter from 'events';

Expand Down
16 changes: 8 additions & 8 deletions interfaces/jsdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
declare module 'jsdom' {
declare function jsdom(): {
defaultView: {
navigator: any,
navigator: any;
document: {
createRange: () => {
setEnd: () => void,
setStart: () => void,
getBoundingClientRect: () => {}
}
}
}
createRange(): {
setEnd(): void;
setStart(): void;
getBoundingClientRect(): Object;
};
};
};
};
}
2 changes: 2 additions & 0 deletions interfaces/node-sass-import-once.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* @flow */

/* eslint-disable no-empty */

declare module 'node-sass-import-once' {}
9 changes: 7 additions & 2 deletions interfaces/node-sass.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/* @flow */

type NodeSassError = {message: string, file: string, line: number, column: number};
type NodeSassCallback = (error: ?NodeSassError, result: {css: string, map: string}) => void;
type NodeSassError = {
message: string;
file: string;
line: number;
column: number;
};
type NodeSassCallback = (error: ?NodeSassError, result: {css: string; map: string;}) => void;

declare module 'node-sass' {
declare function render(options: Object, callback: NodeSassCallback): void;
Expand Down
10 changes: 8 additions & 2 deletions interfaces/postcss.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/* @flow */

type PostCSSResult = {css: string, map: Object, warnings: () => Array<string>};
type PostCSSPromise = {then: (callback: (result: PostCSSResult) => void) => void};
type PostCSSResult = {
css: string;
map: Object;
warnings(): Array<string>;
};
type PostCSSPromise = {
then(callback: (result: PostCSSResult) => void): void;
};

declare module 'postcss' {
declare function exports(plugins: Array<any>): {process: (code: string, config: Object) => PostCSSPromise};
Expand Down
33 changes: 13 additions & 20 deletions interfaces/react.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
/* @flow */

type PropTypesObject = {
instanceOf: (obj: any) => void,
arrayOf: (obj: any) => void,
string: {isRequired: void},
any: {isRequired: void},
object: {isRequired: void},
bool: {isRequired: void},
array: {isRequired: void},
number: {isRequired: void},
func: {isRequired: void}
};

declare module 'react' {
declare function createElement(type: any, props: ?Object, ...children: Array<any>): void;
declare var PropTypes: PropTypesObject;
declare var PropTypes: {
instanceOf(obj: any): void;
arrayOf(obj: any): void;
string: {isRequired: void};
any: {isRequired: void};
object: {isRequired: void};
bool: {isRequired: void};
array: {isRequired: void};
number: {isRequired: void};
func: {isRequired: void};
};
declare class Component {}
}

declare module 'react/lib/ReactWithAddons' {
declare function createElement(type: any, props: ?Object, ...children: Array<any>): void;
declare var PropTypes: PropTypesObject;
declare class Component {}
declare var addons: {
shallowCompare: (component: any, props: Object, state: Object) => boolean
};
declare module 'react/lib/shallowCompare' {
declare function exports(component: any, props: Object, state: Object): boolean;
}
2 changes: 2 additions & 0 deletions interfaces/sinon-chai.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* @flow */

/* eslint-disable no-empty */

declare module 'sinon-chai' {}
16 changes: 10 additions & 6 deletions interfaces/sinon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ type Spy = {
};

type Stub = {
returns: (obj: any) => any,
returnsArg: (i: number) => any,
throws: (err: Error) => any,
callsArg: (i: number) => any,
callsArgWith: (i: number, ...args: Array<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;
};

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 var match: {(callback: (value: any) => boolean): void, func: void, instanceOf: (obj: any) => void};
declare var match: {
(callback: (value: any) => boolean): void;
func: void;
instanceOf(obj: any): void;
};
}
5 changes: 4 additions & 1 deletion interfaces/tiny-lr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* @flow */

declare module 'tiny-lr' {
declare function exports(): {changed: (config: Object) => void, listen: (port: number) => void};
declare function exports(): {
changed(config: Object): void;
listen(port: number): void;
};
}
7 changes: 6 additions & 1 deletion interfaces/webpack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/* @flow */

type WebPackStats = {toJson: () => {errors: Array<string>, warnings: Array<string>}};
type WebPackStats = {
toJson(): {
errors: Array<string>;
warnings: Array<string>;
};
};
type WebPackCallback = (error: ?string, stats: WebPackStats) => void;

declare module 'webpack' {
Expand Down

0 comments on commit d2cc0aa

Please sign in to comment.