@codacy/tools-eslint-9 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -35
- package/dist/metadata.d.ts +13 -0
- package/dist/metadata.js +39 -0
- package/package.json +13 -3
package/dist/index.js
CHANGED
|
@@ -33,9 +33,10 @@ __export(index_exports, {
|
|
|
33
33
|
default: () => index_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_tooling2 = require("@codacy/tooling");
|
|
37
37
|
|
|
38
38
|
// src/adapter.ts
|
|
39
|
+
var import_tooling = require("@codacy/tooling");
|
|
39
40
|
var import_path = __toESM(require("path"));
|
|
40
41
|
var import_fs = __toESM(require("fs"));
|
|
41
42
|
|
|
@@ -25870,6 +25871,18 @@ async function loadTsParser() {
|
|
|
25870
25871
|
return mod.default?.parser ?? mod.parser;
|
|
25871
25872
|
}
|
|
25872
25873
|
|
|
25874
|
+
// src/metadata.ts
|
|
25875
|
+
var descriptor = {
|
|
25876
|
+
id: "ESLint9",
|
|
25877
|
+
displayName: "ESLint 9",
|
|
25878
|
+
preferredVersion: "9.0.0",
|
|
25879
|
+
languages: ["Javascript", "TypeScript"],
|
|
25880
|
+
filePatterns: ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs", "**/*.ts", "**/*.tsx"],
|
|
25881
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
25882
|
+
supportedArch: ["x64", "arm64"],
|
|
25883
|
+
supportedRunners: ["local", "container"]
|
|
25884
|
+
};
|
|
25885
|
+
|
|
25873
25886
|
// src/adapter.ts
|
|
25874
25887
|
var TOOL_ID2 = "ESLint9";
|
|
25875
25888
|
var LOCAL_CONFIG_FILES = [
|
|
@@ -25903,16 +25916,9 @@ function readLine(filePath, lineNumber) {
|
|
|
25903
25916
|
}
|
|
25904
25917
|
}
|
|
25905
25918
|
var adapter = {
|
|
25906
|
-
|
|
25907
|
-
displayName: "ESLint 9",
|
|
25908
|
-
preferredVersion: "9.0.0",
|
|
25919
|
+
...descriptor,
|
|
25909
25920
|
compatibleVersions: ">=9.0.0 <10.0.0",
|
|
25910
25921
|
website: "https://eslint.org",
|
|
25911
|
-
languages: ["Javascript", "TypeScript"],
|
|
25912
|
-
filePatterns: ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs", "**/*.ts", "**/*.tsx"],
|
|
25913
|
-
supportedOS: ["linux", "darwin", "win32"],
|
|
25914
|
-
supportedArch: ["x64", "arm64"],
|
|
25915
|
-
supportedRunners: ["local", "container"],
|
|
25916
25922
|
prerequisites: [],
|
|
25917
25923
|
/**
|
|
25918
25924
|
* Verifies that the ESLint npm package is loadable and returns its version.
|
|
@@ -25975,7 +25981,7 @@ var adapter = {
|
|
|
25975
25981
|
const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
|
|
25976
25982
|
if (absoluteFiles.length === 0) {
|
|
25977
25983
|
const completedAt2 = /* @__PURE__ */ new Date();
|
|
25978
|
-
return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
25984
|
+
return (0, import_tooling.buildResult)(TOOL_ID2, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
25979
25985
|
}
|
|
25980
25986
|
let ESLintClass;
|
|
25981
25987
|
try {
|
|
@@ -25990,7 +25996,7 @@ var adapter = {
|
|
|
25990
25996
|
message: `Failed to load eslint: ${err instanceof Error ? err.message : String(err)}`,
|
|
25991
25997
|
level: "error"
|
|
25992
25998
|
});
|
|
25993
|
-
return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
25999
|
+
return (0, import_tooling.buildResult)(TOOL_ID2, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
25994
26000
|
}
|
|
25995
26001
|
const eslintOptions = { cwd: ctx.repositoryRoot };
|
|
25996
26002
|
if (codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile) {
|
|
@@ -26008,13 +26014,13 @@ var adapter = {
|
|
|
26008
26014
|
message: `Failed to build ESLint config: ${err instanceof Error ? err.message : String(err)}`,
|
|
26009
26015
|
level: "error"
|
|
26010
26016
|
});
|
|
26011
|
-
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
26017
|
+
return (0, import_tooling.buildResult)(TOOL_ID2, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
26012
26018
|
}
|
|
26013
26019
|
} else {
|
|
26014
26020
|
ctx.logger.info("Skipping analysis: no local config and no patterns enabled", {
|
|
26015
26021
|
toolId: TOOL_ID2
|
|
26016
26022
|
});
|
|
26017
|
-
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
26023
|
+
return (0, import_tooling.buildResult)(TOOL_ID2, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
26018
26024
|
}
|
|
26019
26025
|
const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
|
|
26020
26026
|
try {
|
|
@@ -26065,29 +26071,9 @@ var adapter = {
|
|
|
26065
26071
|
errorCount: errors.length,
|
|
26066
26072
|
durationMs
|
|
26067
26073
|
});
|
|
26068
|
-
return buildResult(startedAt, completedAt, issues, errors, ctx.targetFiles.length);
|
|
26074
|
+
return (0, import_tooling.buildResult)(TOOL_ID2, startedAt, completedAt, issues, errors, ctx.targetFiles.length);
|
|
26069
26075
|
}
|
|
26070
26076
|
};
|
|
26071
|
-
function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
|
|
26072
|
-
const durationMs = completedAt.getTime() - startedAt.getTime();
|
|
26073
|
-
return {
|
|
26074
|
-
metadata: {
|
|
26075
|
-
startedAt: startedAt.toISOString(),
|
|
26076
|
-
completedAt: completedAt.toISOString(),
|
|
26077
|
-
durationMs
|
|
26078
|
-
},
|
|
26079
|
-
issues,
|
|
26080
|
-
errors,
|
|
26081
|
-
summary: {
|
|
26082
|
-
toolId: TOOL_ID2,
|
|
26083
|
-
status: errors.some((e) => e.level === "error") ? "partial" : "success",
|
|
26084
|
-
issueCount: issues.length,
|
|
26085
|
-
errorCount: errors.length,
|
|
26086
|
-
durationMs,
|
|
26087
|
-
filesAnalyzed
|
|
26088
|
-
}
|
|
26089
|
-
};
|
|
26090
|
-
}
|
|
26091
26077
|
|
|
26092
26078
|
// src/index.ts
|
|
26093
|
-
var index_default = (0,
|
|
26079
|
+
var index_default = (0, import_tooling2.defineToolAdapter)(adapter);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdapterDescriptor } from '@codacy/tooling';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight adapter descriptor for lazy loading.
|
|
5
|
+
*
|
|
6
|
+
* This module contains only plain-data metadata fields and has zero heavy
|
|
7
|
+
* imports (no patterns.json, no runtime utilities). The CLI imports this
|
|
8
|
+
* at startup for adapter registration without loading the full adapter module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const descriptor: AdapterDescriptor;
|
|
12
|
+
|
|
13
|
+
export { descriptor };
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/metadata.ts
|
|
21
|
+
var metadata_exports = {};
|
|
22
|
+
__export(metadata_exports, {
|
|
23
|
+
descriptor: () => descriptor
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(metadata_exports);
|
|
26
|
+
var descriptor = {
|
|
27
|
+
id: "ESLint9",
|
|
28
|
+
displayName: "ESLint 9",
|
|
29
|
+
preferredVersion: "9.0.0",
|
|
30
|
+
languages: ["Javascript", "TypeScript"],
|
|
31
|
+
filePatterns: ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs", "**/*.ts", "**/*.tsx"],
|
|
32
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
33
|
+
supportedArch: ["x64", "arm64"],
|
|
34
|
+
supportedRunners: ["local", "container"]
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
descriptor
|
|
39
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/tools-eslint-9",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "ESLint 9 adapter — Library-mode JavaScript/TypeScript linter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"eslint-plugin-wdio": "^9.0.0",
|
|
80
80
|
"eslint-plugin-xss": "^0.1.0",
|
|
81
81
|
"eslint-plugin-yml": "^1.0.0",
|
|
82
|
-
"@codacy/tooling": "0.
|
|
82
|
+
"@codacy/tooling": "0.5.0"
|
|
83
83
|
},
|
|
84
84
|
"license": "MIT",
|
|
85
85
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|
|
@@ -92,8 +92,18 @@
|
|
|
92
92
|
"engines": {
|
|
93
93
|
"node": ">=20.0.0"
|
|
94
94
|
},
|
|
95
|
+
"exports": {
|
|
96
|
+
".": {
|
|
97
|
+
"types": "./dist/index.d.ts",
|
|
98
|
+
"default": "./dist/index.js"
|
|
99
|
+
},
|
|
100
|
+
"./metadata": {
|
|
101
|
+
"types": "./dist/metadata.d.ts",
|
|
102
|
+
"default": "./dist/metadata.js"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
95
105
|
"scripts": {
|
|
96
|
-
"build": "tsup src/index.ts --format cjs --dts --clean",
|
|
106
|
+
"build": "tsup src/index.ts src/metadata.ts --format cjs --dts --clean",
|
|
97
107
|
"test": "vitest run",
|
|
98
108
|
"lint": "eslint src/",
|
|
99
109
|
"clean": "rm -rf dist",
|