@codacy/tools-eslint-9 0.2.2 → 0.4.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 +50 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -25710,6 +25710,32 @@ function extractPluginPrefix(ruleId) {
|
|
|
25710
25710
|
// src/config-builder.ts
|
|
25711
25711
|
var TOOL_ID = "ESLint9";
|
|
25712
25712
|
var PREFIX = `${TOOL_ID}_`;
|
|
25713
|
+
var CORE_TO_TS_EXTENSION = /* @__PURE__ */ new Map([
|
|
25714
|
+
["class-methods-use-this", "@typescript-eslint/class-methods-use-this"],
|
|
25715
|
+
["consistent-return", "@typescript-eslint/consistent-return"],
|
|
25716
|
+
["default-param-last", "@typescript-eslint/default-param-last"],
|
|
25717
|
+
["dot-notation", "@typescript-eslint/dot-notation"],
|
|
25718
|
+
["init-declarations", "@typescript-eslint/init-declarations"],
|
|
25719
|
+
["max-params", "@typescript-eslint/max-params"],
|
|
25720
|
+
["no-array-constructor", "@typescript-eslint/no-array-constructor"],
|
|
25721
|
+
["no-dupe-class-members", "@typescript-eslint/no-dupe-class-members"],
|
|
25722
|
+
["no-empty-function", "@typescript-eslint/no-empty-function"],
|
|
25723
|
+
["no-implied-eval", "@typescript-eslint/no-implied-eval"],
|
|
25724
|
+
["no-invalid-this", "@typescript-eslint/no-invalid-this"],
|
|
25725
|
+
["no-loop-func", "@typescript-eslint/no-loop-func"],
|
|
25726
|
+
["no-loss-of-precision", "@typescript-eslint/no-loss-of-precision"],
|
|
25727
|
+
["no-magic-numbers", "@typescript-eslint/no-magic-numbers"],
|
|
25728
|
+
["no-redeclare", "@typescript-eslint/no-redeclare"],
|
|
25729
|
+
["no-restricted-imports", "@typescript-eslint/no-restricted-imports"],
|
|
25730
|
+
["no-shadow", "@typescript-eslint/no-shadow"],
|
|
25731
|
+
["no-unused-expressions", "@typescript-eslint/no-unused-expressions"],
|
|
25732
|
+
["no-unused-vars", "@typescript-eslint/no-unused-vars"],
|
|
25733
|
+
["no-use-before-define", "@typescript-eslint/no-use-before-define"],
|
|
25734
|
+
["no-useless-constructor", "@typescript-eslint/no-useless-constructor"],
|
|
25735
|
+
["prefer-destructuring", "@typescript-eslint/prefer-destructuring"],
|
|
25736
|
+
["prefer-promise-reject-errors", "@typescript-eslint/prefer-promise-reject-errors"],
|
|
25737
|
+
["require-await", "@typescript-eslint/require-await"]
|
|
25738
|
+
]);
|
|
25713
25739
|
function decodePatternId(patternId) {
|
|
25714
25740
|
if (!patternId.startsWith(PREFIX)) return patternId;
|
|
25715
25741
|
const raw = patternId.slice(PREFIX.length);
|
|
@@ -25788,6 +25814,22 @@ async function buildESLintConfig(patterns) {
|
|
|
25788
25814
|
}
|
|
25789
25815
|
configs.push(configItem);
|
|
25790
25816
|
}
|
|
25817
|
+
const tsOverrideRules = {};
|
|
25818
|
+
if (coreRules["no-undef"] !== void 0) {
|
|
25819
|
+
tsOverrideRules["no-undef"] = "off";
|
|
25820
|
+
}
|
|
25821
|
+
const enabledTsRuleIds = new Set(tsRules ? Object.keys(tsRules) : []);
|
|
25822
|
+
for (const [coreRule, tsRule] of CORE_TO_TS_EXTENSION) {
|
|
25823
|
+
if (coreRules[coreRule] !== void 0 && enabledTsRuleIds.has(tsRule)) {
|
|
25824
|
+
tsOverrideRules[coreRule] = "off";
|
|
25825
|
+
}
|
|
25826
|
+
}
|
|
25827
|
+
if (Object.keys(tsOverrideRules).length > 0) {
|
|
25828
|
+
configs.push({
|
|
25829
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
25830
|
+
rules: tsOverrideRules
|
|
25831
|
+
});
|
|
25832
|
+
}
|
|
25791
25833
|
return configs;
|
|
25792
25834
|
}
|
|
25793
25835
|
function buildRuleValue(pattern) {
|
|
@@ -25922,7 +25964,7 @@ var adapter = {
|
|
|
25922
25964
|
* Config resolution order:
|
|
25923
25965
|
* 1. Local config file if `useLocalConfigurationFile` is true
|
|
25924
25966
|
* 2. Codacy patterns → build flat config with only those rules
|
|
25925
|
-
* 3.
|
|
25967
|
+
* 3. No local config and no patterns → skip execution
|
|
25926
25968
|
*/
|
|
25927
25969
|
async analyze(ctx, codacyConfig) {
|
|
25928
25970
|
const startMs = Date.now();
|
|
@@ -25964,20 +26006,15 @@ var adapter = {
|
|
|
25964
26006
|
phase: "toolConfig",
|
|
25965
26007
|
kind: "ConfigBuildError",
|
|
25966
26008
|
message: `Failed to build ESLint config: ${err instanceof Error ? err.message : String(err)}`,
|
|
25967
|
-
level: "
|
|
26009
|
+
level: "error"
|
|
25968
26010
|
});
|
|
26011
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
25969
26012
|
}
|
|
25970
|
-
}
|
|
25971
|
-
|
|
25972
|
-
|
|
25973
|
-
|
|
25974
|
-
|
|
25975
|
-
if (recommended) {
|
|
25976
|
-
eslintOptions.overrideConfig = [recommended];
|
|
25977
|
-
eslintOptions.overrideConfigFile = true;
|
|
25978
|
-
}
|
|
25979
|
-
} catch {
|
|
25980
|
-
}
|
|
26013
|
+
} else {
|
|
26014
|
+
ctx.logger.info("Skipping analysis: no local config and no patterns enabled", {
|
|
26015
|
+
toolId: TOOL_ID2
|
|
26016
|
+
});
|
|
26017
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
25981
26018
|
}
|
|
25982
26019
|
const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
|
|
25983
26020
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/tools-eslint-9",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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.4.0"
|
|
83
83
|
},
|
|
84
84
|
"license": "MIT",
|
|
85
85
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|