@adamhl8/configs 0.15.18 → 0.15.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cA6BM,YAAY"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { knipConfig } from "./knip.js";
|
|
2
2
|
import "./index.js";
|
|
3
3
|
const entries = knipConfig().entry;
|
|
4
|
+
function filterIssue(options, issueType, filter) {
|
|
5
|
+
const issuesObject = options.issues[issueType];
|
|
6
|
+
const filteredIssues = Object.fromEntries(Object.entries(issuesObject).filter(filter));
|
|
7
|
+
const issueCount = Object.keys(issuesObject).length;
|
|
8
|
+
const filteredIssueCount = Object.keys(filteredIssues).length;
|
|
9
|
+
const issuesRemovedCount = issueCount - filteredIssueCount;
|
|
10
|
+
options.counters[issueType] = issueCount - issuesRemovedCount;
|
|
11
|
+
options.issues[issueType] = filteredIssues;
|
|
12
|
+
}
|
|
4
13
|
const preprocess = (options) => {
|
|
5
14
|
const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(entries.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && hint.type === "entry-empty"));
|
|
6
15
|
options.configurationHints = new Set(filteredConfigurationHints);
|
|
7
|
-
|
|
8
|
-
options.
|
|
16
|
+
filterIssue(options, "unlisted", ([key]) => !key.includes("prettier"));
|
|
17
|
+
filterIssue(options, "unlisted", ([, issueObj]) => Object.keys(issueObj).length > 0);
|
|
9
18
|
return options;
|
|
10
19
|
};
|
|
11
20
|
var knip_preprocessor_default = preprocess;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip-preprocessor.js","names":["preprocess: Preprocessor"],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor } from \"knip\"\n\n// biome-ignore lint/plugin: ignore\nimport { knipConfig } from \"./index.ts\"\n\nconst entries = knipConfig().entry as string[]\n\nconst preprocess: Preprocessor = (options) => {\n // ignore the \"Refine entry pattern (no matches)\" configuration hints for entries in the base config\n const filteredConfigurationHints = [...options.configurationHints].filter(\n (hint) =>\n !(\n entries.some((entry) => typeof hint.identifier === \"string\" && hint.identifier.includes(entry)) &&\n hint.type === \"entry-empty\"\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.js","names":["preprocess: Preprocessor"],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { Issue, SymbolIssueType } from \"knip/dist/types/issues\"\n\n// biome-ignore lint/plugin: ignore\nimport { knipConfig } from \"./index.ts\"\n\nconst entries = knipConfig().entry as string[]\n\n/**\n * Filters issues based on the provided filter function.\n *\n * This is needed because we also need to update `options.counters` after filtering issues.\n */\nfunction filterIssue(\n options: ReporterOptions,\n issueType: SymbolIssueType,\n filter: (issueEntry: [string, Record<string, Issue>]) => boolean,\n) {\n const issuesObject = options.issues[issueType]\n const filteredIssues = Object.fromEntries(Object.entries(issuesObject).filter(filter))\n\n const issueCount = Object.keys(issuesObject).length\n const filteredIssueCount = Object.keys(filteredIssues).length\n const issuesRemovedCount = issueCount - filteredIssueCount\n\n options.counters[issueType] = issueCount - issuesRemovedCount\n options.issues[issueType] = filteredIssues\n}\n\nconst preprocess: Preprocessor = (options) => {\n // ignore the \"Refine entry pattern (no matches)\" configuration hints for entries in the base config\n const filteredConfigurationHints = [...options.configurationHints].filter(\n (hint) =>\n !(\n entries.some((entry) => typeof hint.identifier === \"string\" && hint.identifier.includes(entry)) &&\n hint.type === \"entry-empty\"\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n filterIssue(options, \"unlisted\", ([key]) => !key.includes(\"prettier\"))\n filterIssue(options, \"unlisted\", ([, issueObj]) => Object.keys(issueObj).length > 0)\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";;AAMA,MAAM,UAAU,YAAY,CAAC;AAO7B,SAAS,YACP,SACA,WACA,QACA;CACA,MAAM,eAAe,QAAQ,OAAO;CACpC,MAAM,iBAAiB,OAAO,YAAY,OAAO,QAAQ,aAAa,CAAC,OAAO,OAAO,CAAC;CAEtF,MAAM,aAAa,OAAO,KAAK,aAAa,CAAC;CAC7C,MAAM,qBAAqB,OAAO,KAAK,eAAe,CAAC;CACvD,MAAM,qBAAqB,aAAa;AAExC,SAAQ,SAAS,aAAa,aAAa;AAC3C,SAAQ,OAAO,aAAa;;AAG9B,MAAMA,cAA4B,YAAY;CAE5C,MAAM,6BAA6B,CAAC,GAAG,QAAQ,mBAAmB,CAAC,QAChE,SACC,EACE,QAAQ,MAAM,UAAU,OAAO,KAAK,eAAe,YAAY,KAAK,WAAW,SAAS,MAAM,CAAC,IAC/F,KAAK,SAAS,eAEnB;AACD,SAAQ,qBAAqB,IAAI,IAAI,2BAA2B;AAEhE,aAAY,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,WAAW,CAAC;AACtE,aAAY,SAAS,aAAa,GAAG,cAAc,OAAO,KAAK,SAAS,CAAC,SAAS,EAAE;AAEpF,QAAO;;AAGT,IAAA,4BAAe"}
|