From e5ed4fc91679670a415f2534005ef8d67ec2189e Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 28 Mar 2017 10:56:00 -0700 Subject: [PATCH] Apply new lint rules to even more files (#15445) --- types/parseurl/index.d.ts | 2 +- types/react-maskedinput/index.d.ts | 8 +- types/react-modal/index.d.ts | 4 +- types/react-modal/react-modal-tests.tsx | 7 +- .../index.d.ts | 26 +- .../react-notification-system-redux-tests.tsx | 2 - types/react-router-redux/index.d.ts | 6 +- types/react-sticky/index.d.ts | 27 +- types/react-svg-pan-zoom/index.d.ts | 360 +++++++++--------- .../react-svg-pan-zoom-tests.tsx | 3 +- types/react-tether/index.d.ts | 8 +- types/react-tether/react-tether-tests.tsx | 2 +- types/realm/index.d.ts | 38 +- types/realm/realm-tests.ts | 1 - .../reduce-reducers/reduce-reducers-tests.ts | 10 +- types/reflux/reflux-tests.ts | 21 +- types/revalidate/index.d.ts | 10 +- types/revalidate/revalidate-tests.ts | 4 +- types/rrule/index.d.ts | 9 +- types/rrule/test/rrule.ts | 3 +- types/rx-core-binding/index.d.ts | 20 +- types/rx-core/index.d.ts | 10 +- types/rx-lite-aggregates/index.d.ts | 2 +- types/rx-lite-backpressure/index.d.ts | 6 +- .../rx-lite-backpressure-tests.ts | 12 +- types/rx-lite-testing/index.d.ts | 14 +- types/rx-lite-time/index.d.ts | 2 +- types/rx-lite-virtualtime/index.d.ts | 6 +- types/rx-lite/index.d.ts | 65 ++-- types/rx-lite/rx-lite-tests.ts | 45 +-- types/session-file-store/index.d.ts | 15 +- .../session-file-store-tests.ts | 4 +- types/sheetify/index.d.ts | 2 +- types/sheetify/sheetify-tests.ts | 2 +- types/simple-peer/index.d.ts | 15 +- types/sip.js/index.d.ts | 6 +- types/sip.js/sip.js-tests.ts | 10 +- types/sitemap2/index.d.ts | 12 +- types/sitemap2/sitemap2-tests.ts | 8 +- types/sitemap2/tslint.json | 7 +- types/speakingurl/index.d.ts | 2 +- types/speakingurl/speakingurl-tests.ts | 2 +- types/sqlite3/index.d.ts | 15 +- types/sqlite3/sqlite3-tests.ts | 11 +- types/stamplay-js-sdk/index.d.ts | 16 +- .../stamplay-js-sdk/stamplay-js-sdk-tests.ts | 24 +- types/stamplay-js-sdk/tslint.json | 7 +- types/steed/index.d.ts | 6 +- types/steed/steed-tests.ts | 51 +-- types/stream-buffers/index.d.ts | 12 +- types/stream-buffers/stream-buffers-tests.ts | 12 +- types/strong-cluster-control/index.d.ts | 10 +- types/swagger-sails-hook/index.d.ts | 7 +- .../swagger-sails-hook-tests.ts | 1 - types/swagger-schema-official/index.d.ts | 2 +- types/tedious-connection-pool/index.d.ts | 6 +- .../tedious-connection-pool-tests.ts | 15 +- types/transducers-js/transducers-js-tests.ts | 56 +-- types/ui-router-extras/index.d.ts | 27 +- types/ui-router-extras/tslint.json | 5 +- .../ui-router-extras-tests.ts | 56 ++- types/universal-router/index.d.ts | 2 +- .../universal-router-tests.ts | 2 - types/vanilla-tilt/index.d.ts | 10 +- types/vanilla-tilt/vanilla-tilt-tests.ts | 7 +- types/voca/voca-tests.ts | 28 +- types/webmidi/index.d.ts | 34 +- types/webmidi/webmidi-tests.ts | 10 +- types/webtorrent/index.d.ts | 16 +- types/webtorrent/webtorrent-tests.ts | 8 +- types/wu/index.d.ts | 4 +- types/wu/wu-tests.ts | 12 +- .../yeoman-generator-tests.ts | 1 - 73 files changed, 594 insertions(+), 697 deletions(-) diff --git a/types/parseurl/index.d.ts b/types/parseurl/index.d.ts index 15140d9261..f88566178b 100644 --- a/types/parseurl/index.d.ts +++ b/types/parseurl/index.d.ts @@ -11,7 +11,7 @@ import { Url } from "url"; declare function parseurl(req: IncomingMessage): Url | undefined; declare namespace parseurl { - export function original(req: IncomingMessage): Url | undefined; + function original(req: IncomingMessage): Url | undefined; } export = parseurl; diff --git a/types/react-maskedinput/index.d.ts b/types/react-maskedinput/index.d.ts index 6602240c67..e5e49a5140 100644 --- a/types/react-maskedinput/index.d.ts +++ b/types/react-maskedinput/index.d.ts @@ -14,20 +14,18 @@ declare const MaskedInput: MaskedInput; type MaskedInput = ComponentClass; declare namespace MaskedInput { - - export interface FormatCharacter { + interface FormatCharacter { validate(char: string): string; transform?(char: string): string; } - export interface CharsFormatters { + interface CharsFormatters { [char: string]: FormatCharacter; } - export interface MaskedInputProps extends HTMLAttributes { + interface MaskedInputProps extends HTMLAttributes { mask: string; formatCharacter?: CharsFormatters; placeholderChar?: string; } } - diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index afec7250e2..d4a772366c 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -11,7 +11,7 @@ export as namespace ReactModal; export = ReactModal; declare namespace ReactModal { - export interface Styles { + interface Styles { content?: { [key: string]: any; }; @@ -20,7 +20,7 @@ declare namespace ReactModal { }; } - export interface Props { + interface Props { /* Boolean describing if the modal should be shown or not. Defaults to false. */ isOpen: boolean; /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ diff --git a/types/react-modal/react-modal-tests.tsx b/types/react-modal/react-modal-tests.tsx index c8e50a3057..d85796c065 100644 --- a/types/react-modal/react-modal-tests.tsx +++ b/types/react-modal/react-modal-tests.tsx @@ -3,9 +3,9 @@ import * as ReactModal from 'react-modal'; class ExampleOfUsingReactModal extends React.Component<{}, {}> { render() { - var onAfterOpenFn = () => { }; - var onRequestCloseFn = () => { }; - var customStyle = { + const onAfterOpenFn = () => { }; + const onRequestCloseFn = () => { }; + const customStyle = { overlay: { position: 'fixed', top: 0, @@ -27,7 +27,6 @@ class ExampleOfUsingReactModal extends React.Component<{}, {}> { borderRadius: '4px', outline: 'none', padding: '20px' - } }; return ( diff --git a/types/react-notification-system-redux/index.d.ts b/types/react-notification-system-redux/index.d.ts index 5820a48da5..ffcda21739 100644 --- a/types/react-notification-system-redux/index.d.ts +++ b/types/react-notification-system-redux/index.d.ts @@ -15,26 +15,24 @@ export = Notifications; declare class Notifications extends Component {} declare namespace Notifications { + type NotificationsState = Notification[]; - export type NotificationsState = Notification[]; + type NotificationLevel = "error" | "warning" | "info" | "success"; - export type NotificationLevel = "error" | "warning" | "info" | "success"; + type NotificationsReducer = (state: NotificationsState, action: A) => NotificationsState; - export type NotificationsReducer = (state: NotificationsState, action: A) => NotificationsState; + type NotificationShow = (opts?: Notification) => Action; - export type NotificationShow = (opts?: Notification) => Action; - - export interface NotificationsProps extends Attributes { + interface NotificationsProps extends Attributes { notifications?: Notification[]; } - export const reducer: NotificationsReducer; + const reducer: NotificationsReducer; - export const show: (opts?: Notification, level?: NotificationLevel) => Action; - export const error: NotificationShow; - export const hide: (opts?: Notification | string | number) => Action; - export const info: NotificationShow; - export const success: NotificationShow; - export const warning: NotificationShow; + function show(opts?: Notification, level?: NotificationLevel): Action; + const error: NotificationShow; + function hide(opts?: Notification | string | number): Action; + const info: NotificationShow; + const success: NotificationShow; + const warning: NotificationShow; } - diff --git a/types/react-notification-system-redux/react-notification-system-redux-tests.tsx b/types/react-notification-system-redux/react-notification-system-redux-tests.tsx index 59f1a8404f..83c8354c83 100644 --- a/types/react-notification-system-redux/react-notification-system-redux-tests.tsx +++ b/types/react-notification-system-redux/react-notification-system-redux-tests.tsx @@ -5,7 +5,6 @@ import * as Notifications from "react-notification-system-redux"; import { reducer, show, hide, info, error, warning, success, NotificationLevel } from "react-notification-system-redux"; class Test extends React.Component { - private test() { const notification: Notification = { message : "Test" @@ -27,7 +26,6 @@ class Test extends React.Component { const notifications: Notification[] = []; return (); } - } const store: Store = createStore(reducer); diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index 9f8044a7c0..92b625be82 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for react-router-redux 4.0 // Project: https://github.com/rackt/react-router-redux -// Definitions by: Isman Usoh , Noah Shipley , Dimitri Rosenberg , Karol Janyst , Dovydas Navickas +// Definitions by: Isman Usoh +// Noah Shipley +// Dimitri Rosenberg +// Karol Janyst +// Dovydas Navickas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/react-sticky/index.d.ts b/types/react-sticky/index.d.ts index 2126d582ef..8c965da4ab 100644 --- a/types/react-sticky/index.d.ts +++ b/types/react-sticky/index.d.ts @@ -6,22 +6,17 @@ import * as React from "react"; -declare module "react-sticky" { - - export var StickyContainer: React.ComponentClass>; - - export interface StickyProps { - isActive?: boolean; - className?: string; - style?: any; - stickyClassName?: string; - stickyStyle?: any; - topOffset?: number; - bottomOffset?: number; - onStickyStateChange?: (isSticky: boolean) => void; - } - - export var Sticky: React.ComponentClass; +export const StickyContainer: React.ComponentClass>; +export interface StickyProps { + isActive?: boolean; + className?: string; + style?: any; + stickyClassName?: string; + stickyStyle?: any; + topOffset?: number; + bottomOffset?: number; + onStickyStateChange?: (isSticky: boolean) => void; } +export const Sticky: React.ComponentClass; diff --git a/types/react-svg-pan-zoom/index.d.ts b/types/react-svg-pan-zoom/index.d.ts index 837890a507..31559cc4a8 100644 --- a/types/react-svg-pan-zoom/index.d.ts +++ b/types/react-svg-pan-zoom/index.d.ts @@ -5,194 +5,186 @@ // TypeScript Version: 2.2 import * as React from 'react'; -declare module 'react-svg-pan-zoom' { +// String constants: +export const MODE_IDLE = 'idle'; +export const MODE_PANNING = 'panning'; +export const MODE_ZOOMING = 'zooming'; - // String constants: - const MODE_IDLE = 'idle'; - const MODE_PANNING = 'panning'; - const MODE_ZOOMING = 'zooming'; +export const TOOL_AUTO = 'auto'; +export const TOOL_NONE = 'none'; +export const TOOL_PAN = 'pan'; +export const TOOL_ZOOM_IN = 'zoom-in'; +export const TOOL_ZOOM_OUT = 'zoom-out'; - export const TOOL_AUTO = 'auto'; - export const TOOL_NONE = 'none'; - export const TOOL_PAN = 'pan'; - export const TOOL_ZOOM_IN = 'zoom-in'; - export const TOOL_ZOOM_OUT = 'zoom-out'; +export const POSITION_NONE = 'none'; +export const POSITION_TOP = 'top'; +export const POSITION_RIGHT = 'right'; +export const POSITION_BOTTOM = 'bottom'; +export const POSITION_LEFT = 'left'; - export const POSITION_NONE = 'none'; - export const POSITION_TOP = 'top'; - export const POSITION_RIGHT = 'right'; - export const POSITION_BOTTOM = 'bottom'; - export const POSITION_LEFT = 'left'; +export type Mode = typeof MODE_IDLE | typeof MODE_PANNING | typeof MODE_ZOOMING; - export type Mode = typeof MODE_IDLE | typeof MODE_PANNING | typeof MODE_ZOOMING; - - export interface Value { - version: 2, - mode: Mode, - focus: boolean, - a: number, - b: number, - c: number, - d: number, - e: number, - f: number, - viewerWidth: number, - viewerHeight: number, - SVGWidth: number, - SVGHeight: number, - startX?: number | null, - startY?: number | null, - endX?: number | null, - endY?: number | null, - - } - - export type Tool = typeof TOOL_AUTO | typeof TOOL_NONE | typeof TOOL_PAN | - typeof TOOL_ZOOM_IN | typeof TOOL_ZOOM_OUT - export type ToolbarPosition = typeof POSITION_NONE | typeof POSITION_TOP | typeof POSITION_RIGHT | - typeof POSITION_BOTTOM | typeof POSITION_LEFT - - - export interface OptionalProps { - //background of the viewer - background: React.CSSProperties, - - //background of the svg - SVGBackground: string, - - //value of the viewer (current point of view) - value: Value | null, - - //CSS style of the Viewer - style: object, - - //className of the Viewer - className: string, - - //detect zoom operation performed trough pinch gesture or mouse scroll - detectWheel: boolean, - - //perform PAN if the mouse is on viewer border - detectAutoPan: boolean, - - //toolbar position - toolbarPosition: ToolbarPosition, - - //handler something changed - onChangeValue: (value: Value) => void, - - //handler tool changed - onChangeTool: (tool: Tool) => void, - - // Note: The `T` type parameter is the type of the `target` of the event: - //handler click - onClick: (event: ViewerMouseEvent) => void, - - //handler double click - onDoubleClick: (event: ViewerMouseEvent) => void, - - //handler mouseup - onMouseUp: (event: ViewerMouseEvent) => void, - - //handler mousemove - onMouseMove: (event: ViewerMouseEvent) => void, - - //handler mousedown - onMouseDown: (event: ViewerMouseEvent) => void, - - //if disabled the user can move the image outside the viewer - preventPanOutside: boolean, - - //how much scale in or out - scaleFactor: number, - - //current active tool (TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT) - tool: Tool, - - //modifier keys //https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState - modifierKeys: string[], - - //override default toolbar component - // TODO: specify function type more clearly - customToolbar: React.Component | React.StatelessComponent, - - // How about touch events? They are in README but not in `propTypes`. - } - - export interface RequiredProps { - //width of the viewer displayed on screen - width: number, - //height of the viewer displayed on screen - height: number, - - //accept only one node SVG - // TODO: Figure out how to constrain `children` or maybe just leave it commented out - // because `children` is already implicit props - // children: () => any - } - - export type Props = RequiredProps & Partial - - class ReactSVGPanZoom extends React.Component { - pan(SVGDeltaX: number, SVGDeltaY: number): void - zoom(SVGPointX: number, SVGPointY: number, scaleFactor: number): void - fitSelection(selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): void - fitToViewer(): void - setPointOnViewerCenter(SVGPointX: number, SVGPointY: number, zoomLevel: number): void - reset(): void - zoomOnViewerCenter(scaleFactor: number): void - getValue(): Value - setValue(value: Value): void - getTool(): Tool - setTool(tool: Tool): void - } - - - export interface Point { - x: number, - y: number, - } - - export interface ViewerMouseEvent{ - originalEvent: React.MouseEvent, - SVGViewer: SVGSVGElement, - point: Point, - x: number, - y: number, - scaleFactor: number, - translationX: number, - translationY: number, - preventDefault(): void - stopPropagation(): void - } - - export interface ViewerTouchEvent { - originalEvent: React.TouchEvent, - SVGViewer: SVGSVGElement, - points: Point[], - changedPoints: Point[], - scaleFactor: number, - translationX: number, - translationY: number, - preventDefault(): void - stopPropagation(): void - } - - // Utility functions exposed: - export function pan(value: Value, SVGDeltaX: number, SVGDeltaY: number, panLimit?: number): Value - - export function zoom(value: Value, SVGPointX: number, SVGPointY: number, scaleFactor: number): Value - - export function fitSelection( - value: Value, selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): Value - - export function fitToViewer(value: Value): Value - - export function zoomOnViewerCenter(value: Value, scaleFactor: number): Value - - export function setPointOnViewerCenter(value: Value, SVGPointX: number, SVGPointY: number, zoomLevel: number): Value - - export function reset(value: Value): Value +export interface Value { + version: 2; + mode: Mode; + focus: boolean; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + viewerWidth: number; + viewerHeight: number; + SVGWidth: number; + SVGHeight: number; + startX?: number | null; + startY?: number | null; + endX?: number | null; + endY?: number | null; } +export type Tool = typeof TOOL_AUTO | typeof TOOL_NONE | typeof TOOL_PAN | + typeof TOOL_ZOOM_IN | typeof TOOL_ZOOM_OUT; +export type ToolbarPosition = typeof POSITION_NONE | typeof POSITION_TOP | typeof POSITION_RIGHT | + typeof POSITION_BOTTOM | typeof POSITION_LEFT; +export interface OptionalProps { + // background of the viewer + background: React.CSSProperties; + + // background of the svg + SVGBackground: string; + + // value of the viewer (current point of view) + value: Value | null; + + // CSS style of the Viewer + style: object; + + // className of the Viewer + className: string; + + // detect zoom operation performed trough pinch gesture or mouse scroll + detectWheel: boolean; + + // perform PAN if the mouse is on viewer border + detectAutoPan: boolean; + + // toolbar position + toolbarPosition: ToolbarPosition; + + // handler something changed + onChangeValue(value: Value): void; + + // handler tool changed + onChangeTool(tool: Tool): void; + + // Note: The `T` type parameter is the type of the `target` of the event: + // handler click + onClick(event: ViewerMouseEvent): void; + + // handler double click + onDoubleClick(event: ViewerMouseEvent): void; + + // handler mouseup + onMouseUp(event: ViewerMouseEvent): void; + + // handler mousemove + onMouseMove(event: ViewerMouseEvent): void; + + // handler mousedown + onMouseDown(event: ViewerMouseEvent): void; + + // if disabled the user can move the image outside the viewer + preventPanOutside: boolean; + + // how much scale in or out + scaleFactor: number; + + // current active tool (TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT) + tool: Tool; + + // modifier keys //https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState + modifierKeys: string[]; + + // override default toolbar component + // TODO: specify function type more clearly + customToolbar: React.Component | React.StatelessComponent; + + // How about touch events? They are in README but not in `propTypes`. +} + +export interface RequiredProps { + // width of the viewer displayed on screen + width: number; + // height of the viewer displayed on screen + height: number; + + // accept only one node SVG + // TODO: Figure out how to constrain `children` or maybe just leave it commented out + // because `children` is already implicit props + // children: () => any; +} + +export type Props = RequiredProps & Partial; + +export class ReactSVGPanZoom extends React.Component { + pan(SVGDeltaX: number, SVGDeltaY: number): void; + zoom(SVGPointX: number, SVGPointY: number, scaleFactor: number): void; + fitSelection(selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): void; + fitToViewer(): void; + setPointOnViewerCenter(SVGPointX: number, SVGPointY: number, zoomLevel: number): void; + reset(): void; + zoomOnViewerCenter(scaleFactor: number): void; + getValue(): Value; + setValue(value: Value): void; + getTool(): Tool; + setTool(tool: Tool): void; +} + +export interface Point { + x: number; + y: number; +} + +export interface ViewerMouseEvent{ + originalEvent: React.MouseEvent; + SVGViewer: SVGSVGElement; + point: Point; + x: number; + y: number; + scaleFactor: number; + translationX: number; + translationY: number; + preventDefault(): void; + stopPropagation(): void; +} + +export interface ViewerTouchEvent { + originalEvent: React.TouchEvent; + SVGViewer: SVGSVGElement; + points: Point[]; + changedPoints: Point[]; + scaleFactor: number; + translationX: number; + translationY: number; + preventDefault(): void; + stopPropagation(): void; +} + +// Utility functions exposed: +export function pan(value: Value, SVGDeltaX: number, SVGDeltaY: number, panLimit?: number): Value; + +export function zoom(value: Value, SVGPointX: number, SVGPointY: number, scaleFactor: number): Value; + +export function fitSelection( + value: Value, selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): Value; + +export function fitToViewer(value: Value): Value; + +export function zoomOnViewerCenter(value: Value, scaleFactor: number): Value; + +export function setPointOnViewerCenter(value: Value, SVGPointX: number, SVGPointY: number, zoomLevel: number): Value; + +export function reset(value: Value): Value; diff --git a/types/react-svg-pan-zoom/react-svg-pan-zoom-tests.tsx b/types/react-svg-pan-zoom/react-svg-pan-zoom-tests.tsx index dbe8f0d55e..a2d078d6d2 100644 --- a/types/react-svg-pan-zoom/react-svg-pan-zoom-tests.tsx +++ b/types/react-svg-pan-zoom/react-svg-pan-zoom-tests.tsx @@ -7,9 +7,8 @@ import { ViewerMouseEvent } from 'react-svg-pan-zoom'; - class Example1 extends React.Component<{}, {}> { - Viewer: ReactSVGPanZoom + Viewer: ReactSVGPanZoom; constructor(props: Props) { super(props); } diff --git a/types/react-tether/index.d.ts b/types/react-tether/index.d.ts index 14344c5476..23270282f8 100644 --- a/types/react-tether/index.d.ts +++ b/types/react-tether/index.d.ts @@ -13,13 +13,13 @@ import * as Tether from 'tether'; declare class TetherComponent extends React.Component { } declare namespace ReactTether { - export interface TetherComponentProps extends React.Props, Tether.ITetherOptions { + interface TetherComponentProps extends React.Props, Tether.ITetherOptions { renderElementTag?: string; - renderElementTo?: string | {appendChild: (element: HTMLElement) => void}; + renderElementTo?: string | { appendChild(element: HTMLElement): void }; id?: string; className?: string; style?: React.CSSProperties; - onUpdate?: () => void; - onRepositioned?: () => void; + onUpdate?(): void; + onRepositioned?(): void; } } diff --git a/types/react-tether/react-tether-tests.tsx b/types/react-tether/react-tether-tests.tsx index 666329621e..531fbbf9e1 100644 --- a/types/react-tether/react-tether-tests.tsx +++ b/types/react-tether/react-tether-tests.tsx @@ -13,4 +13,4 @@ const ReactTetherAllOptions: JSX.Element = />; const ReactTetherRequiredOptions: JSX.Element = - ; \ No newline at end of file + ; diff --git a/types/realm/index.d.ts b/types/realm/index.d.ts index 974f2a4ed1..5f48d75ff7 100644 --- a/types/realm/index.d.ts +++ b/types/realm/index.d.ts @@ -9,13 +9,13 @@ declare namespace Realm { * PropertyType * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~PropertyType } */ - export type PropertyType = string | 'bool' | 'int' | 'float' | 'double' | 'string' | 'data' | 'date' | 'list'; + type PropertyType = string | 'bool' | 'int' | 'float' | 'double' | 'string' | 'data' | 'date' | 'list'; /** * ObjectSchemaProperty * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~ObjectSchemaProperty } */ - export interface ObjectSchemaProperty { + interface ObjectSchemaProperty { type: PropertyType; objectType?: string; default?: any; @@ -24,7 +24,7 @@ declare namespace Realm { } // properties types - export interface PropertiesTypes { + interface PropertiesTypes { [keys: string]: PropertyType | ObjectSchemaProperty; } @@ -32,7 +32,7 @@ declare namespace Realm { * ObjectSchema * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~ObjectSchema } */ - export interface ObjectSchema { + interface ObjectSchema { name: string; primaryKey?: string; properties: PropertiesTypes; @@ -42,7 +42,7 @@ declare namespace Realm { * ObjectClass * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~ObjectClass } */ - export interface ObjectClass { + interface ObjectClass { schema: ObjectSchema; } @@ -50,7 +50,7 @@ declare namespace Realm { * ObjectType * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~ObjectType } */ - export interface ObjectType { + interface ObjectType { type: ObjectClass; } @@ -63,7 +63,7 @@ declare namespace Realm { * realm configuration * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~Configuration } */ - export interface Configuration { + interface Configuration { encryptionKey?: any; migration?: any; path?: string; @@ -74,7 +74,7 @@ declare namespace Realm { } // object props type - export interface ObjectPropsType { + interface ObjectPropsType { [keys: string]: any; } @@ -82,18 +82,18 @@ declare namespace Realm { * SortDescriptor * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html#~SortDescriptor } */ - export type SortDescriptor = string | [string, boolean] | any[]; + type SortDescriptor = string | [string, boolean] | any[]; /** * Iterator * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html#~Iterator } */ - export interface IteratorResult { + interface IteratorResult { done: boolean; value?: T; } - export interface Iterator { + interface Iterator { next(done: boolean, value?: any): IteratorResult; [Symbol.iterator](): any; } @@ -102,7 +102,7 @@ declare namespace Realm { * Collection * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html } */ - export interface Collection { + interface Collection { readonly length: number; /** @@ -240,7 +240,7 @@ declare namespace Realm { * Object * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Object.html } */ - export interface Object { + interface Object { /** * @returns boolean */ @@ -251,7 +251,7 @@ declare namespace Realm { * List * @see { @link https://realm.io/docs/javascript/latest/api/Realm.List.html } */ - export interface List extends Collection { + interface List extends Collection { /** * @returns T */ @@ -287,13 +287,13 @@ declare namespace Realm { * Results * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Results.html } */ - export type Results = Collection; + type Results = Collection; /** * User * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Sync.User.html } */ - export interface User { + interface User { all: any; current: User; readonly identity: string; @@ -313,7 +313,7 @@ declare namespace Realm { * Session * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Sync.Session.html } */ - export interface Session { + interface Session { readonly config: any; readonly state: string; readonly url: string; @@ -324,7 +324,7 @@ declare namespace Realm { * AuthError * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Sync.AuthError.html } */ - export interface AuthError { + interface AuthError { readonly code: number; readonly type: string; } @@ -333,7 +333,7 @@ declare namespace Realm { * ChangeEvent * @see { @link https://realm.io/docs/javascript/latest/api/Realm.Sync.ChangeEvent.html } */ - export interface ChangeEvent { + interface ChangeEvent { readonly changes: any; readonly oldRealm: Realm; readonly path: string; diff --git a/types/realm/realm-tests.ts b/types/realm/realm-tests.ts index 71dccefdfa..d8a0d98c4a 100644 --- a/types/realm/realm-tests.ts +++ b/types/realm/realm-tests.ts @@ -67,7 +67,6 @@ const currentVersion = Realm.schemaVersion(Realm.defaultPath); Realm.Sync.User.register('http://localhost:9080', 'username@example.com', 'p@s$w0rd', (error, user) => { /* ... */ }); Realm.Sync.User.login('http://localhost.com:9080', 'username@example.com', 'p@s$w0rd', (error, user) => { - const todoSchema = { name: 'Todo', primaryKey: 'id', diff --git a/types/reduce-reducers/reduce-reducers-tests.ts b/types/reduce-reducers/reduce-reducers-tests.ts index d5eeb02633..f542fe834a 100644 --- a/types/reduce-reducers/reduce-reducers-tests.ts +++ b/types/reduce-reducers/reduce-reducers-tests.ts @@ -5,9 +5,9 @@ import { import reduceReducers from 'reduce-reducers'; interface TestStore { - a: number, - b: string + a: number; + b: string; } -let firstReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; -let secondReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a -let finalReducer: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer); +const firstReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const secondReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const finalReducer: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer); diff --git a/types/reflux/reflux-tests.ts b/types/reflux/reflux-tests.ts index 150e40db03..0962b06cb8 100644 --- a/types/reflux/reflux-tests.ts +++ b/types/reflux/reflux-tests.ts @@ -1,13 +1,12 @@ import Reflux = require("reflux"); -var syncActions = Reflux.createActions([ +const syncActions = Reflux.createActions([ "statusUpdate", "statusEdited", "statusAdded" ]); - -var asyncActions = Reflux.createActions({ +const asyncActions = Reflux.createActions({ fireBall: {asyncResult: true} }); @@ -16,10 +15,8 @@ asyncActions.fireBall.listen(function() { setTimeout(() => this.completed(true), 1000); }); - // Creates a DataStore -var statusStore = Reflux.createStore({ - +const statusStore = Reflux.createStore({ // Initial setup init() { // Register statusUpdate action @@ -27,7 +24,7 @@ var statusStore = Reflux.createStore({ }, // Callback onFireBall(flag: boolean) { - var status = flag ? 'ONLINE' : 'OFFLINE'; + const status = flag ? 'ONLINE' : 'OFFLINE'; // Pass on to listeners this.trigger(status); @@ -38,11 +35,11 @@ Reflux.createAction({ children: ["progressed", "completed", "failed"] }); -var action = Reflux.createAction(); +const action = Reflux.createAction(); -var actions = Reflux.createActions(["fireBall", "magicMissile"]); +const actions = Reflux.createActions(["fireBall", "magicMissile"]); -var Store = Reflux.createStore({ +const Store = Reflux.createStore({ init() { this.listenToMany(actions); }, @@ -54,6 +51,6 @@ var Store = Reflux.createStore({ } }); -var ReactComponent = { +const ReactComponent = { mixins: [Reflux.ListenerMixin] -}; \ No newline at end of file +}; diff --git a/types/revalidate/index.d.ts b/types/revalidate/index.d.ts index a764e41e15..c17837129a 100644 --- a/types/revalidate/index.d.ts +++ b/types/revalidate/index.d.ts @@ -6,14 +6,18 @@ // This project is licensed under the MIT license. // Copyrights are respective of each contributor listed at the beginning of each definition file. -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. export interface CombineValidatorsOptions { - serializeValues?: (values: any) => any; + serializeValues?(values: any): any; } export interface Config { diff --git a/types/revalidate/revalidate-tests.ts b/types/revalidate/revalidate-tests.ts index 798089d6a0..7db6a582a6 100644 --- a/types/revalidate/revalidate-tests.ts +++ b/types/revalidate/revalidate-tests.ts @@ -3,7 +3,7 @@ import r = require("revalidate"); const isValidEmail = r.createValidator( message => value => { if (value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)) { - return message + return message; } }, 'Invalid email address' @@ -12,7 +12,7 @@ const isValidEmail = r.createValidator( const isGreaterThan = (n: any) => r.createValidator( message => value => { if (value && Number(value) <= n) { - return message + return message; } }, field => `${field} must be greater than ${n}` diff --git a/types/rrule/index.d.ts b/types/rrule/index.d.ts index b09d47ff2a..038bde2736 100644 --- a/types/rrule/index.d.ts +++ b/types/rrule/index.d.ts @@ -13,12 +13,11 @@ export = RRule; // For CommonJS it must be imported as `require("rrule").RRule`. import RRuleAlias = RRule; declare module "rrule" { - export type RRule = RRuleAlias; - export const RRule: typeof RRuleAlias; + type RRule = RRuleAlias; + const RRule: typeof RRuleAlias; } declare namespace RRule { - /** * see * The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ... @@ -52,11 +51,9 @@ declare namespace RRule { getJsWeekday(): number; } - } declare class RRule { - /** * @param {Object?} options - see * The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ... @@ -123,11 +120,9 @@ declare class RRule { isFullyConvertibleToText(): boolean; clone(): RRule; - } declare namespace RRule { - const FREQUENCIES: "YEARLY" | "MONTHLY" | "WEEKLY" | "DAILY" | "HOURLY" | "MINUTELY" | "SECONDLY"; enum Frequency { diff --git a/types/rrule/test/rrule.ts b/types/rrule/test/rrule.ts index 461283c45d..c455fa40d1 100644 --- a/types/rrule/test/rrule.ts +++ b/types/rrule/test/rrule.ts @@ -30,7 +30,6 @@ y.push(rule.toText()); // including the default and inferred ones. y.push(RRule.optionsToString(rule.options)); - // Cherry-pick only some options from an rrule: y.push(RRule.optionsToString({ freq: rule.options.freq, @@ -42,7 +41,7 @@ rule = RRule.fromString("FREQ=WEEKLY;DTSTART=20120201T093000Z"); // This is equivalent rule = new RRule(RRule.parseString("FREQ=WEEKLY;DTSTART=20120201T093000Z")); -var options = RRule.parseString('FREQ=DAILY;INTERVAL=6'); +let options = RRule.parseString('FREQ=DAILY;INTERVAL=6'); options.dtstart = new Date(2000, 1, 1); rule = new RRule(options); diff --git a/types/rx-core-binding/index.d.ts b/types/rx-core-binding/index.d.ts index 54861eb6cb..1f51c54e1c 100644 --- a/types/rx-core-binding/index.d.ts +++ b/types/rx-core-binding/index.d.ts @@ -10,7 +10,7 @@ declare namespace Rx { hasObservers(): boolean; } - export interface Subject extends ISubject { + interface Subject extends ISubject { } interface SubjectStatic { @@ -18,18 +18,18 @@ declare namespace Rx { create(observer?: Observer, observable?: Observable): ISubject; } - export var Subject: SubjectStatic; + const Subject: SubjectStatic; - export interface AsyncSubject extends Subject { + interface AsyncSubject extends Subject { } interface AsyncSubjectStatic { new (): AsyncSubject; } - export var AsyncSubject: AsyncSubjectStatic; + const AsyncSubject: AsyncSubjectStatic; - export interface BehaviorSubject extends Subject { + interface BehaviorSubject extends Subject { getValue(): T; } @@ -37,16 +37,16 @@ declare namespace Rx { new (initialValue: T): BehaviorSubject; } - export var BehaviorSubject: BehaviorSubjectStatic; + const BehaviorSubject: BehaviorSubjectStatic; - export interface ReplaySubject extends Subject { + interface ReplaySubject extends Subject { } interface ReplaySubjectStatic { new (bufferSize?: number, window?: number, scheduler?: IScheduler): ReplaySubject; } - export var ReplaySubject: ReplaySubjectStatic; + const ReplaySubject: ReplaySubjectStatic; interface ConnectableObservable extends Observable { connect(): IDisposable; @@ -57,9 +57,9 @@ declare namespace Rx { new (): ConnectableObservable; } - export var ConnectableObservable: ConnectableObservableStatic; + const ConnectableObservable: ConnectableObservableStatic; - export interface Observable { + interface Observable { multicast(subject: Observable): ConnectableObservable; multicast(subjectSelector: () => ISubject, selector: (source: ConnectableObservable) => Observable): Observable; publish(): ConnectableObservable; diff --git a/types/rx-core/index.d.ts b/types/rx-core/index.d.ts index 15b55e93d9..f922b1f083 100644 --- a/types/rx-core/index.d.ts +++ b/types/rx-core/index.d.ts @@ -7,24 +7,24 @@ declare namespace Rx { /** * Promise A+ */ - export interface IPromise { + interface IPromise { then(onFulfilled: (value: T) => IPromise, onRejected: (reason: any) => IPromise): IPromise; then(onFulfilled: (value: T) => IPromise, onRejected?: (reason: any) => R): IPromise; then(onFulfilled: (value: T) => R, onRejected: (reason: any) => IPromise): IPromise; then(onFulfilled?: (value: T) => R, onRejected?: (reason: any) => R): IPromise; } - export interface IDisposable { + interface IDisposable { dispose(): void; } - export interface IScheduler { + interface IScheduler { catch(handler: (exception: any) => boolean): IScheduler; catchException(handler: (exception: any) => boolean): IScheduler; } // Observer - export interface Observer { + interface Observer { checked(): Observer; } @@ -37,7 +37,7 @@ declare namespace Rx { notifyOn(scheduler: IScheduler): Observer; } - export interface Observable { + interface Observable { observeOn(scheduler: IScheduler): Observable; subscribeOn(scheduler: IScheduler): Observable; diff --git a/types/rx-lite-aggregates/index.d.ts b/types/rx-lite-aggregates/index.d.ts index 6dd9c76387..72c2ae402f 100644 --- a/types/rx-lite-aggregates/index.d.ts +++ b/types/rx-lite-aggregates/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace Rx { - export interface Observable { + interface Observable { finalValue(): Observable; aggregate(accumulator: (acc: T, value: T) => T): Observable; aggregate(seed: TAcc, accumulator: (acc: TAcc, value: T) => TAcc): Observable; diff --git a/types/rx-lite-backpressure/index.d.ts b/types/rx-lite-backpressure/index.d.ts index 2584cb8a36..d5039c2667 100644 --- a/types/rx-lite-backpressure/index.d.ts +++ b/types/rx-lite-backpressure/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace Rx { - export interface Observable { + interface Observable { /** * Pauses the underlying observable sequence based upon the observable sequence which yields true/false. * @example @@ -37,11 +37,11 @@ declare namespace Rx { controlled(enableQueue?: boolean): ControlledObservable; } - export interface ControlledObservable extends Observable { + interface ControlledObservable extends Observable { request(numberOfItems?: number): IDisposable; } - export interface PausableObservable extends Observable { + interface PausableObservable extends Observable { pause(): void; resume(): void; } diff --git a/types/rx-lite-backpressure/rx-lite-backpressure-tests.ts b/types/rx-lite-backpressure/rx-lite-backpressure-tests.ts index 6c312691f7..00cef0d852 100644 --- a/types/rx-lite-backpressure/rx-lite-backpressure-tests.ts +++ b/types/rx-lite-backpressure/rx-lite-backpressure-tests.ts @@ -2,18 +2,18 @@ // Tests by Igor Oleinikov function testPausable() { - var o: Rx.Observable = {} as any; + const o: Rx.Observable = {} as any; - var pauser = new Rx.Subject(); + const pauser = new Rx.Subject(); - var p = o.pausable(pauser); + let p = o.pausable(pauser); p = o.pausableBuffered(pauser); } function testControlled() { - var o: Rx.Observable = {} as any; - var c = o.controlled(); + const o: Rx.Observable = {} as any; + const c = o.controlled(); - var d: Rx.IDisposable = c.request(); + let d: Rx.IDisposable = c.request(); d = c.request(5); } diff --git a/types/rx-lite-testing/index.d.ts b/types/rx-lite-testing/index.d.ts index 2fda5bfbb1..5e51044808 100644 --- a/types/rx-lite-testing/index.d.ts +++ b/types/rx-lite-testing/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace Rx { - export interface TestScheduler extends VirtualTimeScheduler { + interface TestScheduler extends VirtualTimeScheduler { createColdObservable(...records: Recorded[]): Observable; createHotObservable(...records: Recorded[]): Observable; createObserver(): MockObserver; @@ -16,11 +16,11 @@ declare namespace Rx { startWithCreate(create: () => Observable): MockObserver; } - export var TestScheduler: { + const TestScheduler: { new (): TestScheduler; }; - export class Recorded { + class Recorded { constructor(time: number, value: any, equalityComparer?: (x: any, y: any) => boolean); equals(other: Recorded): boolean; toString(): string; @@ -28,7 +28,7 @@ declare namespace Rx { value: any; } - export var ReactiveTest: { + const ReactiveTest: { created: number; subscribed: number; disposed: number; @@ -40,12 +40,12 @@ declare namespace Rx { subscribe(subscribeAt: number, unsubscribeAt?: number): Subscription; }; - export class Subscription { + class Subscription { constructor(subscribeAt: number, unsubscribeAt?: number); equals(other: Subscription): boolean; } - export interface MockObserver extends Observer { + interface MockObserver extends Observer { messages: Recorded[]; } @@ -53,7 +53,7 @@ declare namespace Rx { new (scheduler: IScheduler): MockObserver; } - export var MockObserver: MockObserverStatic; + const MockObserver: MockObserverStatic; } declare module "rx-lite-testing" { diff --git a/types/rx-lite-time/index.d.ts b/types/rx-lite-time/index.d.ts index 38c553dbf1..01fadea822 100644 --- a/types/rx-lite-time/index.d.ts +++ b/types/rx-lite-time/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace Rx { - export interface Observable { + interface Observable { delaySubscription(dueTime: number, scheduler?: IScheduler): Observable; delayWithSelector(delayDurationSelector: (item: T) => number): Observable; delayWithSelector(subscriptionDelay: number, delayDurationSelector: (item: T) => number): Observable; diff --git a/types/rx-lite-virtualtime/index.d.ts b/types/rx-lite-virtualtime/index.d.ts index d0907c7168..7413ec2604 100644 --- a/types/rx-lite-virtualtime/index.d.ts +++ b/types/rx-lite-virtualtime/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace Rx { - export interface VirtualTimeScheduler extends Scheduler { + interface VirtualTimeScheduler extends Scheduler { // protected constructor(initialClock: TAbsolute, comparer: (first: TAbsolute, second: TAbsolute) => number); advanceBy(time: TRelative): void; @@ -28,10 +28,10 @@ declare namespace Rx { /* protected */ getNext(): internals.ScheduledItem; } - export interface HistoricalScheduler extends VirtualTimeScheduler { + interface HistoricalScheduler extends VirtualTimeScheduler { } - export var HistoricalScheduler: { + const HistoricalScheduler: { new (initialClock: number, comparer: (first: number, second: number) => number): HistoricalScheduler; }; } diff --git a/types/rx-lite/index.d.ts b/types/rx-lite/index.d.ts index 7e085031aa..d56e4e473c 100644 --- a/types/rx-lite/index.d.ts +++ b/types/rx-lite/index.d.ts @@ -7,12 +7,12 @@ /// declare namespace Rx { - export namespace internals { + namespace internals { function isEqual(left: any, right: any): boolean; function addRef(xs: Observable, r: { getDisposable(): IDisposable; }): Observable; // Priority Queue for Scheduling - export class PriorityQueue { + class PriorityQueue { constructor(capacity: number); length: number; @@ -29,7 +29,7 @@ declare namespace Rx { static count: number; } - export class ScheduledItem { + class ScheduledItem { constructor(scheduler: IScheduler, state: any, action: (scheduler: IScheduler, state: any) => IDisposable, dueTime: TTime, comparer?: (x: TTime, y: TTime) => number); scheduler: IScheduler; @@ -46,11 +46,11 @@ declare namespace Rx { } } - export namespace config { - export var Promise: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }; + namespace config { + let Promise: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }; } - export namespace helpers { + namespace helpers { function noop(): void; function notDefined(value: any): boolean; function identity(value: T): T; @@ -65,7 +65,7 @@ declare namespace Rx { function isFunction(value: any): boolean; } - export class CompositeDisposable implements IDisposable { + class CompositeDisposable implements IDisposable { constructor(...disposables: IDisposable[]); constructor(disposables: IDisposable[]); @@ -78,7 +78,7 @@ declare namespace Rx { toArray(): IDisposable[]; } - export class Disposable implements IDisposable { + class Disposable implements IDisposable { constructor(action: () => void); static create(action: () => void): IDisposable; @@ -88,7 +88,7 @@ declare namespace Rx { } // Single assignment - export class SingleAssignmentDisposable implements IDisposable { + class SingleAssignmentDisposable implements IDisposable { constructor(); isDisposed: boolean; @@ -100,11 +100,11 @@ declare namespace Rx { } // SerialDisposable it's an alias of SingleAssignmentDisposable - export class SerialDisposable extends SingleAssignmentDisposable { + class SerialDisposable extends SingleAssignmentDisposable { constructor(); } - export class RefCountDisposable implements IDisposable { + class RefCountDisposable implements IDisposable { constructor(disposable: IDisposable); dispose(): void; @@ -113,7 +113,7 @@ declare namespace Rx { getDisposable(): IDisposable; } - export interface IScheduler { + interface IScheduler { now(): number; isScheduler(value: any): boolean; @@ -135,10 +135,10 @@ declare namespace Rx { schedulePeriodicWithState(state: TState, period: number, action: (state: TState) => TState): IDisposable; } - export interface Scheduler extends IScheduler { + interface Scheduler extends IScheduler { } - export interface SchedulerStatic { + interface SchedulerStatic { new ( now: () => number, schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable, @@ -153,7 +153,7 @@ declare namespace Rx { timeout: IScheduler; } - export var Scheduler: SchedulerStatic; + const Scheduler: SchedulerStatic; // Current Thread IScheduler interface ICurrentThreadScheduler extends IScheduler { @@ -161,7 +161,7 @@ declare namespace Rx { } // Notifications - export class Notification { + class Notification { accept(observer: IObserver): void; accept(onNext: (value: T) => TResult, onError?: (exception: any) => TResult, onCompleted?: () => TResult): TResult; toObservable(scheduler?: IScheduler): Observable; @@ -177,13 +177,13 @@ declare namespace Rx { } // Observer - export interface IObserver { + interface IObserver { onNext(value: T): void; onError(exception: any): void; onCompleted(): void; } - export interface Observer extends IObserver { + interface Observer extends IObserver { toNotifier(): (notification: Notification) => void; asObserver(): Observer; } @@ -193,9 +193,9 @@ declare namespace Rx { fromNotifier(handler: (notification: Notification, thisArg?: any) => void): Observer; } - export var Observer: ObserverStatic; + const Observer: ObserverStatic; - export interface IObservable { + interface IObservable { subscribe(observer: Observer): IDisposable; subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; @@ -204,7 +204,7 @@ declare namespace Rx { subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable; } - export interface Observable extends IObservable { + interface Observable extends IObservable { forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; // alias for subscribe toArray(): Observable; @@ -591,17 +591,17 @@ declare namespace Rx { prototype: any; } - export var Observable: ObservableStatic; + const Observable: ObservableStatic; } // Async declare namespace Rx { - export namespace config { + namespace config { /** * Configuration option to determine whether to use native events only */ - export var useNativeEvents: boolean; + const useNativeEvents: boolean; } interface ObservableStatic { @@ -655,12 +655,12 @@ declare namespace Rx { } interface NodeEventTarget { - addListener: (name: string, cb: (e: any) => any) => void; + addListener(name: string, cb: (e: any) => any): void; } interface NativeEventTarget { - on: (name: string, cb: (e: any) => any) => void; - off: (name: string, cb: (e: any) => any) => void; + on(name: string, cb: (e: any) => any): void; + off(name: string, cb: (e: any) => any): void; } interface DOMEventTarget { @@ -669,29 +669,28 @@ declare namespace Rx { } } - // time declare namespace Rx { - export interface TimeInterval { + interface TimeInterval { value: T; interval: number; } - export interface Timestamp { + interface Timestamp { value: T; timestamp: number; } - export interface Observable { + interface Observable { delay(dueTime: Date, scheduler?: IScheduler): Observable; delay(dueTime: number, scheduler?: IScheduler): Observable; debounce(dueTime: number, scheduler?: IScheduler): Observable; throttleWithTimeout(dueTime: number, scheduler?: IScheduler): Observable; /** - * @deprecated use #debounce or #throttleWithTimeout instead. - */ + * @deprecated use #debounce or #throttleWithTimeout instead. + */ throttle(dueTime: number, scheduler?: IScheduler): Observable; timeInterval(scheduler?: IScheduler): Observable>; diff --git a/types/rx-lite/rx-lite-tests.ts b/types/rx-lite/rx-lite-tests.ts index d0f871fcbb..fd3cf65663 100644 --- a/types/rx-lite/rx-lite-tests.ts +++ b/types/rx-lite/rx-lite-tests.ts @@ -1,53 +1,51 @@ import * as Rx from 'rx-lite'; namespace Tests.Async { - - var obsNum: Rx.Observable; - var obsStr: Rx.Observable; - var sch: Rx.IScheduler; + let obsNum: Rx.Observable; + let obsStr: Rx.Observable; function fromCallback() { // 0 arguments - var func0: (cb: (result: number) => void) => void = () => { }; + const func0: (cb: (result: number) => void) => void = () => { }; obsNum = Rx.Observable.fromCallback(func0)(); obsNum = Rx.Observable.fromCallback(func0, obsStr)(); obsNum = Rx.Observable.fromCallback(func0, obsStr, (results: number[]) => results[0])(); // 1 argument - var func1: (a: string, cb: (result: number) => void) => number = () => 0; + const func1: (a: string, cb: (result: number) => void) => number = () => 0; obsNum = Rx.Observable.fromCallback(func1)(""); obsNum = Rx.Observable.fromCallback(func1, {})(""); obsNum = Rx.Observable.fromCallback(func1, {}, (results: number[]) => results[0])(""); // 2 arguments - var func2: (a: number, b: string, cb: (result: string) => number) => Date = () => new Date(); + const func2: (a: number, b: string, cb: (result: string) => number) => Date = () => new Date(); obsStr = Rx.Observable.fromCallback(func2)(1, ""); obsStr = Rx.Observable.fromCallback(func2, {})(1, ""); obsStr = Rx.Observable.fromCallback(func2, {}, (results: string[]) => results[0])(1, ""); // 3 arguments - var func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date = () => new Date(); + const func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date = () => new Date(); obsStr = Rx.Observable.fromCallback(func3)(1, "", true); obsStr = Rx.Observable.fromCallback(func3, {})(1, "", true); obsStr = Rx.Observable.fromCallback(func3, {}, (results: string[]) => results[0])(1, "", true); // multiple results - var func0m: (cb: (result1: number, result2: number, result3: number) => void) => void = () => { }; + const func0m: (cb: (result1: number, result2: number, result3: number) => void) => void = () => { }; obsNum = Rx.Observable.fromCallback(func0m, obsStr, (results: number[]) => results[0])(); - var func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void = () => { }; + const func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void = () => { }; obsNum = Rx.Observable.fromCallback(func1m, obsStr, (results: number[]) => results[0])(""); - var func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void = () => { }; + const func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void = () => { }; obsStr = Rx.Observable.fromCallback(func2m, obsStr, (results: string[]) => results[0])("", 10); } function toPromise() { - var promiseImpl: { + const promiseImpl: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Rx.IPromise; } = undefined as any; Rx.config.Promise = promiseImpl; - var p: Rx.IPromise = obsNum.toPromise(promiseImpl); + let p: Rx.IPromise = obsNum.toPromise(promiseImpl); p = obsNum.toPromise(); @@ -56,14 +54,13 @@ namespace Tests.Async { p = p.then(undefined, reason => 10); // p = p.then(undefined, reason => p); - var ps: Rx.IPromise = p.then(undefined, reason => "error"); + let ps: Rx.IPromise = p.then(undefined, reason => "error"); ps = p.then(x => ""); ps = p.then(x => ps); } } function test_scan() { - /* Without a seed */ const source1: Rx.Observable = Rx.Observable.range(1, 3) .scan((acc, x, i, source) => acc + x); @@ -71,16 +68,15 @@ function test_scan() { /* With a seed */ const source2: Rx.Observable = Rx.Observable.range(1, 3) .scan((acc, x, i, source) => acc + x, '...'); - } function test_concatAll() { /* concatAll Example */ - var source = Rx.Observable.range(0, 3) + const source = Rx.Observable.range(0, 3) .map(x => Rx.Observable.range(x, 3)) .concatAll(); - var subscription = source.subscribe( + const subscription = source.subscribe( x => { console.log('Next: %s', x); }, @@ -94,11 +90,11 @@ function test_concatAll() { function test_mergeAll() { /* mergeAll example */ - var source = Rx.Observable.range(0, 3) + const source = Rx.Observable.range(0, 3) .map(x => Rx.Observable.range(x, 3)) .mergeAll(); - var subscription = source.subscribe( + const subscription = source.subscribe( x => { console.log('Next: %s', x); }, @@ -108,25 +104,24 @@ function test_mergeAll() { () => { console.log('Completed'); }); - } // from https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/publish.md function test_publish() { - var interval = Rx.Observable.interval(1000); + const interval = Rx.Observable.interval(1000); - var source = interval + const source = interval .take(2) .doAction(x => { console.log('Side effect'); }); - var published = source.publish(); + const published = source.publish(); published.subscribe(createObserver('SourceA')); published.subscribe(createObserver('SourceB')); - var connection = published.connect(); + const connection = published.connect(); function createObserver(tag: string) { return Rx.Observer.create( diff --git a/types/session-file-store/index.d.ts b/types/session-file-store/index.d.ts index f8238cf109..5b755cafb9 100644 --- a/types/session-file-store/index.d.ts +++ b/types/session-file-store/index.d.ts @@ -5,18 +5,15 @@ /// - export = FileStore; declare namespace FileStore { - /** * FileStore Options * * @interface Options */ interface Options { - /** * The directory where the session files will be stored. Defaults to `./sessions` * @@ -111,7 +108,7 @@ declare namespace FileStore { * @type {Function} * @memberOf Options */ - logFn?: (...args: any[]) => void; + logFn?(...args: any[]): void; /** * Returns fallback session object after all failed retries. No defaults @@ -119,7 +116,7 @@ declare namespace FileStore { * @type {Function} * @memberOf Options */ - fallbackSessionFn?: (...args: any[]) => void; + fallbackSessionFn?(...args: any[]): void; /** * Object-to-text text encoding. Can be null. Defaults to `'utf8'` @@ -135,7 +132,7 @@ declare namespace FileStore { * @type {Function} * @memberOf Options */ - encoder?: (...args: any[]) => void; + encoder?(...args: any[]): void; /** * Decoding function. Takes encoded data, returns object. Defaults to `JSON.parse` @@ -143,7 +140,7 @@ declare namespace FileStore { * @type {Function} * @memberOf Options */ - decoder?: (...args: any[]) => void; + decoder?(...args: any[]): void; /** * If secret string is specified then enables encryption of the session before @@ -185,7 +182,7 @@ declare namespace FileStore { * * @memberOf Options */ - keyFunction?: (secret: string, sessionId: string) => string; + keyFunction?(secret: string, sessionId: string): string; } } @@ -196,7 +193,6 @@ declare namespace FileStore { * @class FileStore */ declare class FileStore { - /** * Creates an instance of FileStore. * @param {FileStore.Options} options @@ -283,5 +279,4 @@ declare class FileStore { * @memberOf FileStore */ expired(sessionId: string, callback: (errr: any, isExpired: boolean) => void): void; - } diff --git a/types/session-file-store/session-file-store-tests.ts b/types/session-file-store/session-file-store-tests.ts index ffe3c79bee..50d30da2ac 100644 --- a/types/session-file-store/session-file-store-tests.ts +++ b/types/session-file-store/session-file-store-tests.ts @@ -8,6 +8,4 @@ const options: FileStore.Options = { const sessionStore = new FileStore(options); -sessionStore.list((err: any, file: Array) => { - -}); \ No newline at end of file +sessionStore.list((err: any, file: string[]) => {}); diff --git a/types/sheetify/index.d.ts b/types/sheetify/index.d.ts index d6711c5bd9..5fd3ac2df6 100644 --- a/types/sheetify/index.d.ts +++ b/types/sheetify/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace sheetify { - export function getPrefix(css: string): string; + function getPrefix(css: string): string; } declare function sheetify(src: string | TemplateStringsArray, filename?: string, options?: {[prop: string]: any}, done?: (err: Error, css: string, prefix: string) => void): string; diff --git a/types/sheetify/sheetify-tests.ts b/types/sheetify/sheetify-tests.ts index 931e05b579..31b35c220d 100644 --- a/types/sheetify/sheetify-tests.ts +++ b/types/sheetify/sheetify-tests.ts @@ -17,4 +17,4 @@ const test8 = sheetify` } `; -const prefix = sheetify.getPrefix('boop'); \ No newline at end of file +const prefix = sheetify.getPrefix('boop'); diff --git a/types/simple-peer/index.d.ts b/types/simple-peer/index.d.ts index 86c7f08bfb..e03e5b3372 100644 --- a/types/simple-peer/index.d.ts +++ b/types/simple-peer/index.d.ts @@ -10,7 +10,7 @@ import * as stream from 'stream'; declare const SimplePeer: SimplePeer.SimplePeer; declare namespace SimplePeer { - export interface Options { + interface Options { initiator?: boolean; // set to true if this is the initiating peer channelConfig?: {}; // custom webrtc data channel configuration (used by createDataChannel) channelName?: string; // custom webrtc data channel name @@ -19,14 +19,14 @@ declare namespace SimplePeer { offerConstraints?: {}; // custom offer constraints (used by createOffer method) answerConstraints?: {}; // custom answer constraints (used by createAnswer method) reconnectTimer?: boolean | number; // wait __ milliseconds after ICE 'disconnect' for reconnect attempt before emitting 'close' - sdpTransform?: (sdp: T) => T; // function to transform the generated SDP signaling data (for advanced users) + sdpTransform?(sdp: T): T; // function to transform the generated SDP signaling data (for advanced users) stream?: boolean; // if video/voice is desired, pass stream returned from getUserMedia trickle?: boolean; // set to false to disable trickle ICE and get a single 'signal' event (slower) wrtc?: {}; // RTCPeerConnection/RTCSessionDescription/RTCIceCandidate } // https://github.com/feross/simple-peer/tree/v6.1.5#peer--new-simplepeeropts - export interface SimplePeer { + interface SimplePeer { new (opts?: Options): Instance; (opts?: Options): Instance; @@ -34,17 +34,16 @@ declare namespace SimplePeer { readonly WEBRTC_SUPPORT: boolean; } - export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; + type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; - export type SimplePeerData = string | Buffer | TypedArray | ArrayBuffer | Blob; + type SimplePeerData = string | Buffer | TypedArray | ArrayBuffer | Blob; - export interface SignalData { + interface SignalData { sdp?: any; candidate?: any; } - export interface Instance extends stream.Duplex { - + interface Instance extends stream.Duplex { // https://github.com/feross/simple-peer/tree/v6.1.5#peersignaldata signal(data: string | SignalData): void; diff --git a/types/sip.js/index.d.ts b/types/sip.js/index.d.ts index d4e6bcebf1..4cb973ad10 100644 --- a/types/sip.js/index.d.ts +++ b/types/sip.js/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Kir Dergachev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare interface SIP { +interface SIP { UA: { new (configuration?: sipjs.ConfigurationParameters): sipjs.UA; }; @@ -18,7 +18,6 @@ declare interface SIP { } declare namespace sipjs { - interface URI { scheme?: string; user?: string; @@ -164,7 +163,6 @@ declare namespace sipjs { } namespace WebRTC { - interface Options { stunServers?: string | string[]; turnServers?: TurnServer | TurnServer[]; @@ -211,7 +209,7 @@ declare namespace sipjs { log?: { builtinEnabled?: boolean; level?: number | string; - connector?: (level: string, category: string, label: string, content: string) => void; + connector?(level: string, category: string, label: string, content: string): void; }; mediaHandlerFactory?: WebRTC.MediaHandlerFactory; noAnswerTimeout?: number; diff --git a/types/sip.js/sip.js-tests.ts b/types/sip.js/sip.js-tests.ts index b817b8e2c8..23b2578194 100644 --- a/types/sip.js/sip.js-tests.ts +++ b/types/sip.js/sip.js-tests.ts @@ -88,12 +88,8 @@ ua.on('registered', () => { }); ua.on('unregistered', (args: sipjs.UA.EventArgs.UnregisteredArgs) => { }); ua.on('registrationFailed', (args: sipjs.UA.EventArgs.RegistrationFailedArgs) => { }); ua.on('invite', (session: sipjs.Session) => { - session.on('progress', (response) => { - }); - session.on('accepted', (response) => { - }); - session.on('rejected', (response) => { - }); - + session.on('progress', (response) => {}); + session.on('accepted', (response) => {}); + session.on('rejected', (response) => {}); }); ua.on('message', (message: sipjs.Message) => { }); diff --git a/types/sitemap2/index.d.ts b/types/sitemap2/index.d.ts index 75108ff603..42af7e5c02 100644 --- a/types/sitemap2/index.d.ts +++ b/types/sitemap2/index.d.ts @@ -7,10 +7,10 @@ declare var sitemap2: Sitemap; export = sitemap2; -declare interface Sitemap { +interface Sitemap { new (conf?: SitemapConfig): Sitemap; - addUrl(urlData: UrlData | UrlData[] | string | string[]): this + addUrl(urlData: UrlData | UrlData[] | string | string[]): this; addSitemap(sm: Sitemap): this; toXML(): SitemapXml[]; @@ -21,7 +21,7 @@ declare interface Sitemap { childrens: Sitemap[]; } -declare interface SitemapConfig { +interface SitemapConfig { hostName?: string; fileName?: string; limit?: number; @@ -31,7 +31,7 @@ declare interface SitemapConfig { childrens?: Sitemap[]; } -declare interface UrlData { +interface UrlData { url: string; chengefreq?: string; priority?: number | string; @@ -43,10 +43,10 @@ declare interface UrlData { description: string; thumbnail_loc: string; content_loc: string; - } + }; } -declare interface SitemapXml { +interface SitemapXml { fileName: string; xml: string; } diff --git a/types/sitemap2/sitemap2-tests.ts b/types/sitemap2/sitemap2-tests.ts index 235cbb93a4..60a8a7fe75 100644 --- a/types/sitemap2/sitemap2-tests.ts +++ b/types/sitemap2/sitemap2-tests.ts @@ -1,6 +1,6 @@ import Sitemap = require('sitemap2'); -let sitemap = new Sitemap({ +const sitemap = new Sitemap({ hostName: ('https://example.com/'), fileName: 'sitemap.xml', limit: 50000, @@ -43,9 +43,9 @@ sitemap.addUrl([ } ]); -let sitemap2 = new Sitemap(); +const sitemap2 = new Sitemap(); sitemap.addSitemap(sitemap2); const xmlList = sitemap.toXML(); -var str = xmlList[0].fileName; -var str = xmlList[0].xml; +let str = xmlList[0].fileName; +str = xmlList[0].xml; diff --git a/types/sitemap2/tslint.json b/types/sitemap2/tslint.json index 2221e40e4a..3c4a3237e8 100644 --- a/types/sitemap2/tslint.json +++ b/types/sitemap2/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ + "extends": "../tslint.json", + "rules": { + "no-misused-new": false + } +} diff --git a/types/speakingurl/index.d.ts b/types/speakingurl/index.d.ts index 83e38fd7b8..67c9678c9e 100644 --- a/types/speakingurl/index.d.ts +++ b/types/speakingurl/index.d.ts @@ -23,7 +23,7 @@ interface SpeakingURLOptions { declare function getSlug(input: string, options?: SpeakingURLOptions|string): string; declare namespace getSlug { - export function createSlug(options: SpeakingURLOptions): (input: string) => string; + function createSlug(options: SpeakingURLOptions): (input: string) => string; } export = getSlug; diff --git a/types/speakingurl/speakingurl-tests.ts b/types/speakingurl/speakingurl-tests.ts index 76dd9f1a8d..413ad024d8 100644 --- a/types/speakingurl/speakingurl-tests.ts +++ b/types/speakingurl/speakingurl-tests.ts @@ -91,4 +91,4 @@ const options = { }; const mySlug = getSlug.createSlug(options); -slug = mySlug('welcome to the jungle'); \ No newline at end of file +slug = mySlug('welcome to the jungle'); diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 19828e2b3f..6e5ab5a322 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -5,14 +5,13 @@ /// - import events = require("events"); -export declare var OPEN_READONLY: number; -export declare var OPEN_READWRITE: number; -export declare var OPEN_CREATE: number; +export const OPEN_READONLY: number; +export const OPEN_READWRITE: number; +export const OPEN_CREATE: number; -export declare var cached: { +export const cached: { Database(filename: string, callback?: (err: Error) => void): Database; Database(filename: string, mode?: number, callback?: (err: Error) => void): Database; }; @@ -22,7 +21,7 @@ export interface RunResult { changes: number; } -export declare class Statement { +export class Statement { bind(callback?: (err: Error) => void): Statement; bind(...params: any[]): Statement; @@ -47,7 +46,7 @@ export declare class Statement { each(...params: any[]): Statement; } -export declare class Database extends events.EventEmitter { +export class Database extends events.EventEmitter { constructor(filename: string, callback?: (err: Error) => void); constructor(filename: string, mode?: number, callback?: (err: Error) => void); @@ -85,4 +84,4 @@ export declare class Database extends events.EventEmitter { on(event: string, listener: (...args: any[]) => void): this; } -declare function verbose(): void; +export function verbose(): void; diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 75a8c2e72c..57cd516bcb 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -1,8 +1,7 @@ - import sqlite3 = require('sqlite3'); sqlite3.verbose(); -var db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); +let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); @@ -16,9 +15,9 @@ function createTable() { function insertRows() { console.log("insertRows Ipsum i"); - var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); + const stmt = db.prepare("INSERT INTO lorem VALUES (?)"); - for (var i = 0; i < 10; i++) { + for (let i = 0; i < 10; i++) { stmt.run("Ipsum " + i); } @@ -56,8 +55,8 @@ runChainExample(); db.serialize(() => { db.run("CREATE TABLE lorem (info TEXT)"); - var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); - for (var i = 0; i < 10; i++) { + const stmt = db.prepare("INSERT INTO lorem VALUES (?)"); + for (let i = 0; i < 10; i++) { stmt.run("Ipsum " + i); } stmt.finalize(); diff --git a/types/stamplay-js-sdk/index.d.ts b/types/stamplay-js-sdk/index.d.ts index 81f20d8c95..ed029cc1bd 100644 --- a/types/stamplay-js-sdk/index.d.ts +++ b/types/stamplay-js-sdk/index.d.ts @@ -4,24 +4,24 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Stamplay { - export function init(appId: string): void; - export function User(): StamplayObject; - export function Cobject(object: string): StamplayObject; + function init(appId: string): void; + function User(): StamplayObject; + function Cobject(object: string): StamplayObject; - export interface Model { + interface Model { signup({}): Promise; new(): Model; // This is suspicious, but tests show model instances being constructable... get(property: string): any; set(property: string, value: any): void; - unset(property: string) : void; - fetch(id: any) : Promise; + unset(property: string): void; + fetch(id: any): Promise; destroy(): Promise; save({}?): Promise; upVote(): Promise; } - export interface StamplayObject { + interface StamplayObject { Model: Model; - Collection : any; + Collection: any; } } diff --git a/types/stamplay-js-sdk/stamplay-js-sdk-tests.ts b/types/stamplay-js-sdk/stamplay-js-sdk-tests.ts index 9dddc1b242..bf12d5ad72 100644 --- a/types/stamplay-js-sdk/stamplay-js-sdk-tests.ts +++ b/types/stamplay-js-sdk/stamplay-js-sdk-tests.ts @@ -1,12 +1,11 @@ - Stamplay.init('sample'); -var userFn = Stamplay.User(); -var user = new userFn.Model; -var colTags = Stamplay.Cobject('tag'); -var tags = new colTags.Collection(); +const userFn = Stamplay.User(); +const user = new userFn.Model(); +const colTags = Stamplay.Cobject('tag'); +const tags = new colTags.Collection(); // Signing up -var registrationData = { +const registrationData = { email : 'user@provider.com', password: 'mySecret' }; @@ -15,20 +14,19 @@ user.signup(registrationData).then(() => { user.set('phoneNumber', '020 123 4567' ); return user.save(); }).then(() => { - var number = user.get('phoneNumber'); + const number = user.get('phoneNumber'); console.log(number); // number value is 020 123 4567 }); - // Action -var colFoo = Stamplay.Cobject('foo'); -var fooMod = new colFoo.Model(); +const colFoo = Stamplay.Cobject('foo'); +const fooMod = new colFoo.Model(); fooMod.fetch(5) .then(() => fooMod.upVote()) .then( () => { - //success callback + // success callback }, (err: any) => { - //error callback + // error callback } -) +); diff --git a/types/stamplay-js-sdk/tslint.json b/types/stamplay-js-sdk/tslint.json index 2221e40e4a..3c4a3237e8 100644 --- a/types/stamplay-js-sdk/tslint.json +++ b/types/stamplay-js-sdk/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ + "extends": "../tslint.json", + "rules": { + "no-misused-new": false + } +} diff --git a/types/steed/index.d.ts b/types/steed/index.d.ts index 4865c8efa8..1b1febae8f 100644 --- a/types/steed/index.d.ts +++ b/types/steed/index.d.ts @@ -25,9 +25,9 @@ declare namespace steed { length(): number; kill(): void; concurrency: number; - drain: () => any; - empty: () => any; - saturated: () => any; + drain(): any; + empty(): any; + saturated(): any; } interface Steed { diff --git a/types/steed/steed-tests.ts b/types/steed/steed-tests.ts index dd89e4480b..708a443fa1 100644 --- a/types/steed/steed-tests.ts +++ b/types/steed/steed-tests.ts @@ -2,8 +2,8 @@ import steed = require('steed'); -declare var path: { - exists: (path: string, callback?: (error: Error, exists: boolean) => any) => void; +declare const path: { + exists(path: string, callback?: (error: Error, exists: boolean) => any): void; }; function funcStringCbErrBoolean(v: string, cb: (error: Error, res: boolean) => void) { } @@ -19,15 +19,15 @@ steed.series([ () => {} ]); -var data: any[] = []; +const data: any[] = []; function steedProcess(item: any, callback: (error: Error, result: any) => void) { } steed.map(data, steedProcess, (error, results) => { console.log(results); }); -var openFiles = ['file1', 'file2']; +const openFiles = ['file1', 'file2']; -var saveFile = (file: string, cb: (error: Error) => void) => {}; +const saveFile = (file: string, cb: (error: Error) => void) => {}; steed.each(openFiles, saveFile, (error: Error) => {}); steed.eachSeries(openFiles, saveFile, (error: Error) => {}); @@ -109,7 +109,6 @@ steed.parallel([ ], (error, results) => {}); - steed.parallel({ one(callback) { setTimeout(() => { @@ -144,7 +143,7 @@ function whileFn(callback: any) { } function whileTest() { return count < 5; } -var count = 0; +let count = 0; steed.waterfall([ (callback: any) => { @@ -158,13 +157,11 @@ steed.waterfall([ } ], (error, result) => {}); - -var q = steed.queue((task: any, callback: () => void) => { +const q = steed.queue((task: any, callback: () => void) => { console.log('hello ' + task.name); callback(); }, 2); - q.drain = () => { console.log('all items have been processed'); }; @@ -189,8 +186,8 @@ q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], (error: Error) => console.log('finished processing bar'); }); -var qLength: number = q.length(); -var qIsIdle: boolean = q.idle(); +const qLength: number = q.length(); +const qIsIdle: boolean = q.idle(); q.saturated = () => { console.log('queue is saturated.'); @@ -209,7 +206,7 @@ q.resume(); q.kill(); // tests for strongly typed tasks -var q2 = steed.queue((task: string, callback: () => void) => { +const q2 = steed.queue((task: string, callback: () => void) => { console.log('Task: ' + task); callback(); }, 1); @@ -251,38 +248,24 @@ steed.each({ a: 1, b: 2 }, (val: number, next: steed.ErrorCallback): void => { - setTimeout((): void => { - console.log(`steed.each: ${val}`); - next(); - }, 500); - }, (err?: Error): void => { - console.log("steed.each: done."); - }); steed.eachSeries({ a: 1, b: 2 }, (val: number, next: steed.ErrorCallback): void => { - setTimeout((): void => { - console.log(`steed.eachSeries: ${val}`); - next(); - }, 500); - }, (err?: Error): void => { - console.log("steed.eachSeries: done."); - }); // map @@ -292,19 +275,12 @@ steed.map({ b: 2, c: 3 }, (val: number, next: steed.SteedResultCallback): void => { - setTimeout((): void => { - console.log(`steed.map: ${val}`); - next(undefined as any, val.toString()); - }, 500); - }, (error: Error, results: string[]): void => { - console.log("steed.map: done with results", results); - }); steed.mapSeries({ @@ -312,17 +288,10 @@ steed.mapSeries({ b: 2, c: 3 }, (val: number, next: steed.SteedResultCallback): void => { - setTimeout((): void => { - console.log(`steed.mapSeries: ${val}`); - next(undefined as any, val.toString()); - }, 500); - }, (error: Error, results: string[]): void => { - console.log("steed.mapSeries: done with results", results); - }); diff --git a/types/stream-buffers/index.d.ts b/types/stream-buffers/index.d.ts index d3871b1efa..aa0602b835 100644 --- a/types/stream-buffers/index.d.ts +++ b/types/stream-buffers/index.d.ts @@ -11,7 +11,7 @@ export interface WritableStreamBufferOptions extends stream.WritableOptions { incrementAmount?: number; } -export declare class WritableStreamBuffer extends stream.Writable { +export class WritableStreamBuffer extends stream.Writable { constructor(options?: WritableStreamBufferOptions); size(): number; maxSize(): number; @@ -26,7 +26,7 @@ export interface ReadableStreamBufferOptions extends stream.ReadableOptions { incrementAmount?: number; } -export declare class ReadableStreamBuffer extends stream.Readable { +export class ReadableStreamBuffer extends stream.Readable { constructor(options?: ReadableStreamBufferOptions); put(data: string | Buffer, encoding?: string): void; stop(): void; @@ -34,7 +34,7 @@ export declare class ReadableStreamBuffer extends stream.Readable { maxSize(): number; } -export declare const DEFAULT_INITIAL_SIZE: number; -export declare const DEFAULT_INCREMENT_AMOUNT: number; -export declare const DEFAULT_FREQUENCY: number; -export declare const DEFAULT_CHUNK_SIZE: number; +export const DEFAULT_INITIAL_SIZE: number; +export const DEFAULT_INCREMENT_AMOUNT: number; +export const DEFAULT_FREQUENCY: number; +export const DEFAULT_CHUNK_SIZE: number; diff --git a/types/stream-buffers/stream-buffers-tests.ts b/types/stream-buffers/stream-buffers-tests.ts index 7bccc43f15..c7051023b8 100644 --- a/types/stream-buffers/stream-buffers-tests.ts +++ b/types/stream-buffers/stream-buffers-tests.ts @@ -3,15 +3,15 @@ import * as streamBuffers from 'stream-buffers'; // The following are examples from README.md // https://github.com/samcday/node-stream-buffer -var myWritableStreamBuffer = new streamBuffers.WritableStreamBuffer({ +const myWritableStreamBuffer = new streamBuffers.WritableStreamBuffer({ initialSize: (100 * 1024), // start at 100 kilobytes. incrementAmount: (10 * 1024) // grow by 10 kilobytes each time buffer overflows. }); -var a = streamBuffers.DEFAULT_INITIAL_SIZE; // (8 * 1024) -var b = streamBuffers.DEFAULT_INCREMENT_AMOUNT; // (8 * 1024) -var c = streamBuffers.DEFAULT_CHUNK_SIZE; // (1024) -var d = streamBuffers.DEFAULT_FREQUENCY; // (1) +const a = streamBuffers.DEFAULT_INITIAL_SIZE; // (8 * 1024) +const b = streamBuffers.DEFAULT_INCREMENT_AMOUNT; // (8 * 1024) +const c = streamBuffers.DEFAULT_CHUNK_SIZE; // (1024) +const d = streamBuffers.DEFAULT_FREQUENCY; // (1) const buffer = new Buffer('ASDF'); myWritableStreamBuffer.write('ASDF'); @@ -31,7 +31,7 @@ myWritableStreamBuffer.getContents(5); // Gets first 5 bytes as a utf8 string. myWritableStreamBuffer.getContentsAsString('utf8', 5); -var myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({ +const myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({ frequency: 10, // in milliseconds. chunkSize: 2048 // in bytes. }); diff --git a/types/strong-cluster-control/index.d.ts b/types/strong-cluster-control/index.d.ts index 5037aed03b..e0b3fb5c12 100644 --- a/types/strong-cluster-control/index.d.ts +++ b/types/strong-cluster-control/index.d.ts @@ -7,7 +7,7 @@ declare namespace StrongClusterControl { type pid = number; - export interface StartOptions { + interface StartOptions { size?: number; env?: {}; shutdownTimeout?: number; @@ -15,17 +15,17 @@ declare namespace StrongClusterControl { throttleDelay?: number; } - export interface ClusterMaster { + interface ClusterMaster { pid: number; setSize?: number; startTime: number; } - export interface ClusterWorker extends ClusterMaster { + interface ClusterWorker extends ClusterMaster { id: number; } - export interface ClusterStatus { + interface ClusterStatus { master: ClusterMaster; workers: ClusterWorker[]; } @@ -34,7 +34,7 @@ declare namespace StrongClusterControl { SHUTDOWN: "CLUSTER_CONTROL_shutdown"; } - export interface Control extends NodeJS.EventEmitter { + interface Control extends NodeJS.EventEmitter { readonly cmd: CMD; readonly CPUS: number; readonly options: StartOptions; diff --git a/types/swagger-sails-hook/index.d.ts b/types/swagger-sails-hook/index.d.ts index 4ce957a6bf..6d474c1907 100644 --- a/types/swagger-sails-hook/index.d.ts +++ b/types/swagger-sails-hook/index.d.ts @@ -26,14 +26,13 @@ declare namespace SwaggerHook { * @see {@link http://sailsjs.com/documentation/concepts/extending-sails/hooks/hook-specification|Sails Hook Docs} * @see {@link http://sailsjs.com/documentation/anatomy/api/hooks/my-hook/index-js|Sails Hook Example} */ - export interface SailsHook { - + interface SailsHook { /** * Perform startup tasks. * All Sails configuration is guaranteed to be completed before a hook’s initialize function runs. * @param {Function} done - called when `swagger-sails-hook`'s startup tasks have finished. */ - initialize: (done: () => any) => void; + initialize(done: () => any): void; /** * `swagger-sails-hook` specific route bound to a Sails app at load time. @@ -48,7 +47,7 @@ declare namespace SwaggerHook { * This route will match any routes that aren't bound in the app via a custom route configuration * or a blueprint. */ - "/*": (req: any, res: any, next: () => any) => any + "/*"(req: any, res: any, next: () => any): any } }; } diff --git a/types/swagger-sails-hook/swagger-sails-hook-tests.ts b/types/swagger-sails-hook/swagger-sails-hook-tests.ts index c1b73a08b7..9d5cc1d6b8 100644 --- a/types/swagger-sails-hook/swagger-sails-hook-tests.ts +++ b/types/swagger-sails-hook/swagger-sails-hook-tests.ts @@ -1,7 +1,6 @@ import swaggerSailsHook = require("swagger-sails-hook"); import * as express from "express"; - const mockSailsApp = { models: {}, conf: {}, diff --git a/types/swagger-schema-official/index.d.ts b/types/swagger-schema-official/index.d.ts index f0f2e60183..f988d75831 100644 --- a/types/swagger-schema-official/index.d.ts +++ b/types/swagger-schema-official/index.d.ts @@ -132,7 +132,7 @@ interface BaseSchema { uniqueItems?: boolean; maxProperties?: number; minProperties?: number; - enum?: (string|boolean|number|{})[]; + enum?: Array; type?: string; items?: Schema|Schema[]; } diff --git a/types/tedious-connection-pool/index.d.ts b/types/tedious-connection-pool/index.d.ts index 7d144bfc22..dcd02a97e9 100644 --- a/types/tedious-connection-pool/index.d.ts +++ b/types/tedious-connection-pool/index.d.ts @@ -12,7 +12,7 @@ declare namespace tcp { /** * Extends Tedious Connection with release function */ - export class PooledConnection extends tedious.Connection { + class PooledConnection extends tedious.Connection { /** * If the connection is issued from a connection pool returns the connection to the pool. */ @@ -24,12 +24,12 @@ declare namespace tcp { * @param err error if any * @param connection issued from the pool */ - export type ConnectionCallback = (err: Error, connection: PooledConnection) => void; + type ConnectionCallback = (err: Error, connection: PooledConnection) => void; /** * Pool Configuration interface */ - export interface PoolConfig { + interface PoolConfig { /** * Minimum concurrent connections */ diff --git a/types/tedious-connection-pool/tedious-connection-pool-tests.ts b/types/tedious-connection-pool/tedious-connection-pool-tests.ts index 0a2ec38be6..f5151db7e4 100644 --- a/types/tedious-connection-pool/tedious-connection-pool-tests.ts +++ b/types/tedious-connection-pool/tedious-connection-pool-tests.ts @@ -1,7 +1,7 @@ import ConnectionPool = require("tedious-connection-pool"); import tedious = require("tedious"); -var config: tedious.ConnectionConfig = { +const config: tedious.ConnectionConfig = { userName: "rogier", password: "rogiers password", server: "127.0.0.1", @@ -11,12 +11,12 @@ var config: tedious.ConnectionConfig = { } }; -var poolConfig : ConnectionPool.PoolConfig = { +const poolConfig: ConnectionPool.PoolConfig = { min: 1, max: 4 }; -var pool: ConnectionPool = new ConnectionPool(poolConfig, config); +const pool: ConnectionPool = new ConnectionPool(poolConfig, config); pool.on('error', (err: Error) => { console.error(err); @@ -34,8 +34,7 @@ pool.acquire((err: Error, connection: ConnectionPool.PooledConnection) => { connection.rollbackTransaction((error: Error): void => {}); connection.commitTransaction((error: Error): void => {}); - - var request = new tedious.Request("SELECT * FROM foo", (error: Error, rowCount: number): void => { + const request = new tedious.Request("SELECT * FROM foo", (error: Error, rowCount: number): void => { }); request.on("row", (row: tedious.ColumnValue[]): void => { }); @@ -43,11 +42,5 @@ pool.acquire((err: Error, connection: ConnectionPool.PooledConnection) => { connection.release(); - pool.drain(); }); - - - - - diff --git a/types/transducers-js/transducers-js-tests.ts b/types/transducers-js/transducers-js-tests.ts index d11825838f..30b91d8f47 100644 --- a/types/transducers-js/transducers-js-tests.ts +++ b/types/transducers-js/transducers-js-tests.ts @@ -2,7 +2,7 @@ import * as t from 'transducers-js'; -var map = t.map, +const map = t.map, filter = t.filter, comp = t.comp, into = t.into; @@ -11,119 +11,119 @@ var map = t.map, function inc(n: number) { return n + 1; }; function isEven(n: number) { return n % 2 === 0; }; -var xf = comp(map(inc), filter(isEven)); +let xf = comp(map(inc), filter(isEven)); into([], xf, [0, 1, 2, 3, 4]); // [2, 4] // integration -var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - apush = (arr: number[], x: number) => { arr.push(x); return arr; }, - xf = comp(map(inc), filter(isEven)), - toFn = t.toFn; +const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +const apush = (arr: number[], x: number) => { arr.push(x); return arr; }; +xf = comp(map(inc), filter(isEven)); +const toFn = t.toFn; arr.reduce(toFn(xf, apush), []); // native // source examples function mapExample() { - var xf = t.map(inc); + const xf = t.map(inc); t.into([], xf, [1, 2, 3]); // [2, 3, 4] } function filterExample() { - var xf = t.filter(isEven); + const xf = t.filter(isEven); t.into([], xf, [0, 1, 2, 3, 4]); // [0, 2, 4]; } function removeExample() { - var xf = t.remove(isEven); + const xf = t.remove(isEven); t.into([], xf, [0, 1, 2, 3, 4]); // [1, 3]; } function complementExample() { - var isOdd = t.complement(isEven); + const isOdd = t.complement(isEven); } function keepIndexedExample() { - var xf = t.keepIndexed((i: number, x: string|number) => { if (typeof x === "string") return "cool"; }); + const xf = t.keepIndexed((i: number, x: string|number) => { if (typeof x === "string") return "cool"; }); t.into([], xf, [0, 1, "foo", 3, 4, "bar"]); // ["foo", "bar"] } function takeExample() { - var xf = t.take(3); + const xf = t.take(3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [0, 1, 2]; } function takeWhileExample() { - var xf = t.takeWhile(n => n < 3); + const xf = t.takeWhile(n => n < 3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [0, 1, 2]; } function intoExample() { - var xf = t.comp(t.map(inc), t.filter(isEven)); + const xf = t.comp(t.map(inc), t.filter(isEven)); t.into([], xf, [1, 2, 3, 4]); // [2, 4] } function toFnExample() { - var arr = [0, 1, 2, 3, 4, 5]; - var xf = t.comp(t.map(inc), t.filter(isEven)); + const arr = [0, 1, 2, 3, 4, 5]; + const xf = t.comp(t.map(inc), t.filter(isEven)); arr.reduce(t.toFn(xf, apush), []); // [2, 4, 6] } function takeNthExample() { - var xf = t.takeNth(3); + const xf = t.takeNth(3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [2, 5]; } function dropExample() { - var xf = t.drop(3); + const xf = t.drop(3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [3, 4, 5]; } function dropWhileExample() { - var xf = t.dropWhile(n => n < 3); + const xf = t.dropWhile(n => n < 3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [3, 4, 5]; } function partitionByExample() { - var xf = t.partitionBy((x: string|number) => typeof x === "string"); + const xf = t.partitionBy((x: string|number) => typeof x === "string"); t.into([], xf, [0, 1, "foo", "bar", 2, 3, "bar", "baz"]); // [[0, 1], ["foo", "bar"], [2, 3], ["bar", "baz"]]; } function partitionAllExample() { - var xf = t.partitionAll(3); + const xf = t.partitionAll(3); t.into([], xf, [0, 1, 2, 3, 4, 5]); // [[0, 1, 2], [3, 4, 5]] } function wrapExample() { - var arrayPush = t.wrap((arr: number[], x: number) => { arr.push(x); return arr; }); + const arrayPush = t.wrap((arr: number[], x: number) => { arr.push(x); return arr; }); } function ensureReducedExample() { - var x = t.ensureReduced(1); - var y = t.ensureReduced(x); + const x = t.ensureReduced(1); + const y = t.ensureReduced(x); x === y; // true } function unreducedExample() { - var x = t.reduced(1); + const x = t.reduced(1); t.unreduced(x); // 1 t.unreduced(t.unreduced(x)); // 1 } function reverse(arr: number[]) { - var arr: number[] = Array.prototype.slice.call(arr, 0); + arr = Array.prototype.slice.call(arr, 0); arr.reverse(); return arr; } function catExample() { - var xf = t.comp(t.map(reverse), t.cat); + const xf = t.comp(t.map(reverse), t.cat); t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6] } function mapcatExample() { - var xf = t.mapcat(reverse); + const xf = t.mapcat(reverse); t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6] } diff --git a/types/ui-router-extras/index.d.ts b/types/ui-router-extras/index.d.ts index 81ddddfc75..006a68b0f3 100644 --- a/types/ui-router-extras/index.d.ts +++ b/types/ui-router-extras/index.d.ts @@ -8,9 +8,7 @@ import * as angular from 'angular'; declare module 'angular' { - export namespace ui { - - + namespace ui { /* * $deepStateRedirect */ @@ -64,7 +62,6 @@ declare module 'angular' { * Previous state service */ interface IPreviousStateService { - /** * Get a previous state * @param memoName Memo name @@ -117,18 +114,17 @@ declare module 'angular' { /* * Function (injectable). Called when a sticky state is navigated away from (inactivated). */ - onInactivate?: (...args: any[]) => void; + onInactivate?(...args: any[]): void; /* * Function (injectable). Called when an inactive sticky state is navigated to (reactivated). */ - onReactivate?: (...args: any[]) => void; + onReactivate?(...args: any[]): void; /* * Note: named views are mandatory when using sticky states! */ views?: { [name: string]: angular.ui.IState }; } - /** * Sticky state service */ @@ -150,9 +146,7 @@ declare module 'angular' { state(name: string, config: IStickyState): IStateProvider; } - interface IFutureStateProvider { - /** * Registers a `FutureState` object as a placeholder for a full UI-Router `state` or `state` tree. */ @@ -164,31 +158,28 @@ declare module 'angular' { stateFactory(type: string, stateFactory: IFutureStateFactory): void; /** - * Adds a resolve function. - * `$futureStateProvider` won't reject any state transitions or routes until all resolveFunction promises have been resolved. + * Adds a resolve function. + * `$futureStateProvider` won't reject any state transitions or routes until all resolveFunction promises have been resolved. * Resolves may be used to defer routing until the states have been loaded via $http, for instance. */ addResolve(resolveFn: IResolveFunction): void; } - interface IFutureStateService { - - } + interface IFutureStateService {} /** * A `FutureState` object is a placeholder for full a UI-Router `state` */ interface IFutureState { - /** - * The placeholder state name (fully qualified). + * The placeholder state name (fully qualified). * Attempted transitions to this state (or any substates) will trigger a lazy load of the full UI-Router `state` represented by this FutureState. */ stateName: string; /** - * The placeholder url path fragment (the fragment is the URL prefix which the state will be accessed on, not the URL of the state's source code). - * Attempted navigations to a URL starting with this fragment will trigger a lazy load of the full UI-Router `state` represented by this FutureState. + * The placeholder url path fragment (the fragment is the URL prefix which the state will be accessed on, not the URL of the state's source code). + * Attempted navigations to a URL starting with this fragment will trigger a lazy load of the full UI-Router `state` represented by this FutureState. */ url: string; diff --git a/types/ui-router-extras/tslint.json b/types/ui-router-extras/tslint.json index 19dc9db271..535e89e2ef 100644 --- a/types/ui-router-extras/tslint.json +++ b/types/ui-router-extras/tslint.json @@ -1,8 +1,7 @@ { "extends": "../tslint.json", "rules": { - "interface-name": [ - false - ] + "interface-name": false, + "no-empty-interface": false } } diff --git a/types/ui-router-extras/ui-router-extras-tests.ts b/types/ui-router-extras/ui-router-extras-tests.ts index 427c0ca498..df560356aa 100644 --- a/types/ui-router-extras/ui-router-extras-tests.ts +++ b/types/ui-router-extras/ui-router-extras-tests.ts @@ -1,23 +1,20 @@ import * as angular from 'angular'; -var myApp = angular.module('testModule') +const myApp = angular.module('testModule'); myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: angular.ui.IStickyStateProvider) => { - var state: angular.ui.IStickyState = { + const state: angular.ui.IStickyState = { name: 'test', sticky: true, dsr: { default: 'substate', params: ['param1', 'param2'], - fn: ($dsr$) => { - - return $dsr$.to; - } + fn: ($dsr$) => $dsr$.to, }, onInactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, onReactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { $previousState.memo('test-memo1'); @@ -37,7 +34,7 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a }); }, views: { - //named views are mandatory + // named views are mandatory 'name1': {} } }; @@ -51,16 +48,13 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a dsr: { default: 'substate', params: ['param1', 'param2'], - fn: ($dsr$) => { - - return $dsr$.to; - } + fn: $dsr$ => $dsr$.to, }, onInactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, onReactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { $previousState.memo('test-memo1'); @@ -80,7 +74,7 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a }); }, views: { - //named views are mandatory + // named views are mandatory 'name1': {} } }); @@ -91,16 +85,13 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a dsr: { default: 'substate', params: ['param1', 'param2'], - fn: ($dsr$) => { - - return $dsr$.to; - } + fn: $dsr$ => $dsr$.to, }, onInactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, onReactivate: ($state: angular.ui.IState) => { - var iAmInjectedByInjector = $state; + const iAmInjectedByInjector = $state; }, controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { $previousState.memo('test-memo1'); @@ -120,44 +111,43 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a }); }, views: { - //named views are mandatory + // named views are mandatory 'name1': {} } }); - }); -var templateLoadStateFactory: ng.ui.IFutureStateFactory = ($q: ng.IQService, $timeout: ng.ITimeoutService, futureState: ng.ui.IFutureState) => { - var d = $q.defer(); +const templateLoadStateFactory: ng.ui.IFutureStateFactory = ($q: ng.IQService, $timeout: ng.ITimeoutService, futureState: ng.ui.IFutureState) => { + const d = $q.defer(); $timeout(() => { - var fullUiRouterState = { + const fullUiRouterState = { name: futureState.stateName, url: futureState.url, template: '

Template

' - } + }; d.resolve(fullUiRouterState); // Async resolve of ui-router state promise }, 1000); return d.promise; // ui-router state promise returned -} +}; myApp.config(($futureStateProvider: ng.ui.IFutureStateProvider) => { $futureStateProvider.addResolve(($q: ng.IQService, $timeout: ng.ITimeoutService) => { - var d = $q.defer(); + const d = $q.defer(); $timeout(() => { d.resolve("When this resolves, future state provider will re-sync the state/url"); }, 1000); return d.promise; }); - var futureState = { type: 'ngload', stateName: 'foo', url: '/foo', src: 'foo.js' }; + const futureState = { type: 'ngload', stateName: 'foo', url: '/foo', src: 'foo.js' }; $futureStateProvider.futureState(futureState); $futureStateProvider.stateFactory('ngload', templateLoadStateFactory); }); -var adminModuleFutureState: ng.ui.IFutureState = { +const adminModuleFutureState: ng.ui.IFutureState = { stateName: 'app.admin', url: '/admin', type: 'ngload', src: 'js/modules/admin.js' // example custom attr -} +}; diff --git a/types/universal-router/index.d.ts b/types/universal-router/index.d.ts index e9f64a1846..b17256ce77 100644 --- a/types/universal-router/index.d.ts +++ b/types/universal-router/index.d.ts @@ -39,7 +39,7 @@ export interface ActionContext extends Context { */ export interface Route { path: string; - action: (ctx: ActionContext & C, params: Params) => R | Promise | void; + action(ctx: ActionContext & C, params: Params): R | Promise | void; children?: Routes; } diff --git a/types/universal-router/universal-router-tests.ts b/types/universal-router/universal-router-tests.ts index 5964ee1a90..1d20af187e 100644 --- a/types/universal-router/universal-router-tests.ts +++ b/types/universal-router/universal-router-tests.ts @@ -26,7 +26,6 @@ const routes2 = [ resolve(routes2, { path: "/hello/john" }) .then(result => console.log(result)); - // Test 3 const routes3 = [ { @@ -38,7 +37,6 @@ const routes3 = [ resolve(routes3, { path: "/hello/john" }) .then(result => console.log(result)); - // Test 4 const routes4 = [ { diff --git a/types/vanilla-tilt/index.d.ts b/types/vanilla-tilt/index.d.ts index 828ca47513..e24208f563 100644 --- a/types/vanilla-tilt/index.d.ts +++ b/types/vanilla-tilt/index.d.ts @@ -6,7 +6,7 @@ /** * A smooth 3D tilt javascript library forked from Tilt.js (jQuery version). */ -export declare namespace VanillaTilt { +export namespace VanillaTilt { /** * Options which configures the tilting */ @@ -49,7 +49,7 @@ export declare namespace VanillaTilt { easing?: string; } - export interface TiltValues { + interface TiltValues { /** * The current tilt on the X axis */ @@ -68,15 +68,15 @@ export declare namespace VanillaTilt { percentageY: number; } - export interface HTMLVanillaTiltElement extends HTMLElement { - vanillaTilt: VanillaTilt + interface HTMLVanillaTiltElement extends HTMLElement { + vanillaTilt: VanillaTilt; } } /** * A smooth 3D tilt javascript library forked from Tilt.js (jQuery version). */ -export declare class VanillaTilt { +export class VanillaTilt { /** * Creates a new instance of a VanillaTilt element. * @param element The element, which should be a VanillaTilt element diff --git a/types/vanilla-tilt/vanilla-tilt-tests.ts b/types/vanilla-tilt/vanilla-tilt-tests.ts index 80691885c4..c40bd56f75 100644 --- a/types/vanilla-tilt/vanilla-tilt-tests.ts +++ b/types/vanilla-tilt/vanilla-tilt-tests.ts @@ -1,6 +1,6 @@ -import { VanillaTilt } from './index.d'; +import { VanillaTilt } from 'vanilla-tilt'; -let element: VanillaTilt = new VanillaTilt(document.createElement('a'), { +const element: VanillaTilt = new VanillaTilt(document.createElement('a'), { axis: 'y', easing: 'cubic-besizer(0.9, 0.9, 0.9)', max: 2, @@ -21,8 +21,7 @@ VanillaTilt.init([document.createElement('a')], { axis: null }); - -let values: VanillaTilt.TiltValues = element.getValues(); +const values: VanillaTilt.TiltValues = element.getValues(); values.percentageX; values.percentageY; values.tiltX; diff --git a/types/voca/voca-tests.ts b/types/voca/voca-tests.ts index 51d159d8ca..2353521ca0 100644 --- a/types/voca/voca-tests.ts +++ b/types/voca/voca-tests.ts @@ -1,10 +1,10 @@ import v = require('voca'); -var str: string; -var num: number; -var bool: boolean; -var strAry: string[]; -var numAry: number[]; +let str: string; +let num: number; +let bool: boolean; +let strAry: string[]; +let numAry: number[]; // Case str = v.camelCase(); @@ -222,18 +222,18 @@ str = v.splice('new year', 0, 3, 'happy'); str = v.tr(); str = v.tr('hello', 'el', 'ip'); str = v.tr('Yes. The fire rises.', { - 'Yes': 'Awesome', - 'fire': 'flame' -}) + Yes: 'Awesome', + fire: 'flame' +}); str = v('hello').tr('el', 'ip').value(); str = v('Yes. The fire rises.').tr({ - 'Yes': 'Awesome', - 'fire': 'flame' + Yes: 'Awesome', + fire: 'flame' }).value(); str = v.chain('hello').tr('el', 'ip').value(); str = v.chain('Yes. The fire rises.').tr({ - 'Yes': 'Awesome', - 'fire': 'flame' + Yes: 'Awesome', + fire: 'flame' }).value(); str = v.trim(); @@ -349,5 +349,5 @@ str = v.stripTags('Winter is cold', ['b', 'i']); str = v.stripTags('Sun
set', '', '-'); // Util -var voca: v.VocaStatic = v.noConflict(); -var version: string = v.version; +const voca: v.VocaStatic = v.noConflict(); +const version: string = v.version; diff --git a/types/webmidi/index.d.ts b/types/webmidi/index.d.ts index a103ea77dd..b1f3cb0f61 100644 --- a/types/webmidi/index.d.ts +++ b/types/webmidi/index.d.ts @@ -12,7 +12,7 @@ interface Navigator { } declare namespace WebMidi { - export interface MIDIOptions { + interface MIDIOptions { /** * This member informs the system whether the ability to send and receive system * exclusive messages is requested or allowed on a given MIDIAccess object. @@ -24,15 +24,15 @@ declare namespace WebMidi { * This is a maplike interface whose value is a MIDIInput instance and key is its * ID. */ - export type MIDIInputMap = Map; + type MIDIInputMap = Map; /** * This is a maplike interface whose value is a MIDIOutput instance and key is its * ID. */ - export type MIDIOutputMap = Map; + type MIDIOutputMap = Map; - export interface MIDIAccess extends EventTarget { + interface MIDIAccess extends EventTarget { /** * The MIDI input ports available to the system. */ @@ -47,7 +47,7 @@ declare namespace WebMidi { * The handler called when a new port is connected or an existing port changes the * state attribute. */ - onstatechange: (e: MIDIConnectionEvent) => void; + onstatechange(e: MIDIConnectionEvent): void; /** * This attribute informs the user whether system exclusive support is enabled on @@ -56,13 +56,13 @@ declare namespace WebMidi { sysexEnabled: boolean; } - export type MIDIPortType = "input" | "output"; + type MIDIPortType = "input" | "output"; - export type MIDIPortDeviceState = "disconnected" | "connected"; + type MIDIPortDeviceState = "disconnected" | "connected"; - export type MIDIPortConnectionState = "open" | "closed" | "pending"; + type MIDIPortConnectionState = "open" | "closed" | "pending"; - export interface MIDIPort extends EventTarget { + interface MIDIPort extends EventTarget { /** * A unique ID of the port. This can be used by developers to remember ports the * user has chosen for their application. @@ -104,7 +104,7 @@ declare namespace WebMidi { * The handler called when an existing port changes its state or connection * attributes. */ - onstatechange: (e: MIDIConnectionEvent) => void; + onstatechange(e: MIDIConnectionEvent): void; /** * Makes the MIDI device corresponding to the MIDIPort explicitly available. Note @@ -133,11 +133,11 @@ declare namespace WebMidi { close(): Promise; } - export interface MIDIInput extends MIDIPort { - onmidimessage: (e: MIDIMessageEvent) => void; + interface MIDIInput extends MIDIPort { + onmidimessage(e: MIDIMessageEvent): void; } - export interface MIDIOutput extends MIDIPort { + interface MIDIOutput extends MIDIPort { /** * Enqueues the message to be sent to the corresponding MIDI port. * @param data The data to be enqueued, with each sequence entry representing a single byte of data. @@ -156,7 +156,7 @@ declare namespace WebMidi { clear(): void; } - export interface MIDIMessageEvent extends Event { + interface MIDIMessageEvent extends Event { /** * A timestamp specifying when the event occurred. */ @@ -168,7 +168,7 @@ declare namespace WebMidi { data: Uint8Array; } - export interface MIDIMessageEventInit extends EventInit { + interface MIDIMessageEventInit extends EventInit { /** * A timestamp specifying when the event occurred. */ @@ -180,14 +180,14 @@ declare namespace WebMidi { data: Uint8Array; } - export interface MIDIConnectionEvent extends Event { + interface MIDIConnectionEvent extends Event { /** * The port that has been connected or disconnected. */ port: MIDIPort; } - export interface MIDIConnectionEventInit extends EventInit { + interface MIDIConnectionEventInit extends EventInit { /** * The port that has been connected or disconnected. */ diff --git a/types/webmidi/webmidi-tests.ts b/types/webmidi/webmidi-tests.ts index f361202895..6e9ca69a5f 100644 --- a/types/webmidi/webmidi-tests.ts +++ b/types/webmidi/webmidi-tests.ts @@ -1,6 +1,4 @@ - - -var onFulfilled = (item: WebMidi.MIDIAccess) => { +const onFulfilled = (item: WebMidi.MIDIAccess) => { this._midiPort = item; item.onstatechange = (event: WebMidi.MIDIConnectionEvent) => { @@ -11,14 +9,14 @@ var onFulfilled = (item: WebMidi.MIDIAccess) => { console.log("sysexenabled"); console.log(item.sysexEnabled); - var inputs = this._midiPort.inputs.values(); + const inputs = this._midiPort.inputs.values(); for (const o of inputs) { this._inputs.push(o); console.log(o); } - var outputs = item.outputs.values(); + const outputs = item.outputs.values(); for (const op of outputs) { this._outputs.push(op); op.send([ 0x90, 0x45, 0x7f ] ); @@ -31,7 +29,7 @@ var onFulfilled = (item: WebMidi.MIDIAccess) => { } }; -var onRejected = (e: Error) => { console.error(e); }; +const onRejected = (e: Error) => { console.error(e); }; if (navigator.requestMIDIAccess !== undefined) { navigator.requestMIDIAccess().then(onFulfilled, onRejected); diff --git a/types/webtorrent/index.d.ts b/types/webtorrent/index.d.ts index 22c9417edd..ee2e42cf55 100644 --- a/types/webtorrent/index.d.ts +++ b/types/webtorrent/index.d.ts @@ -13,12 +13,12 @@ import { Wire } from 'bittorrent-protocol'; declare const WebTorrent: WebTorrent.WebTorrent; declare namespace WebTorrent { - export interface WebTorrent { + interface WebTorrent { new (config?: Options): Instance; (config?: Options): Instance; WEBRTC_SUPPORT: boolean; } - export interface Options { + interface Options { maxConns?: number; nodeId?: string | Buffer; peerId?: string | Buffer; @@ -27,16 +27,16 @@ declare namespace WebTorrent { webSeeds?: boolean; } - export interface TorrentOptions { + interface TorrentOptions { announce?: any[]; - getAnnounceOpts?: () => void; + getAnnounceOpts?(): void; maxWebConns?: number; path?: string; - store?: (chunkLength: number, storeOpts: { length: number, files: File[], torrent: Torrent, }) => any; + store?(chunkLength: number, storeOpts: { length: number, files: File[], torrent: Torrent, }): any; name?: string; } - export interface Instance extends NodeJS.EventEmitter { + interface Instance extends NodeJS.EventEmitter { on(event: 'torrent', callback: (torrent: Torrent) => void): this; on(event: 'error', callback: (err: Error | string) => void): this; @@ -63,7 +63,7 @@ declare namespace WebTorrent { readonly ratio: number; } - export interface Torrent extends NodeJS.EventEmitter { + interface Torrent extends NodeJS.EventEmitter { readonly infoHash: string; readonly magnetURI: string; @@ -127,7 +127,7 @@ declare namespace WebTorrent { on(event: 'noPeers', callback: (announceType: 'tracker' | 'dht') => void): this; } - export interface TorrentFile extends NodeJS.EventEmitter { + interface TorrentFile extends NodeJS.EventEmitter { readonly name: string; readonly path: string; diff --git a/types/webtorrent/webtorrent-tests.ts b/types/webtorrent/webtorrent-tests.ts index f0f80cb1b3..06d8f853f3 100644 --- a/types/webtorrent/webtorrent-tests.ts +++ b/types/webtorrent/webtorrent-tests.ts @@ -1,8 +1,8 @@ import * as WebTorrent from 'webtorrent'; import * as fs from 'fs'; -var client = new WebTorrent(); -var magnetURI = '...'; +const client = new WebTorrent(); +const magnetURI = '...'; client.add(magnetURI, {}, torrent => { // Got torrent metadata! @@ -25,7 +25,7 @@ client.add(magnetURI, {}, torrent => { file.getBlobURL((err, url) => { if (err) throw err; - var a = document.createElement('a'); + const a = document.createElement('a'); // a.download = file.name if (url) { a.href = url; @@ -61,7 +61,7 @@ client.seed('./file.txt', {}, torrent => { client.add(magnetURI, torrent => { // create HTTP server for this torrent - var server = torrent.createServer(); + const server = torrent.createServer(); server.listen(1234); // start the server listening to a port // visit http://localhost:/ to see a list of files diff --git a/types/wu/index.d.ts b/types/wu/index.d.ts index 3de797c454..733daa7141 100644 --- a/types/wu/index.d.ts +++ b/types/wu/index.d.ts @@ -7,7 +7,7 @@ declare namespace Wu { type Consumer = (t: T) => void; type Filter = (t: T) => boolean; - export interface WuStatic { + interface WuStatic { (iterable: Iterable): WuIterable; // only static chain(...iters: Array>): WuIterable; @@ -62,7 +62,7 @@ declare namespace Wu { tee(iter: Iterable): Array>; tee(n: number, iter: Iterable): Array>; } - export interface WuIterable extends IterableIterator { + interface WuIterable extends IterableIterator { // generated from section "copied to WuIterable" above via // sed -r 's/(, )?iter: Iterable<\w+>//' | // sed -r 's/^(\s+\w+)/\1/' | diff --git a/types/wu/wu-tests.ts b/types/wu/wu-tests.ts index e96324274b..3c62cdb2d4 100644 --- a/types/wu/wu-tests.ts +++ b/types/wu/wu-tests.ts @@ -18,7 +18,7 @@ assert.iterable = (thing: any) => { // iterator are in the |expected| set. assert.eqSet = (expected: any, actual: any) => { assert.iterable(actual); - for (var x of actual) { + for (const x of actual) { assert.ok(expected.has(x)); expected.delete(x); } @@ -96,23 +96,23 @@ describe("wu.count", () => { }); describe("wu.curryable", () => { it("should wait until its given enough arguments", () => { - var f = wu.curryable((a, b) => a + b); + const f = wu.curryable((a, b) => a + b); - var f0 = f()()()()(); + const f0 = f()()()()(); assert.equal(typeof f0, "function"); - var f1 = f(1); + const f1 = f(1); assert.equal(typeof f1, "function"); assert.equal(f1(2), 3); }); it("should just call the function when given enough arguments", () => { - var f = wu.curryable((a, b) => a + b); + const f = wu.curryable((a, b) => a + b); assert.equal(f(1, 2), 3); }); it("should expect the number of arguments we tell it to", () => { - var f = wu.curryable((...args) => 5, 5); + const f = wu.curryable((...args) => 5, 5); assert.equal(typeof f(1, 2, 3, 4), "function"); assert.equal(f(1, 2, 3, 4, 5), 5); }); diff --git a/types/yeoman-generator/yeoman-generator-tests.ts b/types/yeoman-generator/yeoman-generator-tests.ts index e54d0aae4a..f6655aab17 100644 --- a/types/yeoman-generator/yeoman-generator-tests.ts +++ b/types/yeoman-generator/yeoman-generator-tests.ts @@ -85,7 +85,6 @@ generator.runInstall('installer', 'pkg', {}); generator.runInstall('installer', 'pkg', { 'custom-option': 3 }, () => {}); generator.runInstall('installer', 'pkg', {}, () => {}, {}); - const composed1: Base = generator.composeWith('bootstrap', { sass: true }); const composed2: Base = generator.composeWith(require.resolve('generator-bootstrap/app/main.js'), { sass: true });