Skip to content

Commit f3850c5

Browse files
fix: types
1 parent 21e7c91 commit f3850c5

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ module.exports = {
44
rules: {
55
'global-require': 'off',
66
'import/no-dynamic-require': 'off',
7+
'import/no-namespace': 'off',
78
},
89
};

declarations/ESLintError.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
export default class ESLintError {
1+
export default class ESLintError extends WebpackError {
22
/**
33
* @param {string=} messages
44
*/
55
constructor(messages?: string | undefined);
6-
name: string;
7-
stack: string;
86
}
7+
import { WebpackError } from 'webpack';

src/ESLintError.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// @ts-ignore
2-
import WebpackError from 'webpack/lib/WebpackError';
1+
import { WebpackError } from 'webpack';
32

43
export default class ESLintError extends WebpackError {
54
/**

src/getESLint.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// @ts-ignore
2-
import os from 'os';
1+
import { cpus } from 'os';
32

43
import JestWorker from 'jest-worker';
54

@@ -97,7 +96,7 @@ export default function getESLint(key, { threads, ...options }) {
9796
const max =
9897
typeof threads !== 'number'
9998
? threads
100-
? os.cpus().length - 1
99+
? cpus().length - 1
101100
: 1
102101
: /* istanbul ignore next */
103102
threads;

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,10 @@ class ESLintWebpackPlugin {
121121
const { errors, warnings, generateReportAsset } = await report();
122122

123123
if (warnings) {
124-
// @ts-ignore
125124
compilation.warnings.push(warnings);
126125
}
127126

128127
if (errors) {
129-
// @ts-ignore
130128
compilation.errors.push(errors);
131129
}
132130

src/linter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export default function linter(key, options, compilation) {
112112
*/
113113
async function generateReportAsset({ compiler }) {
114114
const { outputReport } = options;
115-
// @ts-ignore
115+
/**
116+
* @param {string} name
117+
* @param {string | Buffer} content
118+
*/
116119
const save = (name, content) =>
117120
/** @type {Promise<void>} */ (new Promise((finish, bail) => {
118121
const { mkdir, writeFile } = compiler.outputFileSystem;
@@ -121,7 +124,6 @@ export default function linter(key, options, compilation) {
121124
mkdir(dirname(name), { recursive: true }, (err) => {
122125
/* istanbul ignore if */
123126
if (err) bail(err);
124-
// @ts-ignore
125127
else
126128
writeFile(name, content, (err2) => {
127129
/* istanbul ignore if */

src/options.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { validate } from 'schema-utils';
22

3-
// @ts-ignore
4-
import schema from './options.json';
3+
import * as schema from './options.json';
54

65
/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
76
/** @typedef {import('eslint').ESLint.LintResult} LintResult */
@@ -78,6 +77,5 @@ export function getESLintOptions(loaderOptions) {
7877
delete eslintOptions[option];
7978
}
8079

81-
// @ts-ignore
8280
return eslintOptions;
8381
}

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { statSync } from 'fs';
22

33
// @ts-ignore
4-
import arrify from 'arrify';
4+
import * as arrify from 'arrify';
55

66
const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
77

0 commit comments

Comments
 (0)