Socket
Socket
Sign inDemoInstall

fork-ts-checker-webpack-plugin

Package Overview
Dependencies
196
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.3.6 to 6.4.0

76

lib/eslint-reporter/reporter/EsLintReporter.js

@@ -16,18 +16,24 @@ "use strict";

const EsLintIssueFactory_1 = require("../issue/EsLintIssueFactory");
const path_1 = require("path");
const path_1 = __importDefault(require("path"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const minimatch_1 = __importDefault(require("minimatch"));
const glob_1 = __importDefault(require("glob"));
const isOldCLIEngine = (eslint) => eslint.resolveFileGlobPatterns !== undefined;
function createEsLintReporter(configuration) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { CLIEngine } = require('eslint');
const engine = new CLIEngine(configuration.options);
const { CLIEngine, ESLint } = require('eslint');
const eslint = ESLint
? new ESLint(configuration.options)
: new CLIEngine(configuration.options);
let isInitialRun = true;
let isInitialGetFiles = true;
const lintResults = new Map();
const includedGlobPatterns = engine.resolveFileGlobPatterns(configuration.files);
const includedGlobPatterns = resolveFileGlobPatterns(configuration.files);
const includedFiles = new Set();
function isFileIncluded(path) {
return (!path.includes('node_modules') &&
includedGlobPatterns.some((pattern) => minimatch_1.default(path, pattern)) &&
!engine.isPathIgnored(path));
return __awaiter(this, void 0, void 0, function* () {
return (!path.includes('node_modules') &&
includedGlobPatterns.some((pattern) => minimatch_1.default(path, pattern)) &&
!(yield eslint.isPathIgnored(path)));
});
}

@@ -51,3 +57,3 @@ function getFiles() {

for (const resolvedFile of resolvedGlob) {
if (isFileIncluded(resolvedFile)) {
if (yield isFileIncluded(resolvedFile)) {
includedFiles.add(resolvedFile);

@@ -67,2 +73,29 @@ }

}
// Copied from the eslint 6 implementation, as it's not available in eslint 8
function resolveFileGlobPatterns(globPatterns) {
if (configuration.options.globInputPaths === false) {
return globPatterns.filter(Boolean);
}
const extensions = getExtensions().map((ext) => ext.replace(/^\./u, ''));
const dirSuffix = `/**/*.{${extensions.join(',')}}`;
return globPatterns.filter(Boolean).map((globPattern) => {
const resolvedPath = path_1.default.resolve(configuration.options.cwd || '', globPattern);
const newPath = directoryExists(resolvedPath)
? globPattern.replace(/[/\\]$/u, '') + dirSuffix
: globPattern;
return path_1.default.normalize(newPath).replace(/\\/gu, '/');
});
}
// Copied from the eslint 6 implementation, as it's not available in eslint 8
function directoryExists(resolvedPath) {
try {
return fs_extra_1.default.statSync(resolvedPath).isDirectory();
}
catch (error) {
if (error && error.code === 'ENOENT') {
return false;
}
throw error;
}
}
return {

@@ -74,3 +107,3 @@ getReport: ({ changedFiles = [], deletedFiles = [] }) => __awaiter(this, void 0, void 0, function* () {

for (const changedFile of changedFiles) {
if (isFileIncluded(changedFile)) {
if (yield isFileIncluded(changedFile)) {
includedFiles.add(changedFile);

@@ -83,4 +116,4 @@ }

return {
files: (yield getFiles()).map((file) => path_1.normalize(file)),
dirs: getDirs().map((dir) => path_1.normalize(dir)),
files: (yield getFiles()).map((file) => path_1.default.normalize(file)),
dirs: getDirs().map((dir) => path_1.default.normalize(dir)),
excluded: [],

@@ -103,3 +136,6 @@ extensions: getExtensions(),

if (isInitialRun) {
lintReports.push(engine.executeOnFiles(includedGlobPatterns));
const lintReport = yield (isOldCLIEngine(eslint)
? Promise.resolve(eslint.executeOnFiles(includedGlobPatterns))
: eslint.lintFiles(includedGlobPatterns).then((results) => ({ results })));
lintReports.push(lintReport);
isInitialRun = false;

@@ -110,5 +146,13 @@ }

// the eslint engine will not exclude them automatically
const changedAndIncludedFiles = changedFiles.filter((changedFile) => isFileIncluded(changedFile));
const changedAndIncludedFiles = [];
for (const changedFile of changedFiles) {
if (yield isFileIncluded(changedFile)) {
changedAndIncludedFiles.push(changedFile);
}
}
if (changedAndIncludedFiles.length) {
lintReports.push(engine.executeOnFiles(changedAndIncludedFiles));
const lintReport = yield (isOldCLIEngine(eslint)
? Promise.resolve(eslint.executeOnFiles(changedAndIncludedFiles))
: eslint.lintFiles(changedAndIncludedFiles).then((results) => ({ results })));
lintReports.push(lintReport);
}

@@ -118,3 +162,5 @@ }

if (configuration.options.fix) {
yield Promise.all(lintReports.map((lintReport) => CLIEngine.outputFixes(lintReport)));
yield Promise.all(lintReports.map((lintReport) => isOldCLIEngine(eslint)
? CLIEngine.outputFixes(lintReport)
: ESLint.outputFixes(lintReport.results)));
}

@@ -121,0 +167,0 @@ // store results

@@ -26,2 +26,8 @@ export interface LintMessage {

}
export interface ESLint {
version: string;
lintFiles(filesPatterns: string[]): Promise<LintResult[]>;
isPathIgnored(filePath: string): Promise<boolean>;
}
export declare type ESLintOrCLIEngine = CLIEngine | ESLint;
export interface CLIEngineOptions {

@@ -28,0 +34,0 @@ cwd?: string;

2

lib/ForkTsCheckerWebpackPlugin.js

@@ -79,3 +79,3 @@ "use strict";

*/
ForkTsCheckerWebpackPlugin.version = '6.3.6'; // will be replaced by the @semantic-release/exec
ForkTsCheckerWebpackPlugin.version = '6.4.0'; // will be replaced by the @semantic-release/exec
/**

@@ -82,0 +82,0 @@ * Default pools for the plugin concurrency limit

{
"name": "fork-ts-checker-webpack-plugin",
"version": "6.3.6",
"version": "6.4.0",
"description": "Runs typescript type checker and linter on separate process.",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc