Skip to content

Commit 98e4f39

Browse files
authored
feat: remove eslint support (#607)
BREAKING CHANGE: 🧨 ESLint no longer supported by the plugin
1 parent 438a139 commit 98e4f39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+58
-28059
lines changed

README.md

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414

1515
## Features
1616

17-
* Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking and [ESLint](https://eslint.org/) linting (by moving each to a separate process) 🏎
17+
* Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking (by moving it to a separate process) 🏎
1818
* 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)
1919
* Supports [Vue Single File Component](https://vuejs.org/v2/guide/single-file-components.html) ✅ 
2020
* Displays nice error messages with the [code frame](https://babeljs.io/docs/en/next/babel-code-frame.html) formatter 🌈
2121

2222
## Installation
2323

24-
This plugin requires minimum **Node.js 10**, **Webpack 4**, **TypeScript 2.7** and optionally **ESLint 6**
24+
This plugin requires minimum **Node.js 12**, **Webpack 5**, **TypeScript 3.6**
25+
26+
* 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.
27+
* 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.
2528

26-
* 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.
27-
* 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.
2829
```sh
2930
# with npm
3031
npm install --save-dev fork-ts-checker-webpack-plugin
@@ -62,9 +63,8 @@ module.exports = {
6263
};
6364
```
6465

65-
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader),
66-
> [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) are in the
67-
> [**examples**](./examples) directory.
66+
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader)
67+
> and [Visual Studio Code](https://code.visualstudio.com/) are in the [**examples**](./examples) directory.
6868
6969
## Modules resolution
7070

@@ -75,57 +75,6 @@ It's very important to be aware that **this plugin uses [TypeScript](https://git
7575
>
7676
> To debug TypeScript's modules resolution, you can use `tsc --traceResolution` command.
7777
78-
## ESLint
79-
80-
If you'd like to use ESLint with the plugin, ensure you have the relevant dependencies installed:
81-
82-
```sh
83-
# with npm
84-
npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
85-
86-
# with yarn
87-
yarn add --dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
88-
```
89-
90-
Then set up ESLint in the plugin. This is the minimal configuration:
91-
```js
92-
// webpack.config.js
93-
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
94-
95-
module.exports = {
96-
// ...the webpack configuration
97-
plugins: [
98-
new ForkTsCheckerWebpackPlugin({
99-
eslint: {
100-
files: './src/**/*.{ts,tsx,js,jsx}' // required - same as command `eslint ./src/**/*.{ts,tsx,js,jsx} --ext .ts,.tsx,.js,.jsx`
101-
}
102-
})
103-
]
104-
};
105-
```
106-
107-
You should also have an ESLint configuration file in your root project directory.
108-
Here is a sample `.eslintrc.js` configuration for a TypeScript project:
109-
110-
```js
111-
module.exports = {
112-
parser: '@typescript-eslint/parser',
113-
parserOptions: {
114-
ecmaVersion: 2018,
115-
sourceType: 'module',
116-
},
117-
extends: [
118-
'plugin:@typescript-eslint/recommended'
119-
],
120-
rules: {
121-
// place to specify ESLint rules - can be used to overwrite rules specified from the extended configs
122-
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
123-
}
124-
};
125-
```
126-
127-
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).
128-
12978
## Options
13079

13180
This plugin uses [`cosmiconfig`](https://github.com/davidtheclark/cosmiconfig). This means that besides the plugin constructor,
@@ -140,7 +89,6 @@ Options passed to the plugin constructor will overwrite options from the cosmico
14089
| ----------------- | ---------------------------------- | ------------------------------------------------------------------ | ----------- |
14190
| `async` | `boolean` | `compiler.options.mode === 'development'` | If `true`, reports issues **after** webpack's compilation is done. Thanks to that it doesn't block the compilation. Used only in the `watch` mode. |
14291
| `typescript` | `object` or `boolean` | `true` | If a `boolean`, it enables/disables TypeScript checker. If an `object`, see [TypeScript options](#typescript-options). |
143-
| `eslint` | `object` | `undefined` | If `undefined`, it disables ESLint linter. If an `object`, see [ESLint options](#eslint-options). |
14492
| `issue` | `object` | `{}` | See [Issues options](#issues-options). |
14593
| `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> } }`. |
14694
| `logger` | `object` | `{ infrastructure: 'silent', issues: 'console', devServer: true }` | Available loggers are `silent`, `console`, and `webpack-infrastructure`. Infrastructure logger prints additional information, issue logger prints `issues` in the `async` mode. If `devServer` is set to `false`, errors will not be reported to Webpack Dev Server. |
@@ -173,25 +121,13 @@ Options for the TypeScript checker extensions (`typescript.extensions` option ob
173121
| `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
174122
| `vue.compiler` | `string` | `'vue-template-compiler'` | The package name of the compiler that will be used to parse `.vue` files. You can use `'nativescript-vue-template-compiler'` if you use [nativescript-vue](https://github.com/nativescript-vue/nativescript-vue) |
175123

176-
### ESLint options
177-
178-
Options for the ESLint linter (`eslint` option object).
179-
180-
| Name | Type | Default value | Description |
181-
| -------------------- | ---------------------- | ------------------------- | ----------- |
182-
| `enabled` | `boolean` | `false` | If `true`, it enables ESLint linter. If you set the `files` option, it will be `true` by default. |
183-
| `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. |
184-
| `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. |
185-
| `options` | `object` | `{}` | [Options](https://eslint.org/docs/developer-guide/nodejs-api#cliengine) that can be used to initialize ESLint. |
186-
187124
### Issues options
188125

189126
Options for the issues filtering (`issue` option object).
190127
I could write some plain text explanation of these options but I think code will explain it better:
191128

192129
```typescript
193130
interface Issue {
194-
origin: 'typescript' | 'eslint';
195131
severity: 'error' | 'warning';
196132
code: string;
197133
file?: string;
@@ -210,7 +146,7 @@ type IssueFilter = IssueMatch | IssuePredicate | (IssueMatch | IssuePredicate)[]
210146
<details>
211147
<summary>Expand example</summary>
212148

213-
Include issues from the `src` directory, exclude eslint issues from `.spec.ts` files:
149+
Include issues from the `src` directory, exclude issues from `.spec.ts` files:
214150

215151
```js
216152
module.exports = {
@@ -222,7 +158,7 @@ module.exports = {
222158
{ file: '**/src/**/*' }
223159
],
224160
exclude: [
225-
{ origin: 'eslint', file: '**/*.spec.ts' }
161+
{ file: '**/*.spec.ts' }
226162
]
227163
}
228164
})

examples/eslint/.eslintrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/eslint/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/eslint/package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/eslint/src/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/eslint/tsconfig.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/eslint/webpack.config.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"@semantic-release/release-notes-generator": "^9.0.1",
8484
"@types/babel__code-frame": "^7.0.2",
8585
"@types/cross-spawn": "^6.0.2",
86-
"@types/eslint": "^7.2.4",
8786
"@types/fs-extra": "^9.0.2",
8887
"@types/jest": "^26.0.14",
8988
"@types/minimatch": "^3.0.1",

src/ForkTsCheckerWebpackPlugin.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { createForkTsCheckerWebpackPluginState } from './ForkTsCheckerWebpackPlu
1212
import { composeReporterRpcClients, createAggregatedReporter, ReporterRpcClient } from './reporter';
1313
import { assertTypeScriptSupport } from './typescript-reporter/TypeScriptSupport';
1414
import { createTypeScriptReporterRpcClient } from './typescript-reporter/reporter/TypeScriptReporterRpcClient';
15-
import { assertEsLintSupport } from './eslint-reporter/assertEsLintSupport';
16-
import { createEsLintReporterRpcClient } from './eslint-reporter/reporter/EsLintReporterRpcClient';
1715
import { tapStartToConnectAndRunReporter } from './hooks/tapStartToConnectAndRunReporter';
1816
import { tapStopToDisconnectReporter } from './hooks/tapStopToDisconnectReporter';
1917
import { tapAfterCompileToAddDependencies } from './hooks/tapAfterCompileToAddDependencies';
@@ -63,11 +61,6 @@ class ForkTsCheckerWebpackPlugin implements webpack.Plugin {
6361
reporters.push(createTypeScriptReporterRpcClient(configuration.typescript));
6462
}
6563

66-
if (configuration.eslint.enabled) {
67-
assertEsLintSupport(configuration.eslint);
68-
reporters.push(createEsLintReporterRpcClient(configuration.eslint));
69-
}
70-
7164
if (reporters.length) {
7265
const reporter = createAggregatedReporter(composeReporterRpcClients(reporters));
7366

src/ForkTsCheckerWebpackPluginConfiguration.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ import {
66
createTypeScriptReporterConfiguration,
77
TypeScriptReporterConfiguration,
88
} from './typescript-reporter/TypeScriptReporterConfiguration';
9-
import {
10-
createEsLintReporterConfiguration,
11-
EsLintReporterConfiguration,
12-
} from './eslint-reporter/EsLintReporterConfiguration';
139
import { createLoggerConfiguration, LoggerConfiguration } from './logger/LoggerConfiguration';
1410

1511
interface ForkTsCheckerWebpackPluginConfiguration {
1612
async: boolean;
1713
typescript: TypeScriptReporterConfiguration;
18-
eslint: EsLintReporterConfiguration;
1914
issue: IssueConfiguration;
2015
formatter: FormatterConfiguration;
2116
logger: LoggerConfiguration;
@@ -28,7 +23,6 @@ function createForkTsCheckerWebpackPluginConfiguration(
2823
return {
2924
async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
3025
typescript: createTypeScriptReporterConfiguration(compiler, options.typescript),
31-
eslint: createEsLintReporterConfiguration(compiler, options.eslint),
3226
issue: createIssueConfiguration(compiler, options.issue),
3327
formatter: createFormatterConfiguration(options.formatter),
3428
logger: createLoggerConfiguration(compiler, options.logger),

0 commit comments

Comments
 (0)