@adamhl8/configs 0.17.5 → 0.17.7
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/adamhl8-knip/index +1 -2
- package/dist/configs/biome.base.json +8 -1
- package/dist/configs/knip-preprocessor.js +1 -2
- package/dist/configs/knip-preprocessor.js.map +1 -1
- package/dist/configs/knip.d.ts +2 -0
- package/dist/configs/tsconfig.base.json +1 -1
- package/dist/ts-import-fix/index +2 -3
- package/package.json +13 -13
package/dist/adamhl8-knip/index
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
const KNIP_PREPROCESSOR_PATH = `${path.resolve(import.meta.dir, "../configs/knip-preprocessor")}`;
|
|
5
|
-
const
|
|
6
|
-
const knipPreprocessorPath = `${KNIP_PREPROCESSOR_PATH}${knipPreprocessorPathExt}`;
|
|
5
|
+
const knipPreprocessorPath = `${KNIP_PREPROCESSOR_PATH}${await Bun.file(`${KNIP_PREPROCESSOR_PATH}.ts`).exists() ? ".ts" : ".js"}`;
|
|
7
6
|
process.exitCode = Bun.spawnSync({
|
|
8
7
|
cmd: [
|
|
9
8
|
"knip-bun",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.2.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
|
|
3
3
|
"root": false,
|
|
4
4
|
"vcs": {
|
|
5
5
|
"enabled": true,
|
|
@@ -203,6 +203,7 @@
|
|
|
203
203
|
"useYield": "error"
|
|
204
204
|
},
|
|
205
205
|
"nursery": {
|
|
206
|
+
"noDeprecatedImports": "error",
|
|
206
207
|
"noDuplicateDependencies": "error",
|
|
207
208
|
"noFloatingPromises": "error",
|
|
208
209
|
"noImportCycles": "error",
|
|
@@ -211,23 +212,29 @@
|
|
|
211
212
|
"noNextAsyncClientComponent": "error",
|
|
212
213
|
"noNonNullAssertedOptionalChain": "error",
|
|
213
214
|
"noQwikUseVisibleTask": "error",
|
|
215
|
+
"noReactForwardRef": "error",
|
|
214
216
|
"noSecrets": "off",
|
|
215
217
|
"noShadow": "error",
|
|
216
218
|
"noUnnecessaryConditions": "error",
|
|
217
219
|
"noUnresolvedImports": "off",
|
|
220
|
+
"noUnusedExpressions": "error",
|
|
218
221
|
"noUselessCatchBinding": "error",
|
|
219
222
|
"noUselessUndefined": "error",
|
|
220
223
|
"noVueDataObjectDeclaration": "error",
|
|
224
|
+
"noVueDuplicateKeys": "error",
|
|
221
225
|
"noVueReservedKeys": "error",
|
|
222
226
|
"noVueReservedProps": "error",
|
|
223
227
|
"useAnchorHref": "error",
|
|
224
228
|
"useConsistentArrowReturn": "error",
|
|
225
229
|
"useConsistentTypeDefinitions": "error",
|
|
230
|
+
"useDeprecatedDate": "error",
|
|
226
231
|
"useExhaustiveSwitchCases": "error",
|
|
227
232
|
"useExplicitType": "off",
|
|
228
233
|
"useImageSize": "error",
|
|
229
234
|
"useMaxParams": "error",
|
|
230
235
|
"useQwikClasslist": "error",
|
|
236
|
+
"useQwikMethodUsage": "off",
|
|
237
|
+
"useQwikValidLexicalScope": "off",
|
|
231
238
|
"useReactFunctionComponents": "error",
|
|
232
239
|
"useSortedClasses": "error",
|
|
233
240
|
"useVueMultiWordComponentNames": "error"
|
|
@@ -5,8 +5,7 @@ function modifyIssues(options, issueType, mapFn) {
|
|
|
5
5
|
const modifiedIssues = Object.fromEntries(modifiedIssueEntries);
|
|
6
6
|
const countIssues = (issueRecords) => Object.values(issueRecords).map((issueRecord) => Object.keys(issueRecord).length).reduce((acc, curr) => acc + curr, 0);
|
|
7
7
|
const originalIssueCount = countIssues(originalIssues);
|
|
8
|
-
const
|
|
9
|
-
const issuesRemovedCount = originalIssueCount - modifiedIssueCount;
|
|
8
|
+
const issuesRemovedCount = originalIssueCount - countIssues(modifiedIssues);
|
|
10
9
|
options.counters[issueType] = originalIssueCount - issuesRemovedCount;
|
|
11
10
|
options.issues[issueType] = modifiedIssues;
|
|
12
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip-preprocessor.js","names":["originalIssues: IssueRecords","modifiedIssues: IssueRecords","preprocess: Preprocessor"],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { IssueRecords, SymbolIssueType } from \"knip/dist/types/issues\"\n\nimport { knipConfig } from \"./knip.ts\"\n\n/*\n * The `IssueRecords` type represents an object where each key is the file path and the value is an object containing each issue object.\n *\n * For example:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n */\n\n/** The object containing all the issues for the given file path. */\ntype IssueRecord = IssueRecords[keyof IssueRecords]\ntype IssueRecordEntry = [keyof IssueRecord, IssueRecord[keyof IssueRecord]]\n\n/**\n * We transform `IssueRecords` into object entries where where the _value_ is an array of the object entries from each `IssueRecord`.\n *\n * For example, we're going from this:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n *\n * to this:\n *\n * ```ts\n * [\n * [\"path/to/file/with/issues.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]],\n * // ...\n * ]\n * ```\n */\ntype IssueRecordsEntry = [keyof IssueRecords, IssueRecordEntry[]]\n\n/**\n * Modifies issues based on the provided map function.\n *\n * This is needed because we also need to update `options.counters` after modifying issues.\n */\nfunction modifyIssues(\n options: ReporterOptions,\n issueType: SymbolIssueType,\n mapFn: (issueRecordsEntry: IssueRecordsEntry) => IssueRecordEntry[], // The mapFn should return the entries for the individual issues. We want to make the key (which is the file path) available, but we don't want to allow modification of the key.\n) {\n const originalIssues: IssueRecords = options.issues[issueType]\n const originalIssueEntries: IssueRecordsEntry[] = Object.entries(originalIssues).map(([key, issueRecord]) => [\n key,\n Object.entries(issueRecord),\n ])\n\n const modifiedIssueEntries = originalIssueEntries.map(\n // The map function receives something like `[\"path/to/file.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]]`\n // It then returns *only* the entries for the individual issues: `[[\"issue1\", { ... }], [\"issue2\", { ... }]]`\n ([key, issueRecordEntries]) => [key, Object.fromEntries(mapFn([key, issueRecordEntries]))] as const,\n )\n const modifiedIssues: IssueRecords = Object.fromEntries(modifiedIssueEntries)\n\n const countIssues = (issueRecords: IssueRecords) =>\n Object.values(issueRecords)\n .map((issueRecord) => Object.keys(issueRecord).length) // count the number of issues in each issue record\n .reduce((acc, curr) => acc + curr, 0)\n\n const originalIssueCount = countIssues(originalIssues)\n const modifiedIssueCount = countIssues(modifiedIssues)\n const issuesRemovedCount = originalIssueCount - modifiedIssueCount\n\n options.counters[issueType] = originalIssueCount - issuesRemovedCount\n options.issues[issueType] = modifiedIssues\n}\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\" || hint.type === \"entry-redundant\")\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n modifyIssues(options, \"unlisted\", ([, issueRecordEntries]) =>\n issueRecordEntries.filter(([key]) => !key.includes(\"prettier\")),\n )\n\n modifyIssues(options, \"types\", ([filePath, issueRecordEntries]) => {\n if (filePath !== \"src/configs/utils.ts\") return issueRecordEntries\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 return issueRecordEntries.filter(([key]) => !expectedTypeNames.includes(key))\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";AAwDA,SAAS,aACP,SACA,WACA,OACA;CACA,MAAMA,iBAA+B,QAAQ,OAAO;CAMpD,MAAM,uBAL4C,OAAO,QAAQ,eAAe,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAC3G,KACA,OAAO,QAAQ,YAAY,CAC5B,CAAC,CAEgD,KAG/C,CAAC,KAAK,wBAAwB,CAAC,KAAK,OAAO,YAAY,MAAM,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAC3F;CACD,MAAMC,iBAA+B,OAAO,YAAY,qBAAqB;CAE7E,MAAM,eAAe,iBACnB,OAAO,OAAO,aAAa,CACxB,KAAK,gBAAgB,OAAO,KAAK,YAAY,CAAC,OAAO,CACrD,QAAQ,KAAK,SAAS,MAAM,MAAM,EAAE;CAEzC,MAAM,qBAAqB,YAAY,eAAe;
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.js","names":["originalIssues: IssueRecords","modifiedIssues: IssueRecords","preprocess: Preprocessor"],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { IssueRecords, SymbolIssueType } from \"knip/dist/types/issues\"\n\nimport { knipConfig } from \"./knip.ts\"\n\n/*\n * The `IssueRecords` type represents an object where each key is the file path and the value is an object containing each issue object.\n *\n * For example:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n */\n\n/** The object containing all the issues for the given file path. */\ntype IssueRecord = IssueRecords[keyof IssueRecords]\ntype IssueRecordEntry = [keyof IssueRecord, IssueRecord[keyof IssueRecord]]\n\n/**\n * We transform `IssueRecords` into object entries where where the _value_ is an array of the object entries from each `IssueRecord`.\n *\n * For example, we're going from this:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n *\n * to this:\n *\n * ```ts\n * [\n * [\"path/to/file/with/issues.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]],\n * // ...\n * ]\n * ```\n */\ntype IssueRecordsEntry = [keyof IssueRecords, IssueRecordEntry[]]\n\n/**\n * Modifies issues based on the provided map function.\n *\n * This is needed because we also need to update `options.counters` after modifying issues.\n */\nfunction modifyIssues(\n options: ReporterOptions,\n issueType: SymbolIssueType,\n mapFn: (issueRecordsEntry: IssueRecordsEntry) => IssueRecordEntry[], // The mapFn should return the entries for the individual issues. We want to make the key (which is the file path) available, but we don't want to allow modification of the key.\n) {\n const originalIssues: IssueRecords = options.issues[issueType]\n const originalIssueEntries: IssueRecordsEntry[] = Object.entries(originalIssues).map(([key, issueRecord]) => [\n key,\n Object.entries(issueRecord),\n ])\n\n const modifiedIssueEntries = originalIssueEntries.map(\n // The map function receives something like `[\"path/to/file.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]]`\n // It then returns *only* the entries for the individual issues: `[[\"issue1\", { ... }], [\"issue2\", { ... }]]`\n ([key, issueRecordEntries]) => [key, Object.fromEntries(mapFn([key, issueRecordEntries]))] as const,\n )\n const modifiedIssues: IssueRecords = Object.fromEntries(modifiedIssueEntries)\n\n const countIssues = (issueRecords: IssueRecords) =>\n Object.values(issueRecords)\n .map((issueRecord) => Object.keys(issueRecord).length) // count the number of issues in each issue record\n .reduce((acc, curr) => acc + curr, 0)\n\n const originalIssueCount = countIssues(originalIssues)\n const modifiedIssueCount = countIssues(modifiedIssues)\n const issuesRemovedCount = originalIssueCount - modifiedIssueCount\n\n options.counters[issueType] = originalIssueCount - issuesRemovedCount\n options.issues[issueType] = modifiedIssues\n}\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\" || hint.type === \"entry-redundant\")\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n modifyIssues(options, \"unlisted\", ([, issueRecordEntries]) =>\n issueRecordEntries.filter(([key]) => !key.includes(\"prettier\")),\n )\n\n modifyIssues(options, \"types\", ([filePath, issueRecordEntries]) => {\n if (filePath !== \"src/configs/utils.ts\") return issueRecordEntries\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 return issueRecordEntries.filter(([key]) => !expectedTypeNames.includes(key))\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";AAwDA,SAAS,aACP,SACA,WACA,OACA;CACA,MAAMA,iBAA+B,QAAQ,OAAO;CAMpD,MAAM,uBAL4C,OAAO,QAAQ,eAAe,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAC3G,KACA,OAAO,QAAQ,YAAY,CAC5B,CAAC,CAEgD,KAG/C,CAAC,KAAK,wBAAwB,CAAC,KAAK,OAAO,YAAY,MAAM,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAC3F;CACD,MAAMC,iBAA+B,OAAO,YAAY,qBAAqB;CAE7E,MAAM,eAAe,iBACnB,OAAO,OAAO,aAAa,CACxB,KAAK,gBAAgB,OAAO,KAAK,YAAY,CAAC,OAAO,CACrD,QAAQ,KAAK,SAAS,MAAM,MAAM,EAAE;CAEzC,MAAM,qBAAqB,YAAY,eAAe;CAEtD,MAAM,qBAAqB,qBADA,YAAY,eAAe;AAGtD,SAAQ,SAAS,aAAa,qBAAqB;AACnD,SAAQ,OAAO,aAAa;;AAG9B,MAAM,UAAU,YAAY,CAAC;AAE7B,MAAMC,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,GAAG,wBACpC,mBAAmB,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,WAAW,CAAC,CAChE;AAED,cAAa,SAAS,UAAU,CAAC,UAAU,wBAAwB;AACjE,MAAI,aAAa,uBAAwB,QAAO;EAEhD,MAAM,oBAAoB,CAAC,iBAAiB,wBAAwB;AACpE,SAAO,mBAAmB,QAAQ,CAAC,SAAS,CAAC,kBAAkB,SAAS,IAAI,CAAC;GAC7E;AAEF,QAAO;;AAGT,IAAA,4BAAe"}
|
package/dist/configs/knip.d.ts
CHANGED
|
@@ -1147,6 +1147,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
|
|
|
1147
1147
|
project?: string | string[] | undefined;
|
|
1148
1148
|
paths?: Record<string, string[]> | undefined;
|
|
1149
1149
|
ignore?: string | string[] | undefined;
|
|
1150
|
+
ignoreFiles?: string | string[] | undefined;
|
|
1150
1151
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
1151
1152
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1152
1153
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
@@ -1161,6 +1162,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
|
|
|
1161
1162
|
project?: string | string[] | undefined;
|
|
1162
1163
|
paths?: Record<string, string[]> | undefined;
|
|
1163
1164
|
ignore?: string | string[] | undefined;
|
|
1165
|
+
ignoreFiles?: string | string[] | undefined;
|
|
1164
1166
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
1165
1167
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1166
1168
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
package/dist/ts-import-fix/index
CHANGED
|
@@ -10,13 +10,12 @@ import ts from "typescript";
|
|
|
10
10
|
import fss from "node:fs";
|
|
11
11
|
import { getTsconfig } from "get-tsconfig";
|
|
12
12
|
function cli() {
|
|
13
|
-
|
|
13
|
+
return run(object({
|
|
14
14
|
write: option("-w", "--write", { description: message`Write changes to files` }),
|
|
15
15
|
skipAlias: option("--skip-alias", { description: message`Skip transforming relative imports to use an alias` }),
|
|
16
16
|
fileIgnorePatterns: multiple(option("-f", "--file-ignore", string({ metavar: "PATTERN" }), { description: message`Additional glob patterns for files to ignore (only applies to import fixes)` })),
|
|
17
17
|
importIgnoreStrings: multiple(option("-i", "--import-ignore", string(), { description: message`An import path *containing* the given string will be ignored` }))
|
|
18
|
-
})
|
|
19
|
-
return run(options, {
|
|
18
|
+
}), {
|
|
20
19
|
programName: "ts-import-fix",
|
|
21
20
|
help: "option",
|
|
22
21
|
showDefault: { prefix: " [default: " }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,30 +39,30 @@
|
|
|
39
39
|
"typescript": "^5.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@optique/core": "^0.
|
|
43
|
-
"@optique/run": "^0.
|
|
42
|
+
"@optique/core": "^0.6.1",
|
|
43
|
+
"@optique/run": "^0.6.1",
|
|
44
44
|
"@prettier/plugin-xml": "^3.4.2",
|
|
45
|
-
"es-toolkit": "^1.
|
|
46
|
-
"get-tsconfig": "^4.
|
|
45
|
+
"es-toolkit": "^1.40.0",
|
|
46
|
+
"get-tsconfig": "^4.12.0",
|
|
47
47
|
"picocolors": "^1.1.1",
|
|
48
48
|
"prettier-plugin-astro": "^0.14.1",
|
|
49
49
|
"prettier-plugin-sh": "^0.18.0",
|
|
50
|
-
"prettier-plugin-tailwindcss": "^0.
|
|
50
|
+
"prettier-plugin-tailwindcss": "^0.7.0",
|
|
51
51
|
"prettier-plugin-toml": "^2.0.6",
|
|
52
52
|
"remeda": "^2.32.0",
|
|
53
53
|
"ts-explicit-errors": "^4.0.1",
|
|
54
|
-
"tsdown": "^0.15.
|
|
55
|
-
"type-fest": "^5.0
|
|
54
|
+
"tsdown": "^0.15.7",
|
|
55
|
+
"type-fest": "^5.1.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@arethetypeswrong/core": "^0.18.2",
|
|
59
|
-
"@biomejs/biome": "^2.2.
|
|
60
|
-
"@types/bun": "^1.
|
|
61
|
-
"knip": "^5.
|
|
59
|
+
"@biomejs/biome": "^2.2.6",
|
|
60
|
+
"@types/bun": "^1.3.0",
|
|
61
|
+
"knip": "^5.65.0",
|
|
62
62
|
"markdown-toc": "^1.2.0",
|
|
63
63
|
"prettier": "^3.6.2",
|
|
64
|
-
"publint": "^0.3.
|
|
65
|
-
"typescript": "^5.9.
|
|
64
|
+
"publint": "^0.3.14",
|
|
65
|
+
"typescript": "^5.9.3"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|