diff --git a/types/case-sensitive-paths-webpack-plugin/index.d.ts b/types/case-sensitive-paths-webpack-plugin/index.d.ts index 360d3d6d08..38fdd9c032 100644 --- a/types/case-sensitive-paths-webpack-plugin/index.d.ts +++ b/types/case-sensitive-paths-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Urthen/case-sensitive-paths-webpack-plugin#readme // Definitions by: Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/clean-webpack-plugin/index.d.ts b/types/clean-webpack-plugin/index.d.ts index 7fc45cc3e4..afe8a65b69 100644 --- a/types/clean-webpack-plugin/index.d.ts +++ b/types/clean-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/johnagan/clean-webpack-plugin // Definitions by: Jed Fox // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/compression-webpack-plugin/index.d.ts b/types/compression-webpack-plugin/index.d.ts index 8fddd72daf..bfb769ed2f 100644 --- a/types/compression-webpack-plugin/index.d.ts +++ b/types/compression-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/webpack-contrib/compression-webpack-plugin // Definitions by: Anton Kandybo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/copy-webpack-plugin/index.d.ts b/types/copy-webpack-plugin/index.d.ts index 8bfae1e0ed..1190adcf91 100644 --- a/types/copy-webpack-plugin/index.d.ts +++ b/types/copy-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kevlened/copy-webpack-plugin // Definitions by: flying-sheep // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack' import { IOptions } from 'minimatch' @@ -30,7 +31,7 @@ interface CopyPattern { context?: string /** * Removes all directory references and only copies file names. - * + * * If files have the same name, the result is non-deterministic. (default: `false`) */ flatten?: boolean diff --git a/types/duplicate-package-checker-webpack-plugin/index.d.ts b/types/duplicate-package-checker-webpack-plugin/index.d.ts index 88d8ccd54c..fd2906aa46 100644 --- a/types/duplicate-package-checker-webpack-plugin/index.d.ts +++ b/types/duplicate-package-checker-webpack-plugin/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Plugin } from 'webpack'; export = DuplicatePackageCheckerWebpackPlugin; -declare class DuplicatePackageCheckerWebpackPlugin extends webpack.Plugin { +declare class DuplicatePackageCheckerWebpackPlugin extends Plugin { constructor(options?: DuplicatePackageCheckerWebpackPlugin.Options); } diff --git a/types/extract-text-webpack-plugin/index.d.ts b/types/extract-text-webpack-plugin/index.d.ts index 962698568a..9f17a66da0 100644 --- a/types/extract-text-webpack-plugin/index.d.ts +++ b/types/extract-text-webpack-plugin/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/webpack-contrib/extract-text-webpack-plugin // Definitions by: flying-sheep , kayo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Plugin, NewLoader, OldLoader } from 'webpack'; export = ExtractTextPlugin; @@ -11,13 +12,13 @@ export = ExtractTextPlugin; * extract-text-webpack-plugin has no support for .options instead of .query yet. * See https://github.com/webpack/extract-text-webpack-plugin/issues/281 */ -type Loader = string | webpack.OldLoader | webpack.NewLoader; +type Loader = string | OldLoader | NewLoader; /** * Use an `ExtractTextPlugin` instance and a loader returned by `extract` in concert to write files to disk instead of loading them into others. * Usage example at https://github.com/webpack/extract-text-webpack-plugin#usage-example-with-css */ -declare class ExtractTextPlugin extends webpack.Plugin { +declare class ExtractTextPlugin extends Plugin { /** Create a plugin instance defining the extraction target file(s) for the files loaded by `extract` */ constructor(options: string | ExtractTextPlugin.PluginOptions); /** diff --git a/types/html-webpack-plugin/index.d.ts b/types/html-webpack-plugin/index.d.ts index dc23e020d7..35774c1ac6 100644 --- a/types/html-webpack-plugin/index.d.ts +++ b/types/html-webpack-plugin/index.d.ts @@ -4,6 +4,7 @@ // Benjamin Lim // Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; import { Options as HtmlMinifierOptions } from 'html-minifier'; diff --git a/types/html-webpack-template/index.d.ts b/types/html-webpack-template/index.d.ts index f1b57fa331..b02be3c463 100644 --- a/types/html-webpack-template/index.d.ts +++ b/types/html-webpack-template/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaketrent/html-webpack-template // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin'; diff --git a/types/loader-utils/index.d.ts b/types/loader-utils/index.d.ts index a178ada777..37ce2e461f 100644 --- a/types/loader-utils/index.d.ts +++ b/types/loader-utils/index.d.ts @@ -3,9 +3,11 @@ // Definitions by: Gyusun Yeom // Totooria Hyperion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + /// -import { loader } from "webpack"; +import { loader } from 'webpack'; export interface InterpolateOption { context?: string; diff --git a/types/lodash-webpack-plugin/index.d.ts b/types/lodash-webpack-plugin/index.d.ts index 7b2c3ebe67..e7e2dfd4db 100644 --- a/types/lodash-webpack-plugin/index.d.ts +++ b/types/lodash-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/lodash/lodash-webpack-plugin#readme // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/optimize-css-assets-webpack-plugin/index.d.ts b/types/optimize-css-assets-webpack-plugin/index.d.ts index b16d384d72..788b2e6a1f 100644 --- a/types/optimize-css-assets-webpack-plugin/index.d.ts +++ b/types/optimize-css-assets-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/NMFR/optimize-css-assets-webpack-plugin // Definitions by: Armando Meziat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/stylelint-webpack-plugin/index.d.ts b/types/stylelint-webpack-plugin/index.d.ts index 580fc4325f..dfaf0a4f05 100644 --- a/types/stylelint-webpack-plugin/index.d.ts +++ b/types/stylelint-webpack-plugin/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/JaKXz/stylelint-webpack-plugin // Definitions by: Arne Bahlo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import { Plugin } from "webpack"; +import { Plugin } from 'webpack'; export = StylelintWebpackPlugin; diff --git a/types/webpack-bundle-analyzer/index.d.ts b/types/webpack-bundle-analyzer/index.d.ts index c563a9e3cf..3f856a7328 100644 --- a/types/webpack-bundle-analyzer/index.d.ts +++ b/types/webpack-bundle-analyzer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/th0r/webpack-bundle-analyzer // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 6f6c46daa8..05aa4e5845 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mozilla-neutrino/webpack-chain // Definitions by: Eirikur Nilsson , Paul Sachs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; import * as https from 'https'; diff --git a/types/webpack-chunk-hash/index.d.ts b/types/webpack-chunk-hash/index.d.ts index dc8f697a44..f499a00dc9 100644 --- a/types/webpack-chunk-hash/index.d.ts +++ b/types/webpack-chunk-hash/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/alexindigo/webpack-chunk-hash#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Plugin } from 'webpack'; export = WebpackChunkHash; -declare class WebpackChunkHash extends webpack.Plugin { +declare class WebpackChunkHash extends Plugin { constructor(options?: WebpackChunkHash.Options); } diff --git a/types/webpack-cleanup-plugin/index.d.ts b/types/webpack-cleanup-plugin/index.d.ts index f5fa620413..a6efd31af7 100644 --- a/types/webpack-cleanup-plugin/index.d.ts +++ b/types/webpack-cleanup-plugin/index.d.ts @@ -2,12 +2,12 @@ // Project: https://github.com/gpbl/webpack-cleanup-plugin#readme // Definitions by: Luka Maljic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); - +import { Plugin } from 'webpack'; export = WebpackCleanupPlugin; -declare class WebpackCleanupPlugin extends webpack.Plugin { +declare class WebpackCleanupPlugin extends Plugin { constructor(options?: WebpackCleanupPlugin.Options); } diff --git a/types/webpack-dotenv-plugin/index.d.ts b/types/webpack-dotenv-plugin/index.d.ts index 4200c3b15e..b8cfb33ef8 100644 --- a/types/webpack-dotenv-plugin/index.d.ts +++ b/types/webpack-dotenv-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nwinch/webpack-dotenv-plugin#readme // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-fail-plugin/index.d.ts b/types/webpack-fail-plugin/index.d.ts index 04f037e084..2db28733c2 100644 --- a/types/webpack-fail-plugin/index.d.ts +++ b/types/webpack-fail-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/TiddoLangerak/webpack-fail-plugin // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-merge/index.d.ts b/types/webpack-merge/index.d.ts index 54c94a738e..23caff9575 100644 --- a/types/webpack-merge/index.d.ts +++ b/types/webpack-merge/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Configuration } from 'webpack'; export = webpackMerge; @@ -18,18 +18,18 @@ declare namespace webpackMerge { customizeArray?: CustomizeArrayFunction | UniqueFunction; customizeObject?: CustomizeObjectFunction; } - type ConfigurationMergeFunction = (...configs: webpack.Configuration[]) => webpack.Configuration; + type ConfigurationMergeFunction = (...configs: Configuration[]) => Configuration; type ConfigurationMergeConfigFunction = (customizeOptions: CustomizeOptions) => ConfigurationMergeFunction; type MergeFunction = ConfigurationMergeFunction | ConfigurationMergeConfigFunction; type MergeStrategy = 'prepend' | 'append' | 'replace'; interface WebpackMerge { - (...configs: webpack.Configuration[]): webpack.Configuration; + (...configs: Configuration[]): Configuration; (customizeOptions: CustomizeOptions): ConfigurationMergeFunction; unique: UniqueFunction; smart: ConfigurationMergeFunction; multiple: ConfigurationMergeFunction; - strategy(options: {[field: string]: MergeStrategy}): ConfigurationMergeFunction; - smartStrategy(options: {[key: string]: MergeStrategy}): ConfigurationMergeFunction; + strategy(options: { [field: string]: MergeStrategy }): ConfigurationMergeFunction; + smartStrategy(options: { [key: string]: MergeStrategy }): ConfigurationMergeFunction; } } diff --git a/types/webpack-merge/v0/index.d.ts b/types/webpack-merge/v0/index.d.ts index a939a2ed53..4cf82afd88 100644 --- a/types/webpack-merge/v0/index.d.ts +++ b/types/webpack-merge/v0/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/survivejs/webpack-merge // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-node-externals/index.d.ts b/types/webpack-node-externals/index.d.ts index 80dc73b27b..c93d3edecf 100644 --- a/types/webpack-node-externals/index.d.ts +++ b/types/webpack-node-externals/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/liady/webpack-node-externals // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { ExternalsFunctionElement } from 'webpack'; export = webpackNodeExternals; -declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement; +declare function webpackNodeExternals(options?: webpackNodeExternals.Options): ExternalsFunctionElement; declare namespace webpackNodeExternals { type WhitelistOption = string | RegExp; diff --git a/types/webpack-notifier/index.d.ts b/types/webpack-notifier/index.d.ts index 1b8e92651f..372b4f2b1c 100644 --- a/types/webpack-notifier/index.d.ts +++ b/types/webpack-notifier/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Turbo87/webpack-notifier#readme // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/webpack-stream/index.d.ts b/types/webpack-stream/index.d.ts index 41fbb3592b..19159f402d 100644 --- a/types/webpack-stream/index.d.ts +++ b/types/webpack-stream/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/shama/webpack-stream // Definitions by: Ian Clanton-Thuon , Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-validator/index.d.ts b/types/webpack-validator/index.d.ts index 4b6b260877..242a71e6f4 100644 --- a/types/webpack-validator/index.d.ts +++ b/types/webpack-validator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/js-dxtools/webpack-validator // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index f8aa375210..b419efc2ea 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -10,6 +10,7 @@ // Alan Agius // Spencer Elliott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -76,7 +77,7 @@ declare namespace webpack { /** Capture timing information for each module. */ profile?: boolean; /** Cache generated modules and chunks to improve performance for multiple incremental builds. */ - cache?: boolean | any; + cache?: boolean | object; /** Enter watch mode, which rebuilds on file change. */ watch?: boolean; watchOptions?: Options.WatchOptions; @@ -491,7 +492,7 @@ declare namespace webpack { */ maxEntrypointSize?: number; } - type Stats = webpack.Stats.ToStringOptions; + type Stats = Stats.ToStringOptions; type WatchOptions = ICompiler.WatchOptions; } @@ -541,7 +542,7 @@ declare namespace webpack { type Handler = ICompiler.Handler; type WatchOptions = ICompiler.WatchOptions; - class Watching implements webpack.Watching { + class Watching implements Watching { constructor(compiler: Compiler, watchOptions: Watching.WatchOptions, handler: Watching.Handler); close(callback: () => void): void; @@ -1029,7 +1030,7 @@ declare namespace webpack { * If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders, * continuing with the calls to the more left loaders. data can be passed between pitch and normal call. */ - pitch?(remainingRequest: string, precedingRequest: string, data: any): any | undefined; + pitch?(remainingRequest: string, precedingRequest: string, data: any): any; /** * By default, the resource file is treated as utf-8 string and passed as String to the loader. @@ -1259,37 +1260,40 @@ declare namespace webpack { /** @deprecated */ namespace compiler { /** @deprecated use webpack.Compiler */ + // tslint:disable-next-line:no-unnecessary-qualifier type Compiler = webpack.Compiler; /** @deprecated use webpack.Compiler.Watching */ - type Watching = webpack.Compiler.Watching; + type Watching = Compiler.Watching; /** @deprecated use webpack.Compiler.WatchOptions */ - type WatchOptions = webpack.Compiler.WatchOptions; + + type WatchOptions = Compiler.WatchOptions; /** @deprecated use webpack.Stats */ + // tslint:disable-next-line:no-unnecessary-qualifier type Stats = webpack.Stats; /** @deprecated use webpack.Stats.ToJsonOptions */ - type StatsOptions = webpack.Stats.ToJsonOptions; + type StatsOptions = Stats.ToJsonOptions; /** @deprecated use webpack.Stats.ToStringOptions */ - type StatsToStringOptions = webpack.Stats.ToStringOptions; + type StatsToStringOptions = Stats.ToStringOptions; /** @deprecated use webpack.Compiler.Handler */ - type CompilerCallback = webpack.Compiler.Handler; + type CompilerCallback = Compiler.Handler; } /** @deprecated use webpack.Options.Performance */ - type PerformanceOptions = webpack.Options.Performance; + type PerformanceOptions = Options.Performance; /** @deprecated use webpack.Options.WatchOptions */ - type WatchOptions = webpack.Options.WatchOptions; + type WatchOptions = Options.WatchOptions; /** @deprecated use webpack.EvalSourceMapDevToolPlugin.Options */ - type EvalSourceMapDevToolPluginOptions = webpack.EvalSourceMapDevToolPlugin.Options; + type EvalSourceMapDevToolPluginOptions = EvalSourceMapDevToolPlugin.Options; /** @deprecated use webpack.SourceMapDevToolPlugin.Options */ - type SourceMapDevToolPluginOptions = webpack.SourceMapDevToolPlugin.Options; + type SourceMapDevToolPluginOptions = SourceMapDevToolPlugin.Options; /** @deprecated use webpack.optimize.UglifyJsPlugin.CommentFilter */ - type UglifyCommentFunction = webpack.optimize.UglifyJsPlugin.CommentFilter; + type UglifyCommentFunction = optimize.UglifyJsPlugin.CommentFilter; /** @deprecated use webpack.optimize.UglifyJsPlugin.Options */ - type UglifyPluginOptions = webpack.optimize.UglifyJsPlugin.Options; + type UglifyPluginOptions = optimize.UglifyJsPlugin.Options; } diff --git a/types/webpack/tslint.json b/types/webpack/tslint.json index 590af11d7e..b4b47a0378 100644 --- a/types/webpack/tslint.json +++ b/types/webpack/tslint.json @@ -1,10 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-any-union": false, - "no-unnecessary-qualifier": false, - "no-void-expression": false, - "space-within-parens": false - } + "extends": "dtslint/dt.json" } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index d74960e4db..2b0cc516e0 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -509,8 +509,10 @@ declare function successfullyCompiled(): void; webpack({ // configuration }, (err, stats) => { - if (err) - return handleFatalError(err); + if (err) { + handleFatalError(err); + return; + } const jsonStats = stats.toJson(); const jsonStatsWithAllOptions = stats.toJson({ assets: true, @@ -537,10 +539,13 @@ webpack({ excludeAssets: ["filter", "excluded"] }); - if (jsonStats.errors.length > 0) - return handleSoftErrors(jsonStats.errors); - if (jsonStats.warnings.length > 0) + if (jsonStats.errors.length > 0) { + handleSoftErrors(jsonStats.errors); + return; + } + if (jsonStats.warnings.length > 0) { handleWarnings(jsonStats.warnings); + } successfullyCompiled(); });