Skip to content

Commit 594d84c

Browse files
refactor!: webpack v4 and nodejs v10 dropped (#105)
* refactor!: webpack v4 and nodejs v10 dropped * style: empty line * ci: update * chore: peerDependencies webpack 5.0.0
1 parent 7e96c87 commit 594d84c

20 files changed

+9157
-11033
lines changed

.github/workflows/nodejs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 0
3131

3232
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v1
33+
uses: actions/setup-node@v2
3434
with:
3535
node-version: ${{ matrix.node-version }}
3636

@@ -55,8 +55,8 @@ jobs:
5555
strategy:
5656
matrix:
5757
os: [ubuntu-latest, windows-latest, macos-latest]
58-
node-version: [10.x, 12.x, 14.x]
59-
webpack-version: [4, latest]
58+
node-version: [12.x, 14.x, 16.x]
59+
webpack-version: [latest]
6060

6161
runs-on: ${{ matrix.os }}
6262

@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/checkout@v2
6969

7070
- name: Use Node.js ${{ matrix.node-version }}
71-
uses: actions/setup-node@v1
71+
uses: actions/setup-node@v2
7272
with:
7373
node-version: ${{ matrix.node-version }}
7474

README.md

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,11 @@
1313

1414
# eslint-webpack-plugin
1515

16-
> A ESLint plugin for webpack
16+
This plugin uses [`eslint`](https://eslint.org/) to find and fix problems in your JavaScript code
1717

18-
## About plugin
18+
## Getting Started
1919

20-
The plugin was born with the purpose of solving some problems of the [eslint-loader](https://github.com/webpack-contrib/eslint-loader).
21-
22-
| | eslint-webpack-plugin | eslint-loader |
23-
| -------------------------------- | :-------------------: | :----------------------: |
24-
| Easy configuration | :heavy_check_mark: | :heavy_multiplication_x: |
25-
| Generate unique an output report | :heavy_check_mark: | :heavy_multiplication_x: |
26-
| Using cache directly from eslint | :heavy_check_mark: | :heavy_multiplication_x: |
27-
| Lint only changed files | :heavy_check_mark: | :heavy_multiplication_x: |
28-
29-
## Migrate from `eslint-loader`
30-
31-
The loader `eslint-loader` will be deprecated soon, please use this plugin instead.
32-
33-
Before:
34-
35-
```js
36-
module.exports = {
37-
// ...
38-
module: {
39-
rules: [
40-
{
41-
test: /\.js$/,
42-
exclude: /node_modules/,
43-
loader: 'eslint-loader',
44-
options: {
45-
// eslint options (if necessary)
46-
},
47-
},
48-
],
49-
},
50-
// ...
51-
};
52-
```
53-
54-
After:
55-
56-
```js
57-
const ESLintPlugin = require('eslint-webpack-plugin');
58-
59-
module.exports = {
60-
// ...
61-
plugins: [new ESLintPlugin(options)],
62-
// ...
63-
};
64-
```
65-
66-
## Install
20+
To begin, you'll need to install `eslint-webpack-plugin`:
6721

6822
```bash
6923
npm install eslint-webpack-plugin --save-dev
@@ -75,9 +29,7 @@ npm install eslint-webpack-plugin --save-dev
7529
npm install eslint --save-dev
7630
```
7731

78-
## Usage
79-
80-
In your webpack configuration:
32+
Then add the plugin to your webpack config. For example:
8133

8234
```js
8335
const ESLintPlugin = require('eslint-webpack-plugin');

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = (api) => {
1010
'@babel/preset-env',
1111
{
1212
targets: {
13-
node: '10.13.0',
13+
node: '12.13.0',
1414
},
1515
},
1616
],

declarations/ESLintError.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
export default ESLintError;
2-
declare class ESLintError extends Error {
3-
/**
4-
* @param {string=} messages
5-
*/
6-
constructor(messages?: string | undefined);
7-
}
2+
declare class ESLintError extends Error {}

declarations/cjs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
declare const _exports: typeof plugin.default;
22
export = _exports;
3-
import plugin = require('.');
3+
import plugin = require('./');

declarations/getESLint.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export default function getESLint(
3232
): Linter;
3333
export type ESLint = import('eslint').ESLint;
3434
export type LintResult = import('eslint').ESLint.LintResult;
35-
export type Options = import('./options').PluginOptions &
36-
import('eslint').ESLint.Options;
35+
export type Options = import('./options').Options;
3736
export type AsyncTask = () => Promise<void>;
3837
export type LintTask = (files: string | string[]) => Promise<LintResult[]>;
3938
export type Worker = JestWorker & {
@@ -46,4 +45,4 @@ export type Linter = {
4645
lintFiles: LintTask;
4746
cleanup: AsyncTask;
4847
};
49-
import JestWorker from 'jest-worker';
48+
import { Worker as JestWorker } from 'jest-worker';

declarations/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export default ESLintWebpackPlugin;
22
export type Compiler = import('webpack').Compiler;
3-
export type Options = import('./options').PluginOptions &
4-
import('eslint').ESLint.Options;
3+
export type Options = import('./options').Options;
54
declare class ESLintWebpackPlugin {
65
/**
76
* @param {Options} options

declarations/linter.d.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ export type Formatter = import('eslint').ESLint.Formatter;
1818
export type LintResult = import('eslint').ESLint.LintResult;
1919
export type Compiler = import('webpack').Compiler;
2020
export type Compilation = import('webpack').Compilation;
21-
export type Source = import('webpack-sources/lib/Source');
22-
export type Options = import('./options').PluginOptions &
23-
import('eslint').ESLint.Options;
24-
export type FormatterFunction = (
25-
results: import('eslint').ESLint.LintResult[],
26-
data?: import('eslint').ESLint.LintResultData | undefined
27-
) => string;
21+
export type Options = import('./options').Options;
22+
export type FormatterFunction = import('./options').FormatterFunction;
2823
export type GenerateReport = (compilation: Compilation) => Promise<void>;
2924
export type Report = {
30-
errors?: ESLintError | undefined;
31-
warnings?: ESLintError | undefined;
32-
generateReportAsset?: GenerateReport | undefined;
25+
errors?: ESLintError;
26+
warnings?: ESLintError;
27+
generateReportAsset?: GenerateReport;
3328
};
3429
export type Reporter = () => Promise<Report>;
3530
export type Linter = (files: string | string[]) => void;

declarations/options.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ export type PluginOptions = {
6969
outputReport?: OutputReport | undefined;
7070
threads?: (number | boolean) | undefined;
7171
};
72-
export type Options = PluginOptions & import('eslint').ESLint.Options;
72+
export type Options = PluginOptions & ESLintOptions;

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
collectCoverage: true,
3+
testEnvironment: 'node',
4+
testTimeout: 60000,
5+
transformIgnorePatterns: ['node_modules/(?!(arrify)/)'],
6+
};

0 commit comments

Comments
 (0)