Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit "$1"
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"jestCommandLine": "yarn jest --config=test/unit/jest.config.js",
"runMode": "on-demand"
}
]
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTypescriptForTsServer": true
}
Binary file modified .yarn/install-state.gz
Binary file not shown.
95 changes: 95 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const {
defineConfig,
} = require("eslint/config");

const tsParser = require("@typescript-eslint/parser");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const _import = require("eslint-plugin-import");
const prettier = require("eslint-plugin-prettier");

const {
fixupPluginRules,
} = require("@eslint/compat");

const js = require("@eslint/js");

const {
FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

module.exports = defineConfig([{
languageOptions: {
parser: tsParser,
},

plugins: {
"@typescript-eslint": typescriptEslint,
import: fixupPluginRules(_import),
prettier,
},

extends: compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
),

settings: {
node: {
tryExtensions: [".js", ".json", ".ts", ".d.ts"],
},

"import/extensions": [".js", ".json", ".ts", ".d.ts"],
"import/external-module-folders": ["node_modules", "node_modules/@types"],

"import/parsers": {
"@typescript-eslint/parser": [".ts"],
},

"import/resolver": {
node: {
extensions: [".js", ".json", ".ts", ".d.ts"],
},
},
},

rules: {
"@typescript-eslint/consistent-type-imports": ["error", {
prefer: "type-imports",
}],

"import/order": ["error", {
groups: ["builtin", "external", "internal", "parent", "sibling", "index", "object"],
"newlines-between": "always",

alphabetize: {
order: "asc",
caseInsensitive: true,
},
}],

"import/no-cycle": ["error"],
"prettier/prettier": "error",
},
}, {
files: ["**/*.ts"],

rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-use-before-define": "off",
},
}, {
files: ["**/*.spec.ts"],

rules: {
"@typescript-eslint/no-var-requires": "off",
},
}, {
ignores: ["lib/**/*", "test/e2e/fixtures/**/*"],
}]);
79 changes: 40 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"precommit": "cross-env lint-staged && yarn build && yarn test:unit",
"commit": "cross-env git-cz",
"semantic-release": "semantic-release",
"prepare": "husky install"
"prepare": "husky"
},
"commitlint": {
"extends": [
Expand All @@ -55,64 +55,65 @@
}
},
"dependencies": {
"@babel/code-frame": "^7.16.7",
"chalk": "^4.1.2",
"chokidar": "^4.0.1",
"cosmiconfig": "^8.2.0",
"deepmerge": "^4.2.2",
"fs-extra": "^10.0.0",
"memfs": "^3.4.1",
"minimatch": "^3.0.4",
"node-abort-controller": "^3.0.1",
"schema-utils": "^3.1.1",
"semver": "^7.3.5",
"tapable": "^2.2.1"
"@babel/code-frame": "^7.29.0",
"chalk": "^5.6.2",
"chokidar": "^5.0.0",
"cosmiconfig": "^9.0.0",
"deepmerge": "^4.3.1",
"fs-extra": "^11.3.3",
"memfs": "^4.56.10",
"minimatch": "^10.2.2",
"node-abort-controller": "^3.1.1",
"schema-utils": "^4.3.3",
"semver": "^7.7.4",
"tapable": "^2.3.0"
},
"peerDependencies": {
"typescript": ">3.6.0",
"webpack": "^5.11.0"
"webpack": "^5.105.2"
},
"devDependencies": {
"@commitlint/config-conventional": "^16.0.0",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/github": "^7.2.3",
"@semantic-release/npm": "^7.1.3",
"@semantic-release/release-notes-generator": "^9.0.3",
"@eslint/compat": "^2.0.2",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^10.0.1",
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/exec": "^7.1.0",
"@semantic-release/github": "^12.0.6",
"@semantic-release/npm": "^13.1.4",
"@semantic-release/release-notes-generator": "^14.1.0",
"@types/babel__code-frame": "^7.0.3",
"@types/cross-spawn": "^6.0.2",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.0",
"@types/json-schema": "^7.0.9",
"@types/minimatch": "^3.0.5",
"@types/mock-fs": "^4.13.1",
"@types/node": "^16.4.13",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"commitlint": "^16.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.8.0",
"eslint-plugin-import": "^2.25.4",
"@typescript-eslint/eslint-plugin": "^8.56.0",
"@typescript-eslint/parser": "^8.56.0",
"commitlint": "^20.4.2",
"cross-env": "^10.1.0",
"eslint": "^10.0.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"git-cz": "^4.8.0",
"husky": "^7.0.4",
"jest": "^27.4.7",
"jest-circus": "^27.4.6",
"jest-environment-node": "^27.4.6",
"eslint-plugin-prettier": "^5.5.5",
"git-cz": "^4.9.0",
"husky": "^9.1.7",
"jest": "^29.6.1",
"jest-circus": "^29.6.1",
"jest-environment-node": "^29.6.1",
"json-schema": "^0.4.0",
"karton": "^0.4.1",
"lint-staged": "^11.1.2",
"mock-fs": "^5.1.2",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"semantic-release": "^17.4.4",
"prettier": "^3.8.1",
"rimraf": "^6.1.3",
"semantic-release": "^25.0.3",
"strip-ansi": "^6.0.0",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5",
"webpack": "^5.67.0"
"ts-jest": "^29.0.0",
"typescript": "^5.1.6",
"webpack": "^5.105.2"
},
"engines": {
"node": ">=14.21.3"
Expand Down
2 changes: 1 addition & 1 deletion src/files-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const IGNORED_FILES = ['package.json'];

const isIgnoredFile = (file: string) =>
IGNORED_FILES.some(
(ignoredFile) => file.endsWith(`/${ignoredFile}`) || file.endsWith(`\\${ignoredFile}`)
(ignoredFile) => file.endsWith(`/${ignoredFile}`) || file.endsWith(`\\${ignoredFile}`),
);

const compilerFilesChangeMap = new WeakMap<webpack.Compiler, FilesChange>();
Expand Down
2 changes: 1 addition & 1 deletion src/formatter/formatter-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function createFormatterConfig(options: FormatterOptions | undefined): Formatter
}

throw new Error(
`Unknown "${type}" formatter. Available types are: "basic", "codeframe" or a custom function.`
`Unknown "${type}" formatter. Available types are: "basic", "codeframe" or a custom function.`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/formatter/webpack-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createWebpackFormatter(formatter: Formatter, pathType: FormatterPathTyp
let location = chalk.bold(
pathType === 'absolute'
? forwardSlash(path.resolve(issue.file))
: relativeToContext(issue.file, process.cwd())
: relativeToContext(issue.file, process.cwd()),
);
if (issue.location) {
location += `:${chalk.green.bold(formatIssueLocation(issue.location))}`;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/intercept-done-to-get-dev-server-tap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
function interceptDoneToGetDevServerTap(
compiler: webpack.Compiler,
config: ForkTsCheckerWebpackPluginConfig,
state: ForkTsCheckerWebpackPluginState
state: ForkTsCheckerWebpackPluginState,
) {
const { debug } = getInfrastructureLogger(compiler);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-after-compile-to-add-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
function tapAfterCompileToAddDependencies(
compiler: webpack.Compiler,
config: ForkTsCheckerWebpackPluginConfig,
state: ForkTsCheckerWebpackPluginState
state: ForkTsCheckerWebpackPluginState,
) {
const { debug } = getInfrastructureLogger(compiler);

Expand Down
8 changes: 4 additions & 4 deletions src/hooks/tap-after-compile-to-get-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
function tapAfterCompileToGetIssues(
compiler: webpack.Compiler,
config: ForkTsCheckerWebpackPluginConfig,
state: ForkTsCheckerWebpackPluginState
state: ForkTsCheckerWebpackPluginState,
) {
const hooks = getPluginHooks(compiler);
const { debug } = getInfrastructureLogger(compiler);
Expand All @@ -21,7 +21,7 @@ function tapAfterCompileToGetIssues(
return;
}

let issues: Issue[] | undefined = [];
let issues: Issue[] | undefined;

try {
issues = await state.issuesPromise;
Expand All @@ -41,13 +41,13 @@ function tapAfterCompileToGetIssues(
issues = issues.filter(config.issue.predicate);

// modify list of issues in the plugin hooks
issues = hooks.issues.call(issues, compilation);
hooks.issues.call(issues, compilation);

issues.forEach((issue) => {
const error = new IssueWebpackError(
config.formatter.format(issue),
config.formatter.pathType,
issue
issue,
);

if (issue.severity === 'warning') {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/tap-after-environment-to-patch-watching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { WatchFileSystem } from '../watch/watch-file-system';

function tapAfterEnvironmentToPatchWatching(
compiler: webpack.Compiler,
state: ForkTsCheckerWebpackPluginState
state: ForkTsCheckerWebpackPluginState,
) {
const { debug } = getInfrastructureLogger(compiler);

Expand All @@ -20,7 +20,7 @@ function tapAfterEnvironmentToPatchWatching(
// we use some internals here
watchFileSystem as WatchFileSystem,
compiler,
state
state,
);
} else {
debug('No watch file system found - plugin may not work correctly.');
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/tap-done-to-async-get-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { wait } from '../utils/async/wait';
function tapDoneToAsyncGetIssues(
compiler: webpack.Compiler,
config: ForkTsCheckerWebpackPluginConfig,
state: ForkTsCheckerWebpackPluginState
state: ForkTsCheckerWebpackPluginState,
) {
const hooks = getPluginHooks(compiler);
const { debug } = getInfrastructureLogger(compiler);
Expand Down Expand Up @@ -57,7 +57,7 @@ function tapDoneToAsyncGetIssues(
issues = issues.filter(config.issue.predicate);

// modify list of issues in the plugin hooks
issues = hooks.issues.call(issues, stats.compilation);
hooks.issues.call(issues, stats.compilation);

const formatter = createWebpackFormatter(config.formatter.format, config.formatter.pathType);

Expand All @@ -78,7 +78,7 @@ function tapDoneToAsyncGetIssues(
const error = new IssueWebpackError(
config.formatter.format(issue),
config.formatter.pathType,
issue
issue,
);

if (issue.severity === 'warning') {
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/tap-error-to-log-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AbortError } from '../utils/async/abort-error';

function tapErrorToLogMessage(
compiler: webpack.Compiler,
config: ForkTsCheckerWebpackPluginConfig
config: ForkTsCheckerWebpackPluginConfig,
) {
const hooks = getPluginHooks(compiler);

Expand All @@ -25,16 +25,16 @@ function tapErrorToLogMessage(
chalk.red(
'Issues checking service interrupted - If running in a docker container, this may be caused ' +
"by the container running out of memory. If so, try increasing the container's memory limit " +
'or lowering the `memoryLimit` value in the ForkTsCheckerWebpackPlugin configuration.'
)
'or lowering the `memoryLimit` value in the ForkTsCheckerWebpackPlugin configuration.',
),
);
} else {
config.logger.error(
chalk.red(
'Issues checking service aborted - probably out of memory. ' +
'Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.\n' +
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."
)
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript.",
),
);
}
}
Expand Down
Loading