From 6811cc74cbe3004a8d64cf1c5a82545e73f416eb Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 3 Jul 2017 09:29:47 -0700 Subject: [PATCH] Add linting to webpack-sources. --- types/webpack-sources/index.d.ts | 17 ++++++++--------- types/webpack-sources/tslint.json | 1 + types/webpack-sources/webpack-sources-tests.ts | 7 +++---- 3 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 types/webpack-sources/tslint.json diff --git a/types/webpack-sources/index.d.ts b/types/webpack-sources/index.d.ts index 245e251a7f..548c381978 100644 --- a/types/webpack-sources/index.d.ts +++ b/types/webpack-sources/index.d.ts @@ -1,15 +1,14 @@ -// Type definitions for webpack-sources v0.1.2 +// Type definitions for webpack-sources 0.1 // Project: https://github.com/webpack/webpack-sources // Definitions by: e-cloud +// Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -/// /// -import { Hash } from 'crypto' -import { SourceNode, RawSourceMap, SourceMapGenerator } from 'source-map' -import { SourceListMap } from 'source-list-map' +import { Hash } from 'crypto'; +import { SourceNode, RawSourceMap, SourceMapGenerator } from 'source-map'; +import { SourceListMap } from 'source-list-map'; export abstract class Source { size(): number; @@ -32,7 +31,7 @@ export abstract class Source { listMap(options?: any): any; } -interface SourceAndMapMixin { +export interface SourceAndMapMixin { map(options: { columns?: boolean }): RawSourceMap; sourceAndMap(options: { columns?: boolean }): { source: string; @@ -67,9 +66,9 @@ export class CachedSource { } export class ConcatSource extends Source implements SourceAndMapMixin { - children: (string | Source)[]; + children: Array<(string | Source)>; - constructor(...args: (string | Source)[]); + constructor(...args: Array<(string | Source)>); add(item: string | Source): void; diff --git a/types/webpack-sources/tslint.json b/types/webpack-sources/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-sources/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-sources/webpack-sources-tests.ts b/types/webpack-sources/webpack-sources-tests.ts index 16c915516b..760fbc6d4b 100644 --- a/types/webpack-sources/webpack-sources-tests.ts +++ b/types/webpack-sources/webpack-sources-tests.ts @@ -7,9 +7,8 @@ import { ReplaceSource, OriginalSource, SourceMapSource, - } from 'webpack-sources'; -import { RawSourceMap } from 'source-map' +import { RawSourceMap } from 'source-map'; const s1 = new OriginalSource('a', 'b'); @@ -19,8 +18,8 @@ const s3 = new ConcatSource('a', 'b', s1); const s4 = new RawSource('hey'); -const a = {} as RawSourceMap -const b = {} as RawSourceMap +const a = {} as RawSourceMap; +const b = {} as RawSourceMap; const s5 = new LineToLineMappedSource('a', 'v', 'c'); const s6 = new PrefixSource(s4, s5);