Skip to content

Commit

Permalink
Upgrade eslint-plugin-import to support flow interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw committed Jun 29, 2017
1 parent 8fd6325 commit d963c4f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 38 deletions.
55 changes: 29 additions & 26 deletions flow-typed/overrides/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,57 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import type {
// eslint-disable-next-line import/named
IDBFactory,
} from '../../src/types/indexeddb';
import type { IDBFactory } from '../../src/types/indexeddb';

type Lib = { debugName: string };

declare class SymbolTable {
constructor(): SymbolTable;
getFuncAddressTableForLib(lib: Lib): Promise<Uint32Array>;
constructor(): SymbolTable,
getFuncAddressTableForLib(lib: Lib): Promise<Uint32Array>,
getSymbolsForAddressesInLib(
requestedAddressesIndices: number[],
lib: Lib
): Promise<string[]>;
): Promise<string[]>,
}

declare class GeckoProfiler {
getProfile: () => Object;
getSymbolTable: (debugName: string, breakpadId: string) => Promise<SymbolTable>;
getProfile: () => Object,
getSymbolTable: (
debugName: string,
breakpadId: string
) => Promise<SymbolTable>,
}

declare class Window extends EventTarget {
// perf.html and Gecko Profiler Addon
geckoProfilerPromise: Promise<GeckoProfiler>;
geckoProfilerAddonInstalled?: () => void;
isGeckoProfilerAddonInstalled?: boolean;
geckoProfilerPromise: Promise<GeckoProfiler>,
geckoProfilerAddonInstalled?: () => void,
isGeckoProfilerAddonInstalled?: boolean,
legacyRangeFilters: Array<{
start: number,
end: number,
}>;
}>,
InstallTrigger?: {
install: Object => {},
};
},

// Built-ins.
getComputedStyle: (element: HTMLElement, pseudoEl: ?string) => CSSStyleDeclaration,
getComputedStyle: (
element: HTMLElement,
pseudoEl: ?string
) => CSSStyleDeclaration,
DOMRect: typeof DOMRect,
requestIdleCallback: typeof requestIdleCallback;
requestAnimationFrame: typeof requestAnimationFrame;
devicePixelRatio: number;
indexedDB: IDBFactory;
IDBKeyRange: IDBKeyRange;
innerWidth: number;
innerHeight: number;
location: Location;
history: History;
Worker: typeof Worker;
WheelEvent: WheelEvent;
requestIdleCallback: typeof requestIdleCallback,
requestAnimationFrame: typeof requestAnimationFrame,
devicePixelRatio: number,
indexedDB: IDBFactory,
IDBKeyRange: IDBKeyRange,
innerWidth: number,
innerHeight: number,
location: Location,
history: History,
Worker: typeof Worker,
WheelEvent: WheelEvent,
}

declare var window: Window;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"eslint-config-google": "^0.6.0",
"eslint-config-prettier": "^2.2.0",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-prettier": "^2.1.2",
"eslint-plugin-react": "^6.4.0",
"express": "^4.15.3",
Expand Down
1 change: 0 additions & 1 deletion src/components/app/URLManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import React, { PureComponent, PropTypes } from 'react';
import { connect } from 'react-redux';
import { getIsURLSetupDone } from '../../reducers/app';

// eslint-disable-next-line import/named
import type { Dispatch } from '../../types/store';

type Props = {
Expand Down
2 changes: 0 additions & 2 deletions src/profile-logic/symbol-store-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

// @flow

/* eslint-disable import/named */
import type {
IDBFactory,
IDBDatabase,
IDBObjectStore,
IDBIndex,
IDBKeyRange,
} from '../types/indexeddb';
/* eslint-enable import/named */

export type SymbolTableAsTuple = [
Uint32Array, // addrs
Expand Down
2 changes: 1 addition & 1 deletion src/types/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
ThunkAction as ReduxThunkAction,
Dispatch as ReduxDispatch,
GetState as ReduxGetState,
} from 'redux'; // eslint-disable-line import/named
} from 'redux';
/* eslint-enable import/named */
import type { Action as ActionsRef } from './actions';
import type { State as StateRef } from './reducers';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/css-geometry-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import DOMRect from './dom-rect';
// Imported interfaces incorrectly throw an error in eslint:
// https://github.com/benmosher/eslint-plugin-import/issues/726
import type { DOMRectInterface } from './dom-rect'; // eslint-disable-line import/named
import type { DOMRectInterface } from './dom-rect';

/**
* Return a float number for the number of CSS pixels from the computed style
Expand Down
8 changes: 2 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ eslint-plugin-flowtype@^2.30.0:
dependencies:
lodash "^4.15.0"

eslint-plugin-import@^2.2.0:
eslint-plugin-import@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.6.1.tgz#f580be62bb809421d46e338372764afcc9f59bf6"
dependencies:
Expand Down Expand Up @@ -3206,14 +3206,10 @@ husky@^0.14.1:
normalize-path "^1.0.0"
strip-indent "^2.0.0"

[email protected]:
[email protected], iconv-lite@~0.4.13:
version "0.4.13"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"

iconv-lite@~0.4.13:
version "0.4.18"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"

icss-replace-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
Expand Down

0 comments on commit d963c4f

Please sign in to comment.