@adamhl8/configs 0.15.24 → 0.16.1
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/knip-preprocessor.js +1 -1
- package/dist/knip-preprocessor.js.map +1 -1
- package/dist/ts-import-fix +2783 -0
- package/package.json +10 -4
|
@@ -11,7 +11,7 @@ function filterIssues(options, issueType, filter) {
|
|
|
11
11
|
options.issues[issueType] = filteredIssues;
|
|
12
12
|
}
|
|
13
13
|
const preprocess = (options) => {
|
|
14
|
-
const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(entries.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && hint.type === "entry-empty"));
|
|
14
|
+
const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(entries.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && (hint.type === "entry-empty" || hint.type === "entry-redundant")));
|
|
15
15
|
options.configurationHints = new Set(filteredConfigurationHints);
|
|
16
16
|
filterIssues(options, "unlisted", ([key]) => !key.includes("prettier"));
|
|
17
17
|
filterIssues(options, "unlisted", ([, issueObj]) => Object.keys(issueObj).length > 0);
|
|
@@ -1 +1 @@
|
|
|
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\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 filterIssues(\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 filterIssues(options, \"unlisted\", ([key]) => !key.includes(\"prettier\"))\n filterIssues(options, \"unlisted\", ([, issueObj]) => Object.keys(issueObj).length > 0)\n\n filterIssues(options, \"types\", ([key, issueObj]) => {\n if (key !== \"src/utils.ts\") return true\n const typeNames = Object.keys(issueObj)\n // We need to bring these types into scope of each merge config module: https://github.com/microsoft/TypeScript/issues/5711\n const expectedTypeNames = [\"MergeConfigFn\", \"OptionalMergeConfigFn\"]\n if (typeNames.length !== expectedTypeNames.length) return true // don't filter out the issue if there are other types\n const foundAllExpectedTypeNames = expectedTypeNames.every((expectedTypeName) =>\n typeNames.includes(expectedTypeName),\n )\n const shouldFilterIssue = !foundAllExpectedTypeNames // if all the expected type names are found, we need to return false to filter out the issue\n return shouldFilterIssue\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";;AAKA,MAAM,UAAU,YAAY,CAAC;AAO7B,SAAS,aACP,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,
|
|
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\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 filterIssues(\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\" || hint.type === \"entry-redundant\")\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n filterIssues(options, \"unlisted\", ([key]) => !key.includes(\"prettier\"))\n filterIssues(options, \"unlisted\", ([, issueObj]) => Object.keys(issueObj).length > 0)\n\n filterIssues(options, \"types\", ([key, issueObj]) => {\n if (key !== \"src/utils.ts\") return true\n const typeNames = Object.keys(issueObj)\n // We need to bring these types into scope of each merge config module: https://github.com/microsoft/TypeScript/issues/5711\n const expectedTypeNames = [\"MergeConfigFn\", \"OptionalMergeConfigFn\"]\n if (typeNames.length !== expectedTypeNames.length) return true // don't filter out the issue if there are other types\n const foundAllExpectedTypeNames = expectedTypeNames.every((expectedTypeName) =>\n typeNames.includes(expectedTypeName),\n )\n const shouldFilterIssue = !foundAllExpectedTypeNames // if all the expected type names are found, we need to return false to filter out the issue\n return shouldFilterIssue\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";;AAKA,MAAM,UAAU,YAAY,CAAC;AAO7B,SAAS,aACP,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,KAC9F,KAAK,SAAS,iBAAiB,KAAK,SAAS,oBAEnD;AACD,SAAQ,qBAAqB,IAAI,IAAI,2BAA2B;AAEhE,cAAa,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,WAAW,CAAC;AACvE,cAAa,SAAS,aAAa,GAAG,cAAc,OAAO,KAAK,SAAS,CAAC,SAAS,EAAE;AAErF,cAAa,SAAS,UAAU,CAAC,KAAK,cAAc;AAClD,MAAI,QAAQ,eAAgB,QAAO;EACnC,MAAM,YAAY,OAAO,KAAK,SAAS;EAEvC,MAAM,oBAAoB,CAAC,iBAAiB,wBAAwB;AACpE,MAAI,UAAU,WAAW,kBAAkB,OAAQ,QAAO;AAK1D,SAD0B,CAHQ,kBAAkB,OAAO,qBACzD,UAAU,SAAS,iBAAiB,CACrC;GAGD;AAEF,QAAO;;AAGT,IAAA,4BAAe"}
|