mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
feat: add declarations for fork-ts-checker-webpack-plugin (#25494)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Configuration } from 'webpack';
|
||||
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
||||
|
||||
let config: Configuration = {
|
||||
plugins: [
|
||||
new ForkTsCheckerWebpackPlugin()
|
||||
]
|
||||
};
|
||||
|
||||
config = {
|
||||
plugins: [
|
||||
new ForkTsCheckerWebpackPlugin({})
|
||||
]
|
||||
};
|
||||
|
||||
config = {
|
||||
plugins: [
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
vue: true
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
||||
104
types/fork-ts-checker-webpack-plugin/index.d.ts
vendored
Normal file
104
types/fork-ts-checker-webpack-plugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Type definitions for fork-ts-checker-webpack-plugin 0.4
|
||||
// Project: https://github.com/Realytics/fork-ts-checker-webpack-plugin#readme
|
||||
// Definitions by: JounQin <https://github.com/JounQin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { RuleFailure } from 'tslint';
|
||||
import { Diagnostic } from 'typescript';
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare namespace ForkTsCheckerWebpackPlugin {
|
||||
type ErrorType = 'diagnostic' | 'lint';
|
||||
type Severity = 'error' | 'warning';
|
||||
|
||||
interface NormalizedMessageJson {
|
||||
type: ErrorType;
|
||||
code: string | number;
|
||||
severity: Severity;
|
||||
content: string;
|
||||
file: string;
|
||||
line: number;
|
||||
character: number;
|
||||
}
|
||||
|
||||
class NormalizedMessage {
|
||||
static TYPE_DIAGNOSTIC: ErrorType;
|
||||
static TYPE_LINT: ErrorType;
|
||||
static SEVERITY_ERROR: Severity;
|
||||
static SEVERITY_WARNING: Severity;
|
||||
type: ErrorType;
|
||||
code: string | number;
|
||||
severity: Severity;
|
||||
content: string;
|
||||
file: string;
|
||||
line: number;
|
||||
character: number;
|
||||
constructor(data: NormalizedMessageJson);
|
||||
static createFromDiagnostic(diagnostic: Diagnostic): NormalizedMessage;
|
||||
static createFromLint(lint: RuleFailure): NormalizedMessage;
|
||||
static createFromJSON(json: NormalizedMessageJson): NormalizedMessage;
|
||||
static compare(
|
||||
messageA: NormalizedMessage,
|
||||
messageB: NormalizedMessage,
|
||||
): number;
|
||||
static equals(
|
||||
messageA: NormalizedMessage,
|
||||
messageB: NormalizedMessage,
|
||||
): boolean;
|
||||
static deduplicate(messages: NormalizedMessage[]): NormalizedMessage[];
|
||||
static compareTypes(typeA: ErrorType, typeB: ErrorType): number;
|
||||
static compareSeverities(
|
||||
severityA: Severity,
|
||||
severityB: Severity,
|
||||
): number;
|
||||
static compareOptionalStrings(stringA: string, stringB: string): number;
|
||||
static compareNumbers(numberA: number, numberB: number): number;
|
||||
toJSON(): NormalizedMessageJson;
|
||||
getType(): ErrorType;
|
||||
isDiagnosticType(): boolean;
|
||||
isLintType(): boolean;
|
||||
getCode(): string | number;
|
||||
getFormattedCode(): string | number;
|
||||
getSeverity(): Severity;
|
||||
isErrorSeverity(): boolean;
|
||||
isWarningSeverity(): boolean;
|
||||
getContent(): string;
|
||||
getFile(): string;
|
||||
getLine(): number;
|
||||
getCharacter(): number;
|
||||
}
|
||||
|
||||
type Formatter = (message: NormalizedMessage, useColors: boolean) => string;
|
||||
|
||||
interface Options {
|
||||
tsconfig?: string;
|
||||
tslint?: string | true;
|
||||
watch?: string | string[];
|
||||
async?: boolean;
|
||||
ignoreDiagnostics?: number[];
|
||||
ignoreLints?: string[];
|
||||
colors?: boolean;
|
||||
logger?: Console;
|
||||
formatter?: 'default' | 'codeframe' | Formatter;
|
||||
formatterOptions?: {
|
||||
highlightCode?: boolean
|
||||
linesAbove?: number
|
||||
linesBelow?: number
|
||||
forceColor?: boolean
|
||||
};
|
||||
silent?: boolean;
|
||||
checkSyntacticErrors?: boolean;
|
||||
memoryLimit?: number;
|
||||
workers?: number;
|
||||
vue?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class ForkTsCheckerWebpackPlugin extends Plugin {
|
||||
constructor(options?: ForkTsCheckerWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
export = ForkTsCheckerWebpackPlugin;
|
||||
23
types/fork-ts-checker-webpack-plugin/tsconfig.json
Normal file
23
types/fork-ts-checker-webpack-plugin/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"fork-ts-checker-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/fork-ts-checker-webpack-plugin/tslint.json
Normal file
1
types/fork-ts-checker-webpack-plugin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user