fork-ts-checker-webpack-plugin
Advanced tools
Comparing version 7.0.0-alpha.2 to 7.0.0-alpha.3
@@ -15,4 +15,2 @@ "use strict"; | ||
const TypeScriptReporterRpcClient_1 = require("./typescript-reporter/reporter/TypeScriptReporterRpcClient"); | ||
const assertEsLintSupport_1 = require("./eslint-reporter/assertEsLintSupport"); | ||
const EsLintReporterRpcClient_1 = require("./eslint-reporter/reporter/EsLintReporterRpcClient"); | ||
const tapStartToConnectAndRunReporter_1 = require("./hooks/tapStartToConnectAndRunReporter"); | ||
@@ -48,6 +46,2 @@ const tapStopToDisconnectReporter_1 = require("./hooks/tapStopToDisconnectReporter"); | ||
} | ||
if (configuration.eslint.enabled) { | ||
assertEsLintSupport_1.assertEsLintSupport(configuration.eslint); | ||
reporters.push(EsLintReporterRpcClient_1.createEsLintReporterRpcClient(configuration.eslint)); | ||
} | ||
if (reporters.length) { | ||
@@ -70,3 +64,3 @@ const reporter = reporter_1.createAggregatedReporter(reporter_1.composeReporterRpcClients(reporters)); | ||
*/ | ||
ForkTsCheckerWebpackPlugin.version = '7.0.0-alpha.2'; // will be replaced by the @semantic-release/exec | ||
ForkTsCheckerWebpackPlugin.version = '7.0.0-alpha.3'; // will be replaced by the @semantic-release/exec | ||
/** | ||
@@ -73,0 +67,0 @@ * Default pool for the plugin concurrency limit |
@@ -6,3 +6,2 @@ import webpack from 'webpack'; | ||
import { TypeScriptReporterConfiguration } from './typescript-reporter/TypeScriptReporterConfiguration'; | ||
import { EsLintReporterConfiguration } from './eslint-reporter/EsLintReporterConfiguration'; | ||
import { LoggerConfiguration } from './logger/LoggerConfiguration'; | ||
@@ -12,3 +11,2 @@ interface ForkTsCheckerWebpackPluginConfiguration { | ||
typescript: TypeScriptReporterConfiguration; | ||
eslint: EsLintReporterConfiguration; | ||
issue: IssueConfiguration; | ||
@@ -15,0 +13,0 @@ formatter: FormatterConfiguration; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const TypeScriptReporterConfiguration_1 = require("./typescript-reporter/TypeScriptReporterConfiguration"); | ||
const EsLintReporterConfiguration_1 = require("./eslint-reporter/EsLintReporterConfiguration"); | ||
const LoggerConfiguration_1 = require("./logger/LoggerConfiguration"); | ||
@@ -13,3 +12,2 @@ function createForkTsCheckerWebpackPluginConfiguration(compiler, options = {}) { | ||
typescript: TypeScriptReporterConfiguration_1.createTypeScriptReporterConfiguration(compiler, options.typescript), | ||
eslint: EsLintReporterConfiguration_1.createEsLintReporterConfiguration(compiler, options.eslint), | ||
issue: IssueConfiguration_1.createIssueConfiguration(compiler, options.issue), | ||
@@ -16,0 +14,0 @@ formatter: formatter_1.createFormatterConfiguration(options.formatter), |
import { TypeScriptReporterOptions } from './typescript-reporter/TypeScriptReporterOptions'; | ||
import { EsLintReporterOptions } from './eslint-reporter/EsLintReporterOptions'; | ||
import { IssueOptions } from './issue/IssueOptions'; | ||
@@ -9,3 +8,2 @@ import { FormatterOptions } from './formatter'; | ||
typescript?: TypeScriptReporterOptions; | ||
eslint?: EsLintReporterOptions; | ||
formatter?: FormatterOptions; | ||
@@ -12,0 +10,0 @@ issue?: IssueOptions; |
@@ -12,5 +12,2 @@ { | ||
}, | ||
"eslint": { | ||
"$ref": "#/definitions/EsLintReporterOptions" | ||
}, | ||
"formatter": { | ||
@@ -51,6 +48,2 @@ "$ref": "#/definitions/FormatterOptions" | ||
"properties": { | ||
"origin": { | ||
"type": "string", | ||
"enum": ["typescript", "eslint"] | ||
}, | ||
"severity": { | ||
@@ -210,37 +203,2 @@ "type": "string", | ||
}, | ||
"EsLintReporterOptions": { | ||
"type": "object", | ||
"properties": { | ||
"files": { | ||
"oneOf": [ | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
}, | ||
{ | ||
"type": "string" | ||
} | ||
], | ||
"description": "List of glob patterns or files to be linted." | ||
}, | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Enable EsLint reporter." | ||
}, | ||
"memoryLimit": { | ||
"type": "number", | ||
"description": "Memory limit for EsLint reporter process." | ||
}, | ||
"options": { | ||
"type": "object", | ||
"description": "Custom options to be passed to the EsLint engine.", | ||
"additionalProperties": true | ||
} | ||
}, | ||
"required": ["files"] | ||
}, | ||
"FormatterOptions": { | ||
@@ -247,0 +205,0 @@ "oneOf": [ |
@@ -22,3 +22,3 @@ "use strict"; | ||
'Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.\n' + | ||
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript or EsLint.")); | ||
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript.")); | ||
} | ||
@@ -25,0 +25,0 @@ } |
import { IssueSeverity } from './IssueSeverity'; | ||
import { IssueLocation } from './IssueLocation'; | ||
interface Issue { | ||
origin: string; | ||
severity: IssueSeverity; | ||
@@ -6,0 +5,0 @@ code: string; |
@@ -8,3 +8,2 @@ "use strict"; | ||
typeof value === 'object' && | ||
!!value.origin && | ||
IssueSeverity_1.isIssueSeverity(value.severity) && | ||
@@ -29,3 +28,2 @@ !!value.code && | ||
return (IssueSeverity_1.compareIssueSeverities(issueA.severity, issueB.severity) || | ||
compareStrings(issueA.origin, issueB.origin) || | ||
compareStrings(issueA.file, issueB.file) || | ||
@@ -32,0 +30,0 @@ IssueLocation_1.compareIssueLocations(issueA.location, issueB.location) || |
import { Issue } from './index'; | ||
import { IssuePredicate } from './IssuePredicate'; | ||
declare type IssueMatch = Partial<Pick<Issue, 'origin' | 'severity' | 'code' | 'file'>>; | ||
declare type IssueMatch = Partial<Pick<Issue, 'severity' | 'code' | 'file'>>; | ||
declare function createIssuePredicateFromIssueMatch(context: string, match: IssueMatch): IssuePredicate; | ||
export { IssueMatch, createIssuePredicateFromIssueMatch }; |
@@ -11,3 +11,2 @@ "use strict"; | ||
return (issue) => { | ||
const matchesOrigin = !match.origin || match.origin === issue.origin; | ||
const matchesSeverity = !match.severity || match.severity === issue.severity; | ||
@@ -18,5 +17,5 @@ const matchesCode = !match.code || match.code === issue.code; | ||
(!match.file || minimatch_1.default(forwardSlash_1.default(path_1.default.relative(context, issue.file)), match.file))); | ||
return matchesOrigin && matchesSeverity && matchesCode && matchesFile; | ||
return matchesSeverity && matchesCode && matchesFile; | ||
}; | ||
} | ||
exports.createIssuePredicateFromIssueMatch = createIssuePredicateFromIssueMatch; |
@@ -33,3 +33,2 @@ "use strict"; | ||
return { | ||
origin: 'typescript', | ||
code: 'TS' + String(diagnostic.code), | ||
@@ -36,0 +35,0 @@ // we don't handle Suggestion and Message diagnostics |
{ | ||
"name": "fork-ts-checker-webpack-plugin", | ||
"version": "7.0.0-alpha.2", | ||
"version": "7.0.0-alpha.3", | ||
"description": "Runs typescript type checker and linter on separate process.", | ||
@@ -86,3 +86,2 @@ "keywords": [ | ||
"@types/cross-spawn": "^6.0.2", | ||
"@types/eslint": "^7.2.4", | ||
"@types/fs-extra": "^9.0.2", | ||
@@ -89,0 +88,0 @@ "@types/jest": "^26.0.14", |
@@ -17,3 +17,3 @@ <div align="center"> | ||
* Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking and [ESLint](https://eslint.org/) linting (by moving each to a separate process) ๐ | ||
* Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking (by moving it to a separate process) ๐ | ||
* Supports modern TypeScript features like [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) and [incremental mode](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag) โจ | ||
@@ -25,6 +25,7 @@ * Supports [Vue Single File Component](https://vuejs.org/v2/guide/single-file-components.html) โ | ||
This plugin requires minimum **Node.js 10**, **Webpack 4**, **TypeScript 2.7** and optionally **ESLint 6** | ||
This plugin requires minimum **Node.js 12**, **Webpack 5**, **TypeScript 3.6** | ||
* If you depend on **Webpack 2**, **Webpack 3**, or **TSLint 4**, please use [version 3](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v3.1.1) of the plugin. | ||
* If you depend on **TypeScript >= 2.1** and **< 2.7** or you can't update to **Node 10**, please use [version 4](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v4.1.4) of the plugin. | ||
* If you depend on **TypeScript 2.1 - 2.6.2**, please use [version 4](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v4.1.4) of the plugin. | ||
* If you depend on **Webpack 4**, **TypeScript 2.7 - 3.5.3** or **ESLint** feature, please use [version 6](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v6.2.6) of the plugin. | ||
```sh | ||
@@ -67,5 +68,4 @@ # with npm | ||
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader), | ||
> [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) are in the | ||
> [**examples**](./examples) directory. | ||
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader) | ||
> and [Visual Studio Code](https://code.visualstudio.com/) are in the [**examples**](./examples) directory. | ||
@@ -81,53 +81,2 @@ ## Modules resolution | ||
## ESLint | ||
If you'd like to use ESLint with the plugin, ensure you have the relevant dependencies installed: | ||
```sh | ||
# with npm | ||
npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin | ||
# with yarn | ||
yarn add --dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin | ||
``` | ||
Then set up ESLint in the plugin. This is the minimal configuration: | ||
```js | ||
// webpack.config.js | ||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
module.exports = { | ||
// ...the webpack configuration | ||
plugins: [ | ||
new ForkTsCheckerWebpackPlugin({ | ||
eslint: { | ||
files: './src/**/*.{ts,tsx,js,jsx}' // required - same as command `eslint ./src/**/*.{ts,tsx,js,jsx} --ext .ts,.tsx,.js,.jsx` | ||
} | ||
}) | ||
] | ||
}; | ||
``` | ||
You should also have an ESLint configuration file in your root project directory. | ||
Here is a sample `.eslintrc.js` configuration for a TypeScript project: | ||
```js | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
rules: { | ||
// place to specify ESLint rules - can be used to overwrite rules specified from the extended configs | ||
// e.g. "@typescript-eslint/explicit-function-return-type": "off", | ||
} | ||
}; | ||
``` | ||
There's a [good explanation on setting up TypeScript ESLint support by Robert Cooper](https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb). | ||
## Options | ||
@@ -147,3 +96,2 @@ | ||
| `typescript` | `object` or `boolean` | `true` | If a `boolean`, it enables/disables TypeScript checker. If an `object`, see [TypeScript options](#typescript-options). | | ||
| `eslint` | `object` | `undefined` | If `undefined`, it disables ESLint linter. If an `object`, see [ESLint options](#eslint-options). | | ||
| `issue` | `object` | `{}` | See [Issues options](#issues-options). | | ||
@@ -181,13 +129,2 @@ | `formatter` | `string` or `object` or `function` | `codeframe` | Available formatters are `basic`, `codeframe` and a custom `function`. To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter, pass object: `{ type: 'codeframe', options: { <coderame options> } }`. | | ||
### ESLint options | ||
Options for the ESLint linter (`eslint` option object). | ||
| Name | Type | Default value | Description | | ||
| -------------------- | ---------------------- | ------------------------- | ----------- | | ||
| `enabled` | `boolean` | `false` | If `true`, it enables ESLint linter. If you set the `files` option, it will be `true` by default. | | ||
| `files` | `string` or `string[]` | This value is required | One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)) to the files that should be linted. Works the same as the `eslint` command. | | ||
| `memoryLimit` | `number` | `2048` | Memory limit for the linter process in MB. If the process exits with the allocation failed error, try to increase this number. | | ||
| `options` | `object` | `{}` | [Options](https://eslint.org/docs/developer-guide/nodejs-api#cliengine) that can be used to initialize ESLint. | | ||
### Issues options | ||
@@ -200,3 +137,2 @@ | ||
interface Issue { | ||
origin: 'typescript' | 'eslint'; | ||
severity: 'error' | 'warning'; | ||
@@ -220,3 +156,3 @@ code: string; | ||
Include issues from the `src` directory, exclude eslint issues from `.spec.ts` files: | ||
Include issues from the `src` directory, exclude issues from `.spec.ts` files: | ||
@@ -233,3 +169,3 @@ ```js | ||
exclude: [ | ||
{ origin: 'eslint', file: '**/*.spec.ts' } | ||
{ file: '**/*.spec.ts' } | ||
] | ||
@@ -236,0 +172,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40
245587
210
4515
362