Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: types #66

Merged
merged 5 commits into from Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion declarations/cjs.d.ts
@@ -1,2 +1,2 @@
declare const _exports: typeof import('.').ESLintWebpackPlugin;
declare const _exports: typeof import('.').default;
export = _exports;
10 changes: 5 additions & 5 deletions declarations/index.d.ts
@@ -1,4 +1,8 @@
export class ESLintWebpackPlugin {
export default ESLintWebpackPlugin;
export type Compiler = import('webpack').Compiler;
export type Options = import('./options').PluginOptions &
import('eslint').ESLint.Options;
declare class ESLintWebpackPlugin {
/**
* @param {Options} options
*/
Expand All @@ -20,7 +24,3 @@ export class ESLintWebpackPlugin {
*/
getContext(compiler: Compiler): string;
}
export default ESLintWebpackPlugin;
export type Compiler = import('webpack').Compiler;
export type Options = import('./options').PluginOptions &
import('eslint').ESLint.Options;
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -12,7 +12,7 @@ import { parseFiles, parseFoldersToGlobs } from './utils';

const ESLINT_PLUGIN = 'ESLintWebpackPlugin';

export class ESLintWebpackPlugin {
class ESLintWebpackPlugin {
/**
* @param {Options} options
*/
Expand Down
4 changes: 2 additions & 2 deletions src/linter.js
Expand Up @@ -113,7 +113,7 @@ export default function linter(options, compilation) {
const { outputReport } = options;
// @ts-ignore
const save = (name, content) =>
new Promise((finish, bail) => {
/** @type {Promise<void>} */ (new Promise((finish, bail) => {
const { mkdir, writeFile } = compiler.outputFileSystem;
// ensure directory exists
// @ts-ignore - the types for `outputFileSystem` are missing the 3 arg overload
Expand All @@ -128,7 +128,7 @@ export default function linter(options, compilation) {
else finish();
});
});
});
}));

if (!outputReport || !outputReport.filePath) {
return;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -6,7 +6,7 @@
"checkJs": true,
"strict": true,
"types": ["node"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
},
"include": ["./src/**/*"]
Expand Down