Socket
Socket
Sign inDemoInstall

fork-ts-checker-webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fork-ts-checker-webpack-plugin - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0-beta.1

changelog.config.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.2.0-beta.1](https://github.com/Realytics/fork-ts-checker-webpack-plugin/compare/v1.1.0...v1.2.0-beta.1@beta) (2019-04-22)
### Features
* ✨ add semantic-release integration ([5fe0653](https://github.com/Realytics/fork-ts-checker-webpack-plugin/commit/5fe0653))
## v1.1.0

@@ -2,0 +9,0 @@

164

package.json
{
"name": "fork-ts-checker-webpack-plugin",
"version": "1.1.0",
"version": "1.2.0-beta.1",
"description": "Runs typescript type checker and linter on separate process.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"build": "tsc --version && tsc --project \"./src\"",
"test:unit": "mocha -R spec ./test/unit --exit",
"test:integration": "mocha -R spec ./test/integration --exit && rimraf tmp",
"test": "npm run build && npm run test:unit && npm run test:integration",
"test:watch": "mocha -R spec --watch ./test/unit",
"test:coverage": "rimraf coverage && istanbul cover -root lib --include-all-sources mocha -- -R spec ./test/unit ./test/integration",
"lint": "tslint --project src/tsconfig.json && eslint ./test",
"lint:fix": "tslint --project src/tsconfig.json --fix && eslint ./test --fix",
"watch": "tsc --version && tsc --project \"./src\" --watch"
},
"repository": {
"url": "https://github.com/Realytics/fork-ts-checker-webpack-plugin.git",
"type": "git"
},
"keywords": [
"webpack",
"plugin",
"typescript",
"type",
"awesome-typescript-loader",
"checker",
"fast",
"fork",
"increment",
"linter",
"fork",
"fast",
"plugin",
"speed",
"ts-loader",
"awesome-typescript-loader",
"increment",
"type",
"typescript",
"webpack",
"webpack-plugin"
],
"engines": {
"node": ">=6.11.5"
"bugs": {
"url": "https://github.com/Realytics/fork-ts-checker-webpack-plugin/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Realytics/fork-ts-checker-webpack-plugin.git"
},
"license": "MIT",
"author": "Piotr Oleś <piotrek.oles@gmail.com>",

@@ -48,7 +33,83 @@ "contributors": [

],
"license": "MIT",
"bugs": {
"url": "https://github.com/Realytics/fork-ts-checker-webpack-plugin/issues"
"files": [
"lib"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "rimraf lib && tsc --version && tsc --project \"./src\"",
"lint": "tslint --project src/tsconfig.json && eslint ./test",
"lint:fix": "tslint --project src/tsconfig.json --fix && eslint ./test --fix",
"test": "yarn build && yarn test:unit && yarn test:integration",
"test:coverage": "rimraf coverage && istanbul cover -root lib --include-all-sources mocha -- -R spec ./test/unit ./test/integration",
"test:integration": "mocha -R spec ./test/integration --exit && rimraf tmp",
"test:unit": "mocha -R spec ./test/unit --exit",
"test:watch": "mocha -R spec --watch ./test/unit",
"watch": "tsc --version && tsc --project \"./src\" --watch",
"precommit": "lint-staged && yarn build",
"commit": "./node_modules/.bin/git-cz"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && yarn build",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"linters": {
"*.js": [
"eslint --fix",
"prettier --write",
"git add"
],
"*.ts": [
"tslint --fix",
"prettier --write",
"git add"
],
"*.{yml,json,md,html}": [
"prettier --write",
"git add"
]
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"release": {
"branches": [
"master",
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github"
]
},
"dependencies": {
"babel-code-frame": "^6.22.0",
"chalk": "^2.4.1",
"chokidar": "^2.0.4",
"micromatch": "^3.1.10",
"minimatch": "^3.0.4",
"semver": "^5.6.0",
"tapable": "^1.0.0",
"worker-rpc": "^0.1.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^7.5.0",
"@semantic-release/changelog": "^3.0.2",
"@types/babel-code-frame": "^6.20.1",

@@ -62,4 +123,6 @@ "@types/chokidar": "^1.7.5",

"chai": "^4.2.0",
"commitlint": "^7.5.2",
"css-loader": "0.28.11",
"eslint": "^5.7.0",
"git-cz": "^3.0.1",
"husky": "^1.1.4",

@@ -73,2 +136,3 @@ "istanbul": "^0.4.5",

"rimraf": "^2.5.4",
"semantic-release": "^16.0.0-beta.18",
"sinon": "^7.1.1",

@@ -86,32 +150,6 @@ "ts-loader": "^5.0.0",

},
"dependencies": {
"babel-code-frame": "^6.22.0",
"chalk": "^2.4.1",
"chokidar": "^2.0.4",
"micromatch": "^3.1.10",
"minimatch": "^3.0.4",
"semver": "^5.6.0",
"tapable": "^1.0.0",
"worker-rpc": "^0.1.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"concurrent": false,
"linters": {
"*.js": [
"eslint --fix"
],
"*.ts": [
"tslint --fix"
],
"*.{js,ts}": [
"prettier --write",
"git add"
]
}
"engines": {
"node": ">=6.11.5",
"yarn": ">=1.0.0"
}
}
# Fork TS Checker Webpack Plugin
[![Npm version](https://img.shields.io/npm/v/fork-ts-checker-webpack-plugin.svg?style=flat-square)](https://www.npmjs.com/package/fork-ts-checker-webpack-plugin)
[![Build Status](https://travis-ci.org/Realytics/fork-ts-checker-webpack-plugin.svg?branch=master)](https://travis-ci.org/Realytics/fork-ts-checker-webpack-plugin)
[![npm version](https://img.shields.io/npm/v/fork-ts-checker-webpack-plugin.svg)](https://www.npmjs.com/package/fork-ts-checker-webpack-plugin)
[![npm beta version](https://img.shields.io/npm/v/fork-ts-checker-webpack-plugin/beta.svg)](https://www.npmjs.com/package/fork-ts-checker-webpack-plugin)
[![build status](https://travis-ci.org/Realytics/fork-ts-checker-webpack-plugin.svg?branch=master)](https://travis-ci.org/Realytics/fork-ts-checker-webpack-plugin)
[![downloads](http://img.shields.io/npm/dm/fork-ts-checker-webpack-plugin.svg)](https://npmjs.org/package/fork-ts-checker-webpack-plugin)
[![commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
Webpack plugin that runs typescript type checker on a separate process.
## Installation
This plugin requires minimum **webpack 2.3**, **typescript 2.1** and optionally **tslint 4.0**
```sh
npm install --save-dev fork-ts-checker-webpack-plugin
```
Basic webpack config (with [ts-loader](https://github.com/TypeStrong/ts-loader))
```js

@@ -31,5 +41,3 @@ var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

},
plugins: [
new ForkTsCheckerWebpackPlugin()
]
plugins: [new ForkTsCheckerWebpackPlugin()]
};

@@ -39,2 +47,3 @@ ```

## Motivation
There is already similar solution - [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader). You can

@@ -48,6 +57,7 @@ add `CheckerPlugin` and delegate checker to the separate process. The problem with `awesome-typescript-loader` was that, in our case,

## Modules resolution
It's very important to be aware that **this plugin uses [typescript](https://github.com/Microsoft/TypeScript)'s, not
[webpack](https://github.com/webpack/webpack)'s modules resolution**. It means that you have to setup `tsconfig.json` correctly. For example
if you set `files: ['./src/someFile.ts']` in `tsconfig.json`, this plugin will check only `someFile.ts` for semantic errors. It's because
of performance. The goal of this plugin is to be *as fast as possible*. With typescript's module resolution we don't have to wait for webpack
of performance. The goal of this plugin is to be _as fast as possible_. With typescript's module resolution we don't have to wait for webpack
to compile files (which traverses dependency graph during compilation) - we have a full list of files from the begin.

@@ -58,2 +68,3 @@

## TSLint
If you have installed [tslint](https://palantir.github.io/tslint), you can enable it by setting `tslint: true` or

@@ -64,12 +75,15 @@ `tslint: './path/to/tslint.json'`. We recommend changing `defaultSeverity` to a `"warning"` in `tslint.json` file.

## Options
* **tsconfig** `string`:
Path to *tsconfig.json* file. Default: `path.resolve(compiler.options.context, './tsconfig.json')`.
* **compilerOptions** `object`:
Allows overriding TypeScript options. Should be specified in the same format as you would do for the `compilerOptions` property in tsconfig.json. Default: `{}`.
- **tsconfig** `string`:
Path to _tsconfig.json_ file. Default: `path.resolve(compiler.options.context, './tsconfig.json')`.
* **tslint** `string | true | undefined`:
- If `string`, path to *tslint.json* file to check source files against.
- **compilerOptions** `object`:
Allows overriding TypeScript options. Should be specified in the same format as you would do for the `compilerOptions` property in tsconfig.json. Default: `{}`.
- **tslint** `string | true | undefined`:
- If `string`, path to _tslint.json_ file to check source files against.
- If `true`, path to `tslint.json` file will be computed with respect to currently checked file, just like TSLint
CLI would do. Suppose you have a project:
```

@@ -87,2 +101,3 @@ ./

```
In such a case `src/file.ts` and `src/anotherFile.ts` would be checked against root `tslint.json`, and

@@ -93,98 +108,132 @@ `src/lib/someHelperFile.ts` would be checked against `src/lib/tslint.json`.

* **tslintAutoFix** `boolean `:
Passes on `--fix` flag while running `tslint` to auto fix linting errors. Default: false.
- **tslintAutoFix** `boolean`:
Passes on `--fix` flag while running `tslint` to auto fix linting errors. Default: false.
* **watch** `string | string[]`:
Directories or files to watch by service. Not necessary but improves performance (reduces number of `fs.stat` calls).
- **watch** `string | string[]`:
Directories or files to watch by service. Not necessary but improves performance (reduces number of `fs.stat` calls).
* **async** `boolean`:
True by default - `async: false` can block webpack's emit to wait for type checker/linter and to add errors to the webpack's compilation.
We recommend to set this to `false` in projects where type checking is faster than webpack's build - it's better for integration with other plugins. Another scenario where you might want to set this to `false` is if you use the `overlay` functionality of `webpack-dev-server`.
- **async** `boolean`:
True by default - `async: false` can block webpack's emit to wait for type checker/linter and to add errors to the webpack's compilation.
We recommend to set this to `false` in projects where type checking is faster than webpack's build - it's better for integration with other plugins. Another scenario where you might want to set this to `false` is if you use the `overlay` functionality of `webpack-dev-server`.
* **ignoreDiagnostics** `number[]`:
List of typescript diagnostic codes to ignore.
- **ignoreDiagnostics** `number[]`:
List of typescript diagnostic codes to ignore.
* **ignoreLints** `string[]`:
List of tslint rule names to ignore.
- **ignoreLints** `string[]`:
List of tslint rule names to ignore.
* **ignoreLintWarnings** `boolean`:
If true, will ignore all lint warnings.
- **ignoreLintWarnings** `boolean`:
If true, will ignore all lint warnings.
* **reportFiles** `string[]`:
Only report errors on files matching these glob patterns. This can be useful when certain types definitions have errors that are not fatal to your application. Default: `[]`. Please note that this may behave unexpectedly if using the incremental API as the incremental API doesn't look for global and semantic errors [if it has already found syntactic errors](https://github.com/Microsoft/TypeScript/blob/89386ddda7dafc63cb35560e05412487f47cc267/src/compiler/watch.ts#L141).
- **reportFiles** `string[]`:
Only report errors on files matching these glob patterns. This can be useful when certain types definitions have errors that are not fatal to your application. Default: `[]`. Please note that this may behave unexpectedly if using the incremental API as the incremental API doesn't look for global and semantic errors [if it has already found syntactic errors](https://github.com/Microsoft/TypeScript/blob/89386ddda7dafc63cb35560e05412487f47cc267/src/compiler/watch.ts#L141).
```js
// in webpack.config.js
new ForkTsCheckerWebpackPlugin({ reportFiles: ['src/**/*.{ts,tsx}', '!src/skip.ts'] })
// in webpack.config.js
new ForkTsCheckerWebpackPlugin({
reportFiles: ['src/**/*.{ts,tsx}', '!src/skip.ts']
});
```
* **colors** `boolean`:
If `false`, disables built-in colors in logger messages. Default: `true`.
- **colors** `boolean`:
If `false`, disables built-in colors in logger messages. Default: `true`.
* **logger** `object`:
Logger instance. It should be object that implements method: `error`, `warn`, `info`. Default: `console`.
- **logger** `object`:
Logger instance. It should be object that implements method: `error`, `warn`, `info`. Default: `console`.
* **formatter** `'default' | 'codeframe' | ((message: NormalizedMessage, useColors: boolean) => string)`:
Formatter for diagnostics and lints. By default uses `default` formatter. You can also pass your own formatter as a function
(see `src/NormalizedMessage.js` and `src/formatter/` for api reference).
- **formatter** `'default' | 'codeframe' | ((message: NormalizedMessage, useColors: boolean) => string)`:
Formatter for diagnostics and lints. By default uses `default` formatter. You can also pass your own formatter as a function
(see `src/NormalizedMessage.js` and `src/formatter/` for api reference).
* **formatterOptions** `object`:
Options passed to formatters (currently only `codeframe` - see [available options](https://www.npmjs.com/package/babel-code-frame#options))
- **formatterOptions** `object`:
Options passed to formatters (currently only `codeframe` - see [available options](https://www.npmjs.com/package/babel-code-frame#options))
* **silent** `boolean`:
If `true`, logger will not be used. Default: `false`.
- **silent** `boolean`:
If `true`, logger will not be used. Default: `false`.
* **checkSyntacticErrors** `boolean`:
This option is useful if you're using ts-loader in `happyPackMode` with [HappyPack](https://github.com/amireh/happypack) or [thread-loader](https://github.com/webpack-contrib/thread-loader) to parallelise your builds. If `true` it will ensure that the plugin checks for *both* syntactic errors (eg `const array = [{} {}];`) and semantic errors (eg `const x: number = '1';`). By default the plugin only checks for semantic errors. This is because when ts-loader is used in `transpileOnly` mode, ts-loader will still report syntactic errors. When used in `happyPackMode` it does not. Default: `false`.
- **checkSyntacticErrors** `boolean`:
This option is useful if you're using ts-loader in `happyPackMode` with [HappyPack](https://github.com/amireh/happypack) or [thread-loader](https://github.com/webpack-contrib/thread-loader) to parallelise your builds. If `true` it will ensure that the plugin checks for _both_ syntactic errors (eg `const array = [{} {}];`) and semantic errors (eg `const x: number = '1';`). By default the plugin only checks for semantic errors. This is because when ts-loader is used in `transpileOnly` mode, ts-loader will still report syntactic errors. When used in `happyPackMode` it does not. Default: `false`.
* **memoryLimit** `number`:
Memory limit for service process in MB. If service exits with allocation failed error, increase this number. Default: `2048`.
- **memoryLimit** `number`:
Memory limit for service process in MB. If service exits with allocation failed error, increase this number. Default: `2048`.
* **workers** `number`:
You can split type checking to a few workers to speed-up increment build. **Be careful** - if you don't want to increase build time, you
should keep free 1 core for *build* and 1 core for a *system* *(for example system with 4 CPUs should use max 2 workers)*. Second thing -
node doesn't share memory between workers - keep in mind that memory usage will increase. Be aware that in some scenarios increasing workers
number **can increase checking time**. Default: `ForkTsCheckerWebpackPlugin.ONE_CPU`.
- **workers** `number`:
You can split type checking to a few workers to speed-up increment build. **Be careful** - if you don't want to increase build time, you
should keep free 1 core for _build_ and 1 core for a _system_ _(for example system with 4 CPUs should use max 2 workers)_. Second thing -
node doesn't share memory between workers - keep in mind that memory usage will increase. Be aware that in some scenarios increasing workers
number **can increase checking time**. Default: `ForkTsCheckerWebpackPlugin.ONE_CPU`.
* **vue** `boolean`:
If `true`, the linter and compiler will process VueJs single-file-component (.vue) files. See the
[Vue section](https://github.com/Realytics/fork-ts-checker-webpack-plugin#vue) further down for information on how to correctly setup your project.
- **vue** `boolean`:
If `true`, the linter and compiler will process VueJs single-file-component (.vue) files. See the
[Vue section](https://github.com/Realytics/fork-ts-checker-webpack-plugin#vue) further down for information on how to correctly setup your project.
* **useTypescriptIncrementalApi** `boolean`:
If true, the plugin will use incremental compilation API introduced in typescript 2.7. In this mode you can only have 1
worker, but if the changes in your code are small (like you normally have when you work in 'watch' mode), the compilation
may be much faster, even compared to multi-threaded compilation. Defaults to `true` when working with typescript 3+ and `false` when below 3. The default can be overridden by directly specifying a value.
- **useTypescriptIncrementalApi** `boolean`:
If true, the plugin will use incremental compilation API introduced in typescript 2.7. In this mode you can only have 1
worker, but if the changes in your code are small (like you normally have when you work in 'watch' mode), the compilation
may be much faster, even compared to multi-threaded compilation. Defaults to `true` when working with typescript 3+ and `false` when below 3. The default can be overridden by directly specifying a value.
* **measureCompilationTime** `boolean`:
If true, the plugin will measure the time spent inside the compilation code. This may be useful to compare modes,
especially if there are other loaders/plugins involved in the compilation. **requires node 8+**
- **measureCompilationTime** `boolean`:
If true, the plugin will measure the time spent inside the compilation code. This may be useful to compare modes,
especially if there are other loaders/plugins involved in the compilation. **requires node 8+**
* **typescript** `string`:
If supplied this is a custom path where `typescript` can be found. Defaults to `require.resolve('typescript')`.
- **typescript** `string`:
If supplied this is a custom path where `typescript` can be found. Defaults to `require.resolve('typescript')`.
* **resolveModuleNameModule** and **resolveTypeReferenceDirectiveModule** `string`:
Both of those options refer to files on the disk that respectively export a `resolveModuleName` or a `resolveTypeReferenceDirectiveModule` function. These functions will be used to resolve the import statements and the `<reference types="...">` directives instead of the default TypeScript implementation. Check the following code for an example of what those functions should look like:
<details>
<summary>Code sample</summary>
- **resolveModuleNameModule** and **resolveTypeReferenceDirectiveModule** `string`:
Both of those options refer to files on the disk that respectively export a `resolveModuleName` or a `resolveTypeReferenceDirectiveModule` function. These functions will be used to resolve the import statements and the `<reference types="...">` directives instead of the default TypeScript implementation. Check the following code for an example of what those functions should look like:
<details>
<summary>Code sample</summary>
```js
const {resolveModuleName} = require(`ts-pnp`);
const { resolveModuleName } = require(`ts-pnp`);
exports.resolveModuleName = (typescript, moduleName, containingFile, compilerOptions, resolutionHost) => {
return resolveModuleName(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveModuleName);
exports.resolveModuleName = (
typescript,
moduleName,
containingFile,
compilerOptions,
resolutionHost
) => {
return resolveModuleName(
moduleName,
containingFile,
compilerOptions,
resolutionHost,
typescript.resolveModuleName
);
};
exports.resolveTypeReferenceDirective = (typescript, moduleName, containingFile, compilerOptions, resolutionHost) => {
return resolveModuleName(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveTypeReferenceDirective);
exports.resolveTypeReferenceDirective = (
typescript,
moduleName,
containingFile,
compilerOptions,
resolutionHost
) => {
return resolveModuleName(
moduleName,
containingFile,
compilerOptions,
resolutionHost,
typescript.resolveTypeReferenceDirective
);
};
```
### Pre-computed consts:
- `ForkTsCheckerWebpackPlugin.ONE_CPU` - always use one CPU
- `ForkTsCheckerWebpackPlugin.ALL_CPUS` - always use all CPUs (will increase build time)
- `ForkTsCheckerWebpackPlugin.ONE_CPU_FREE` - leave only one CPU for build (probably will increase build time)
- `ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE` - **recommended** - leave two CPUs free (one for build, one for system)
</details>
### Pre-computed consts:
* `ForkTsCheckerWebpackPlugin.ONE_CPU` - always use one CPU
* `ForkTsCheckerWebpackPlugin.ALL_CPUS` - always use all CPUs (will increase build time)
* `ForkTsCheckerWebpackPlugin.ONE_CPU_FREE` - leave only one CPU for build (probably will increase build time)
* `ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE` - **recommended** - leave two CPUs free (one for build, one for system)
- `ForkTsCheckerWebpackPlugin.ONE_CPU` - always use one CPU
- `ForkTsCheckerWebpackPlugin.ALL_CPUS` - always use all CPUs (will increase build time)
- `ForkTsCheckerWebpackPlugin.ONE_CPU_FREE` - leave only one CPU for build (probably will increase build time)
- `ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE` - **recommended** - leave two CPUs free (one for build, one for system)
## Different behaviour in watch mode

@@ -198,3 +247,3 @@

You may already be using the excellent [webpack-notifier](https://github.com/Turbo87/webpack-notifier) plugin to make build failures more obvious in the form of system notifications. There's an equivalent notifier plugin designed to work with the `fork-ts-checker-webpack-plugin`. It is the `fork-ts-checker-notifier-webpack-plugin` and can be found [here](https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin). This notifier deliberately has a similar API as the `webpack-notifier` plugin to make migration easier.
You may already be using the excellent [webpack-notifier](https://github.com/Turbo87/webpack-notifier) plugin to make build failures more obvious in the form of system notifications. There's an equivalent notifier plugin designed to work with the `fork-ts-checker-webpack-plugin`. It is the `fork-ts-checker-notifier-webpack-plugin` and can be found [here](https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin). This notifier deliberately has a similar API as the `webpack-notifier` plugin to make migration easier.

@@ -208,17 +257,19 @@ ## Known Issue Watching Non-Emitting Files

## Plugin Hooks
This plugin provides some custom webpack hooks (all are sync):
| Event name | Description | Params |
|------------|-------------|--------|
|`fork-ts-checker-cancel`| Cancellation has been requested | `cancellationToken` |
|`fork-ts-checker-waiting`| Waiting for results | `hasTsLint` |
|`fork-ts-checker-service-before-start`| Async plugin that can be used for delaying `fork-ts-checker-service-start` | - |
|`fork-ts-checker-service-start`| Service will be started | `tsconfigPath`, `tslintPath`, `watchPaths`, `workersNumber`, `memoryLimit` |
|`fork-ts-checker-service-start-error` | Cannot start service | `error` |
|`fork-ts-checker-service-out-of-memory`| Service is out of memory | - |
|`fork-ts-checker-receive`| Plugin receives diagnostics and lints from service | `diagnostics`, `lints` |
|`fork-ts-checker-emit`| Service will add errors and warnings to webpack compilation ('build' mode) | `diagnostics`, `lints`, `elapsed` |
|`fork-ts-checker-done`| Service finished type checking and webpack finished compilation ('watch' mode) | `diagnostics`, `lints`, `elapsed` |
| Event name | Description | Params |
| --------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `fork-ts-checker-cancel` | Cancellation has been requested | `cancellationToken` |
| `fork-ts-checker-waiting` | Waiting for results | `hasTsLint` |
| `fork-ts-checker-service-before-start` | Async plugin that can be used for delaying `fork-ts-checker-service-start` | - |
| `fork-ts-checker-service-start` | Service will be started | `tsconfigPath`, `tslintPath`, `watchPaths`, `workersNumber`, `memoryLimit` |
| `fork-ts-checker-service-start-error` | Cannot start service | `error` |
| `fork-ts-checker-service-out-of-memory` | Service is out of memory | - |
| `fork-ts-checker-receive` | Plugin receives diagnostics and lints from service | `diagnostics`, `lints` |
| `fork-ts-checker-emit` | Service will add errors and warnings to webpack compilation ('build' mode) | `diagnostics`, `lints`, `elapsed` |
| `fork-ts-checker-done` | Service finished type checking and webpack finished compilation ('watch' mode) | `diagnostics`, `lints`, `elapsed` |
## Vue
1. Turn on the vue option in the plugin in your webpack config:

@@ -230,13 +281,13 @@

vue: true
})
});
```
2. To activate TypeScript in your `.vue` files, you need to ensure your script tag's language attribute is set
to `ts` or `tsx` (also make sure you include the `.vue` extension in all your import statements as shown below):
to `ts` or `tsx` (also make sure you include the `.vue` extension in all your import statements as shown below):
```html
<script lang="ts">
import Hello from '@/components/hello.vue'
import Hello from '@/components/hello.vue';
// ...
// ...
</script>

@@ -263,2 +314,3 @@ ```

```
4. Add rules to your `tslint.json` and they will be applied to Vue files. For example, you could apply the Standard JS rules [tslint-config-standard](https://github.com/blakeembrey/tslint-config-standard) like this:

@@ -269,7 +321,6 @@

"defaultSeverity": "error",
"extends": [
"tslint-config-standard"
]
"extends": ["tslint-config-standard"]
}
```
5. Ensure your `tsconfig.json` includes .vue files:

@@ -291,2 +342,3 @@

6. It accepts any wildcard in your TypeScript configuration:
```js

@@ -318,2 +370,3 @@ // tsconfig.json

## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc