@adamhl8/configs 0.19.6 → 0.20.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/README.md +11 -19
- package/dist/adamhl8-knip/index +9 -13
- package/dist/adamhl8-knip/knip-preprocessor.js +4 -5
- package/dist/configs/{knip.d.ts → knip.base.d.ts} +4 -3
- package/dist/configs/knip.base.d.ts.map +1 -0
- package/dist/configs/{knip.js → knip.base.js} +2 -1
- package/dist/configs/knip.base.js.map +1 -0
- package/dist/configs/oxfmt.base.d.ts +18 -0
- package/dist/configs/oxfmt.base.d.ts.map +1 -0
- package/dist/configs/oxfmt.base.js +24 -0
- package/dist/configs/oxfmt.base.js.map +1 -0
- package/dist/configs/oxlint.base.d.ts +70 -0
- package/dist/configs/oxlint.base.d.ts.map +1 -0
- package/dist/configs/oxlint.base.js +81 -0
- package/dist/configs/oxlint.base.js.map +1 -0
- package/dist/configs/tsconfig.base.json +2 -6
- package/dist/configs/{tsdown.d.ts → tsdown.base.d.ts} +23 -23
- package/dist/configs/tsdown.base.d.ts.map +1 -0
- package/dist/configs/{tsdown.js → tsdown.base.js} +20 -20
- package/dist/configs/tsdown.base.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/dist/utils.d.ts +4 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +7 -14
- package/dist/utils.js.map +1 -1
- package/package.json +31 -26
- package/dist/configs/biome.base.json +0 -244
- package/dist/configs/knip.d.ts.map +0 -1
- package/dist/configs/knip.js.map +0 -1
- package/dist/configs/tsdown.d.ts.map +0 -1
- package/dist/configs/tsdown.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# configs
|
|
2
2
|
|
|
3
|
-
Configs (`tsconfig`, `
|
|
3
|
+
Configs (`tsconfig`, `oxfmt`, `oxlint`, etc.) I use across my projects.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
|
|
6
|
+
nub add -D @adamhl8/configs
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
### tsconfig
|
|
@@ -14,25 +14,15 @@ bun add -D @adamhl8/configs
|
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### oxfmt / oxlint
|
|
18
18
|
|
|
19
|
-
```
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
"extends": ["@adamhl8/configs/biome"]
|
|
23
|
-
}
|
|
24
|
-
```
|
|
19
|
+
```ts
|
|
20
|
+
import { oxfmtConfig } from "@adamhl8/configs"
|
|
21
|
+
import { defineConfig } from "oxfmt"
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
const config = oxfmtConfig({ ... })
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
"json": {
|
|
30
|
-
"formatter": {
|
|
31
|
-
// this is 'auto' by default, except that biome uses 'always' for package.json
|
|
32
|
-
// setting it to 'auto' explicitly makes it consistent across all files, including package.json
|
|
33
|
-
"expand": "auto"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
25
|
+
export default defineConfig(config)
|
|
36
26
|
```
|
|
37
27
|
|
|
38
28
|
### knip
|
|
@@ -49,5 +39,7 @@ export default knipConfig({ ... })
|
|
|
49
39
|
import { tsdownConfig } from "@adamhl8/configs"
|
|
50
40
|
import { defineConfig } from "tsdown"
|
|
51
41
|
|
|
52
|
-
|
|
42
|
+
const config = tsdownConfig({ ... })
|
|
43
|
+
|
|
44
|
+
export default defineConfig(config)
|
|
53
45
|
```
|
package/dist/adamhl8-knip/index
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env nub
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import process from "node:process";
|
|
4
6
|
//#region src/adamhl8-knip/index.ts
|
|
5
|
-
const KNIP_PREPROCESSOR_PATH =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
knipPreprocessorPath,
|
|
12
|
-
...process.argv.slice(2)
|
|
13
|
-
],
|
|
14
|
-
stdout: "inherit",
|
|
15
|
-
stderr: "inherit"
|
|
16
|
-
}).exitCode;
|
|
7
|
+
const KNIP_PREPROCESSOR_PATH = path.resolve(import.meta.dirname, "./knip-preprocessor");
|
|
8
|
+
process.exitCode = spawnSync("knip", [
|
|
9
|
+
"--preprocessor",
|
|
10
|
+
`${KNIP_PREPROCESSOR_PATH}${existsSync(`${KNIP_PREPROCESSOR_PATH}.ts`) ? ".ts" : ".js"}`,
|
|
11
|
+
...process.argv.slice(2)
|
|
12
|
+
], { stdio: "inherit" }).status;
|
|
17
13
|
//#endregion
|
|
18
14
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "es-toolkit";
|
|
2
|
-
import "remeda";
|
|
3
2
|
//#endregion
|
|
4
|
-
//#region src/configs/knip.ts
|
|
3
|
+
//#region src/configs/knip.base.ts
|
|
5
4
|
const DEFAULT_ENTRIES = [
|
|
6
5
|
"./src/index.ts",
|
|
7
6
|
"**/*.test.ts",
|
|
@@ -9,21 +8,21 @@ const DEFAULT_ENTRIES = [
|
|
|
9
8
|
];
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region src/adamhl8-knip/knip-preprocessor.ts
|
|
11
|
+
const countIssues = (issueRecords) => Object.values(issueRecords).map((issueRecord) => Object.keys(issueRecord).length).reduce((acc, curr) => acc + curr, 0);
|
|
12
12
|
/**
|
|
13
13
|
* Modifies issues based on the provided map function.
|
|
14
14
|
*
|
|
15
15
|
* This is needed because we also need to update `options.counters` after modifying issues.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
const modifyIssues = (options, issueType, mapFn) => {
|
|
18
18
|
const originalIssues = options.issues[issueType];
|
|
19
19
|
const modifiedIssueEntries = Object.entries(originalIssues).map(([key, issueRecord]) => [key, Object.entries(issueRecord)]).map(([key, issueRecordEntries]) => [key, Object.fromEntries(mapFn([key, issueRecordEntries]))]);
|
|
20
20
|
const modifiedIssues = Object.fromEntries(modifiedIssueEntries);
|
|
21
|
-
const countIssues = (issueRecords) => Object.values(issueRecords).map((issueRecord) => Object.keys(issueRecord).length).reduce((acc, curr) => acc + curr, 0);
|
|
22
21
|
const originalIssueCount = countIssues(originalIssues);
|
|
23
22
|
const issuesRemovedCount = originalIssueCount - countIssues(modifiedIssues);
|
|
24
23
|
options.counters[issueType] = originalIssueCount - issuesRemovedCount;
|
|
25
24
|
options.issues[issueType] = modifiedIssues;
|
|
26
|
-
}
|
|
25
|
+
};
|
|
27
26
|
const preprocess = (options) => {
|
|
28
27
|
options.configurationHints = options.configurationHints.filter((hint) => !(DEFAULT_ENTRIES.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && (hint.type === "entry-empty" || hint.type === "entry-redundant")));
|
|
29
28
|
modifyIssues(options, "unlisted", ([, issueRecordEntries]) => issueRecordEntries.filter(([key]) => !key.includes("prettier")));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { OptionalMergeConfigFn } from "../utils.js";
|
|
2
2
|
import { KnipConfig } from "knip";
|
|
3
3
|
|
|
4
|
-
//#region src/configs/knip.d.ts
|
|
4
|
+
//#region src/configs/knip.base.d.ts
|
|
5
5
|
declare const baseConfig: {
|
|
6
|
-
readonly entry:
|
|
6
|
+
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
7
|
+
readonly ignoreBinaries: ["lefthook"];
|
|
7
8
|
readonly project: ["**"];
|
|
8
9
|
readonly tsdown: false;
|
|
9
10
|
};
|
|
10
11
|
declare const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig>;
|
|
11
12
|
//#endregion
|
|
12
13
|
export { knipConfig };
|
|
13
|
-
//# sourceMappingURL=knip.d.ts.map
|
|
14
|
+
//# sourceMappingURL=knip.base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip.base.d.ts","names":[],"sources":["../../src/configs/knip.base.ts"],"mappings":";;;;cAWM,UAAA;EAAA;;;;;cAOO,UAAA,EAAY,qBAAA,CAAsB,UAAA,SAAmB,UAAA"}
|
|
@@ -5,10 +5,11 @@ const knipConfig = createMergeConfigFn({
|
|
|
5
5
|
"**/*.test.ts",
|
|
6
6
|
"./tsdown.config.ts"
|
|
7
7
|
],
|
|
8
|
+
ignoreBinaries: ["lefthook"],
|
|
8
9
|
project: ["**"],
|
|
9
10
|
tsdown: false
|
|
10
11
|
});
|
|
11
12
|
//#endregion
|
|
12
13
|
export { knipConfig };
|
|
13
14
|
|
|
14
|
-
//# sourceMappingURL=knip.js.map
|
|
15
|
+
//# sourceMappingURL=knip.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport type { OptionalMergeConfigFn } from \"#/utils.ts\"\nimport { createMergeConfigFn } from \"#/utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nexport const DEFAULT_ENTRIES = [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"] as const satisfies string[]\n\nconst baseConfig = {\n entry: DEFAULT_ENTRIES,\n ignoreBinaries: [\"lefthook\"],\n project: [\"**\"],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAkBA,MAAa,aAAmE,oBAAoB;CANlG,OAAO;EAHuB;EAAkB;EAAgB;CAGzD;CACP,gBAAgB,CAAC,UAAU;CAC3B,SAAS,CAAC,IAAI;CACd,QAAQ;AAG0F,CAAU"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OptionalMergeConfigFn } from "../utils.js";
|
|
2
|
+
import { OxfmtConfig } from "oxfmt";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/oxfmt.base.d.ts
|
|
5
|
+
declare const baseConfig: {
|
|
6
|
+
readonly jsdoc: true;
|
|
7
|
+
readonly printWidth: 120;
|
|
8
|
+
readonly proseWrap: "never";
|
|
9
|
+
readonly semi: false;
|
|
10
|
+
readonly sortImports: {
|
|
11
|
+
readonly groups: ["builtin", "external", ["subpath", "internal"], ["index", "sibling", "parent"], "side_effect", ["style", "side_effect_style"]];
|
|
12
|
+
};
|
|
13
|
+
readonly sortTailwindcss: true;
|
|
14
|
+
};
|
|
15
|
+
declare const oxfmtConfig: OptionalMergeConfigFn<OxfmtConfig, typeof baseConfig>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { oxfmtConfig };
|
|
18
|
+
//# sourceMappingURL=oxfmt.base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxfmt.base.d.ts","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;;cAKM,UAAA;EAAA;;;;;;;;;cAkBO,WAAA,EAAa,qBAAA,CAAsB,WAAA,SAAoB,UAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createMergeConfigFn } from "../utils.js";
|
|
2
|
+
const oxfmtConfig = createMergeConfigFn({
|
|
3
|
+
jsdoc: true,
|
|
4
|
+
printWidth: 120,
|
|
5
|
+
proseWrap: "never",
|
|
6
|
+
semi: false,
|
|
7
|
+
sortImports: { groups: [
|
|
8
|
+
"builtin",
|
|
9
|
+
"external",
|
|
10
|
+
["subpath", "internal"],
|
|
11
|
+
[
|
|
12
|
+
"index",
|
|
13
|
+
"sibling",
|
|
14
|
+
"parent"
|
|
15
|
+
],
|
|
16
|
+
"side_effect",
|
|
17
|
+
["style", "side_effect_style"]
|
|
18
|
+
] },
|
|
19
|
+
sortTailwindcss: true
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { oxfmtConfig };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=oxfmt.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxfmt.base.js","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"sourcesContent":["import type { OxfmtConfig } from \"oxfmt\"\n\nimport { createMergeConfigFn } from \"#/utils.ts\"\nimport type { OptionalMergeConfigFn } from \"#/utils.ts\"\n\nconst baseConfig = {\n jsdoc: true,\n printWidth: 120,\n proseWrap: \"never\",\n semi: false,\n sortImports: {\n groups: [\n \"builtin\",\n \"external\",\n [\"subpath\", \"internal\"],\n [\"index\", \"sibling\", \"parent\"],\n \"side_effect\",\n [\"style\", \"side_effect_style\"],\n ],\n },\n sortTailwindcss: true,\n} as const satisfies OxfmtConfig\n\nexport const oxfmtConfig: OptionalMergeConfigFn<OxfmtConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAuBA,MAAa,cAAqE,oBAAoB;CAjBpG,OAAO;CACP,YAAY;CACZ,WAAW;CACX,MAAM;CACN,aAAa,EACX,QAAQ;EACN;EACA;EACA,CAAC,WAAW,UAAU;EACtB;GAAC;GAAS;GAAW;EAAQ;EAC7B;EACA,CAAC,SAAS,mBAAmB;CAC/B,EACF;CACA,iBAAiB;AAGmF,CAAU"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { OptionalMergeConfigFn } from "../utils.js";
|
|
2
|
+
import { OxlintConfig } from "oxlint";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/oxlint.base.d.ts
|
|
5
|
+
declare const baseConfig: {
|
|
6
|
+
readonly categories: {
|
|
7
|
+
readonly correctness: "error";
|
|
8
|
+
readonly nursery: "error";
|
|
9
|
+
readonly pedantic: "error";
|
|
10
|
+
readonly perf: "error";
|
|
11
|
+
readonly restriction: "error";
|
|
12
|
+
readonly style: "error";
|
|
13
|
+
readonly suspicious: "error";
|
|
14
|
+
};
|
|
15
|
+
readonly options: {
|
|
16
|
+
readonly reportUnusedDisableDirectives: "error";
|
|
17
|
+
readonly typeAware: true;
|
|
18
|
+
readonly typeCheck: true;
|
|
19
|
+
};
|
|
20
|
+
readonly overrides: [{
|
|
21
|
+
readonly files: ["knip.ts", "oxfmt.config.ts", "oxlint.config.ts", "tsdown.config.ts"];
|
|
22
|
+
readonly rules: {
|
|
23
|
+
readonly "import/no-default-export": "off";
|
|
24
|
+
};
|
|
25
|
+
}];
|
|
26
|
+
readonly plugins: ["eslint", "react", "unicorn", "typescript", "oxc", "import", "jsdoc", "vitest", "jsx-a11y", "react-perf", "promise", "node"];
|
|
27
|
+
readonly rules: {
|
|
28
|
+
readonly curly: ["error", "multi-or-nest"];
|
|
29
|
+
readonly "func-style": ["error", "expression"];
|
|
30
|
+
readonly "node/no-sync": ["error", {
|
|
31
|
+
readonly ignores: ["existsSync", "spawnSync"];
|
|
32
|
+
}];
|
|
33
|
+
readonly "sort-keys": ["error", "asc", {
|
|
34
|
+
readonly allowLineSeparatedGroups: true;
|
|
35
|
+
readonly natural: true;
|
|
36
|
+
}];
|
|
37
|
+
readonly "capitalized-comments": "off";
|
|
38
|
+
readonly "id-length": "off";
|
|
39
|
+
readonly "import/exports-last": "off";
|
|
40
|
+
readonly "import/group-exports": "off";
|
|
41
|
+
readonly "import/no-named-export": "off";
|
|
42
|
+
readonly "import/no-nodejs-modules": "off";
|
|
43
|
+
readonly "import/prefer-default-export": "off";
|
|
44
|
+
readonly "jsdoc/require-param": "off";
|
|
45
|
+
readonly "jsdoc/require-returns": "off";
|
|
46
|
+
readonly "no-console": "off";
|
|
47
|
+
readonly "no-continue": "off";
|
|
48
|
+
readonly "no-duplicate-imports": "off";
|
|
49
|
+
readonly "no-inline-comments": "off";
|
|
50
|
+
readonly "no-magic-numbers": "off";
|
|
51
|
+
readonly "no-ternary": "off";
|
|
52
|
+
readonly "no-undef": "off";
|
|
53
|
+
readonly "no-undefined": "off";
|
|
54
|
+
readonly "oxc/no-rest-spread-properties": "off";
|
|
55
|
+
readonly "sort-imports": "off";
|
|
56
|
+
readonly "typescript/explicit-function-return-type": "off";
|
|
57
|
+
readonly "typescript/explicit-module-boundary-types": "off";
|
|
58
|
+
readonly "typescript/prefer-readonly-parameter-types": "off";
|
|
59
|
+
readonly "typescript/strict-boolean-expressions": "off";
|
|
60
|
+
};
|
|
61
|
+
readonly settings: {
|
|
62
|
+
readonly vitest: {
|
|
63
|
+
readonly typecheck: true;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, typeof baseConfig>;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { oxlintConfig };
|
|
70
|
+
//# sourceMappingURL=oxlint.base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;;cAKM,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0EO,YAAA,EAAc,qBAAA,CAAsB,YAAA,SAAqB,UAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createMergeConfigFn } from "../utils.js";
|
|
2
|
+
const oxlintConfig = createMergeConfigFn({
|
|
3
|
+
categories: {
|
|
4
|
+
correctness: "error",
|
|
5
|
+
nursery: "error",
|
|
6
|
+
pedantic: "error",
|
|
7
|
+
perf: "error",
|
|
8
|
+
restriction: "error",
|
|
9
|
+
style: "error",
|
|
10
|
+
suspicious: "error"
|
|
11
|
+
},
|
|
12
|
+
options: {
|
|
13
|
+
reportUnusedDisableDirectives: "error",
|
|
14
|
+
typeAware: true,
|
|
15
|
+
typeCheck: true
|
|
16
|
+
},
|
|
17
|
+
overrides: [{
|
|
18
|
+
files: [
|
|
19
|
+
"knip.ts",
|
|
20
|
+
"oxfmt.config.ts",
|
|
21
|
+
"oxlint.config.ts",
|
|
22
|
+
"tsdown.config.ts"
|
|
23
|
+
],
|
|
24
|
+
rules: { "import/no-default-export": "off" }
|
|
25
|
+
}],
|
|
26
|
+
plugins: [
|
|
27
|
+
"eslint",
|
|
28
|
+
"react",
|
|
29
|
+
"unicorn",
|
|
30
|
+
"typescript",
|
|
31
|
+
"oxc",
|
|
32
|
+
"import",
|
|
33
|
+
"jsdoc",
|
|
34
|
+
"vitest",
|
|
35
|
+
"jsx-a11y",
|
|
36
|
+
"react-perf",
|
|
37
|
+
"promise",
|
|
38
|
+
"node"
|
|
39
|
+
],
|
|
40
|
+
rules: {
|
|
41
|
+
curly: ["error", "multi-or-nest"],
|
|
42
|
+
"func-style": ["error", "expression"],
|
|
43
|
+
"node/no-sync": ["error", { ignores: ["existsSync", "spawnSync"] }],
|
|
44
|
+
"sort-keys": [
|
|
45
|
+
"error",
|
|
46
|
+
"asc",
|
|
47
|
+
{
|
|
48
|
+
allowLineSeparatedGroups: true,
|
|
49
|
+
natural: true
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"capitalized-comments": "off",
|
|
53
|
+
"id-length": "off",
|
|
54
|
+
"import/exports-last": "off",
|
|
55
|
+
"import/group-exports": "off",
|
|
56
|
+
"import/no-named-export": "off",
|
|
57
|
+
"import/no-nodejs-modules": "off",
|
|
58
|
+
"import/prefer-default-export": "off",
|
|
59
|
+
"jsdoc/require-param": "off",
|
|
60
|
+
"jsdoc/require-returns": "off",
|
|
61
|
+
"no-console": "off",
|
|
62
|
+
"no-continue": "off",
|
|
63
|
+
"no-duplicate-imports": "off",
|
|
64
|
+
"no-inline-comments": "off",
|
|
65
|
+
"no-magic-numbers": "off",
|
|
66
|
+
"no-ternary": "off",
|
|
67
|
+
"no-undef": "off",
|
|
68
|
+
"no-undefined": "off",
|
|
69
|
+
"oxc/no-rest-spread-properties": "off",
|
|
70
|
+
"sort-imports": "off",
|
|
71
|
+
"typescript/explicit-function-return-type": "off",
|
|
72
|
+
"typescript/explicit-module-boundary-types": "off",
|
|
73
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
74
|
+
"typescript/strict-boolean-expressions": "off"
|
|
75
|
+
},
|
|
76
|
+
settings: { vitest: { typecheck: true } }
|
|
77
|
+
});
|
|
78
|
+
//#endregion
|
|
79
|
+
export { oxlintConfig };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=oxlint.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint.base.js","names":[],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import type { OxlintConfig } from \"oxlint\"\n\nimport { createMergeConfigFn } from \"#/utils.ts\"\nimport type { OptionalMergeConfigFn } from \"#/utils.ts\"\n\nconst baseConfig = {\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n overrides: [\n {\n files: [\"knip.ts\", \"oxfmt.config.ts\", \"oxlint.config.ts\", \"tsdown.config.ts\"],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n ],\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n rules: {\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"node/no-sync\": [\"error\", { ignores: [\"existsSync\", \"spawnSync\"] }],\n \"sort-keys\": [\"error\", \"asc\", { allowLineSeparatedGroups: true, natural: true }],\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/prefer-default-export\": \"off\",\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"sort-imports\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n },\n settings: {\n vitest: {\n typecheck: true,\n },\n },\n} as const satisfies OxlintConfig\n\nexport const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AA+EA,MAAa,eAAuE,oBAAoB;CAzEtG,YAAY;EACV,aAAa;EACb,SAAS;EACT,UAAU;EACV,MAAM;EACN,aAAa;EACb,OAAO;EACP,YAAY;CACd;CACA,SAAS;EACP,+BAA+B;EAC/B,WAAW;EACX,WAAW;CACb;CACA,WAAW,CACT;EACE,OAAO;GAAC;GAAW;GAAmB;GAAoB;EAAkB;EAC5E,OAAO,EACL,4BAA4B,MAC9B;CACF,CACF;CACA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,OAAO;EACL,OAAO,CAAC,SAAS,eAAe;EAChC,cAAc,CAAC,SAAS,YAAY;EACpC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,cAAc,WAAW,EAAE,CAAC;EAClE,aAAa;GAAC;GAAS;GAAO;IAAE,0BAA0B;IAAM,SAAS;GAAK;EAAC;EAE/E,wBAAwB;EACxB,aAAa;EACb,uBAAuB;EACvB,wBAAwB;EACxB,0BAA0B;EAC1B,4BAA4B;EAC5B,gCAAgC;EAChC,uBAAuB;EACvB,yBAAyB;EACzB,cAAc;EACd,eAAe;EACf,wBAAwB;EACxB,sBAAsB;EACtB,oBAAoB;EACpB,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,iCAAiC;EACjC,gBAAgB;EAChB,4CAA4C;EAC5C,6CAA6C;EAC7C,8CAA8C;EAC9C,yCAAyC;CAC3C;CACA,UAAU,EACR,QAAQ,EACN,WAAW,KACb,EACF;AAGsG,CAAU"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"include": ["${configDir}/**/*", "${configDir}/**/.*/**/*"],
|
|
4
4
|
"exclude": ["${configDir}/dist/"],
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"types": ["
|
|
6
|
+
"types": ["node"],
|
|
7
7
|
"lib": ["ESNext"],
|
|
8
8
|
"target": "ESNext",
|
|
9
9
|
"jsx": "react-jsx",
|
|
@@ -27,10 +27,6 @@
|
|
|
27
27
|
"noPropertyAccessFromIndexSignature": true,
|
|
28
28
|
"noUncheckedIndexedAccess": true,
|
|
29
29
|
"noUnusedLocals": true,
|
|
30
|
-
"noUnusedParameters": true
|
|
31
|
-
|
|
32
|
-
"paths": {
|
|
33
|
-
"~/*": ["${configDir}/src/*"]
|
|
34
|
-
}
|
|
30
|
+
"noUnusedParameters": true
|
|
35
31
|
}
|
|
36
32
|
}
|
|
@@ -2,48 +2,48 @@ import { MergeConfigFn, OptionalMergeConfigFn } from "../utils.js";
|
|
|
2
2
|
import { SetRequired } from "type-fest";
|
|
3
3
|
import { UserConfig } from "tsdown";
|
|
4
4
|
|
|
5
|
-
//#region src/configs/tsdown.d.ts
|
|
5
|
+
//#region src/configs/tsdown.base.d.ts
|
|
6
6
|
type StrictUserConfig = SetRequired<UserConfig, "platform">;
|
|
7
7
|
declare const baseConfig: {
|
|
8
|
-
readonly entry: ["./src/index.ts"];
|
|
9
|
-
readonly unbundle: true;
|
|
10
|
-
readonly target: false;
|
|
11
|
-
readonly platform: "neutral";
|
|
12
|
-
readonly fixedExtension: false;
|
|
13
|
-
readonly minify: "dce-only";
|
|
14
|
-
readonly sourcemap: true;
|
|
15
|
-
readonly hash: false;
|
|
16
|
-
readonly dts: {
|
|
17
|
-
readonly resolver: "tsc";
|
|
18
|
-
readonly newContext: true;
|
|
19
|
-
readonly sourcemap: true;
|
|
20
|
-
};
|
|
21
8
|
readonly attw: {
|
|
22
9
|
readonly level: "error";
|
|
23
10
|
readonly profile: "esm-only";
|
|
24
11
|
};
|
|
25
|
-
readonly
|
|
12
|
+
readonly dts: {
|
|
13
|
+
readonly newContext: true;
|
|
14
|
+
readonly resolver: "tsc";
|
|
15
|
+
readonly sourcemap: true;
|
|
16
|
+
};
|
|
17
|
+
readonly entry: ["./src/index.ts"];
|
|
26
18
|
readonly failOnWarn: true;
|
|
19
|
+
readonly fixedExtension: false;
|
|
20
|
+
readonly hash: false;
|
|
21
|
+
readonly minify: "dce-only";
|
|
22
|
+
readonly platform: "neutral";
|
|
23
|
+
readonly publint: true;
|
|
24
|
+
readonly sourcemap: true;
|
|
25
|
+
readonly target: false;
|
|
26
|
+
readonly unbundle: true;
|
|
27
27
|
};
|
|
28
28
|
declare const binConfig: {
|
|
29
|
+
readonly attw: false;
|
|
30
|
+
readonly dts: false;
|
|
29
31
|
readonly entry: [];
|
|
30
|
-
readonly platform: "node";
|
|
31
32
|
readonly outExtensions: () => {
|
|
32
33
|
js: string;
|
|
33
34
|
};
|
|
34
|
-
readonly
|
|
35
|
+
readonly platform: "node";
|
|
35
36
|
readonly sourcemap: false;
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly target: false;
|
|
37
|
+
readonly unbundle: false;
|
|
38
|
+
readonly failOnWarn: true;
|
|
39
39
|
readonly fixedExtension: false;
|
|
40
|
-
readonly minify: "dce-only";
|
|
41
40
|
readonly hash: false;
|
|
41
|
+
readonly minify: "dce-only";
|
|
42
42
|
readonly publint: true;
|
|
43
|
-
readonly
|
|
43
|
+
readonly target: false;
|
|
44
44
|
};
|
|
45
45
|
declare const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig>;
|
|
46
46
|
declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig>;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { tsdownBinConfig, tsdownConfig };
|
|
49
|
-
//# sourceMappingURL=tsdown.d.ts.map
|
|
49
|
+
//# sourceMappingURL=tsdown.base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;;;KAOK,gBAAA,GAAmB,WAAW,CAAC,UAAA;AAAA,cAE9B,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;cAsBA,SAAA;EAAA;;;;;;;;;;;;;;;;cAWO,YAAA,EAAc,aAAA,CAAc,gBAAA,SAAyB,UAAA;AAAA,cACrD,eAAA,EAAiB,qBAAA,CAAsB,UAAA,SAAmB,SAAA"}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../utils.js";
|
|
2
|
-
//#region src/configs/tsdown.ts
|
|
2
|
+
//#region src/configs/tsdown.base.ts
|
|
3
3
|
const baseConfig = {
|
|
4
|
-
entry: ["./src/index.ts"],
|
|
5
|
-
unbundle: true,
|
|
6
|
-
target: false,
|
|
7
|
-
platform: "neutral",
|
|
8
|
-
fixedExtension: false,
|
|
9
|
-
minify: "dce-only",
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
hash: false,
|
|
12
|
-
dts: {
|
|
13
|
-
resolver: "tsc",
|
|
14
|
-
newContext: true,
|
|
15
|
-
sourcemap: true
|
|
16
|
-
},
|
|
17
4
|
attw: {
|
|
18
5
|
level: "error",
|
|
19
6
|
profile: "esm-only"
|
|
20
7
|
},
|
|
8
|
+
dts: {
|
|
9
|
+
newContext: true,
|
|
10
|
+
resolver: "tsc",
|
|
11
|
+
sourcemap: true
|
|
12
|
+
},
|
|
13
|
+
entry: ["./src/index.ts"],
|
|
14
|
+
failOnWarn: true,
|
|
15
|
+
fixedExtension: false,
|
|
16
|
+
hash: false,
|
|
17
|
+
minify: "dce-only",
|
|
18
|
+
platform: "neutral",
|
|
21
19
|
publint: true,
|
|
22
|
-
|
|
20
|
+
sourcemap: true,
|
|
21
|
+
target: false,
|
|
22
|
+
unbundle: true
|
|
23
23
|
};
|
|
24
24
|
const binConfig = {
|
|
25
25
|
...baseConfig,
|
|
26
|
+
attw: false,
|
|
27
|
+
dts: false,
|
|
26
28
|
entry: [],
|
|
27
|
-
platform: "node",
|
|
28
29
|
outExtensions: () => ({ js: "" }),
|
|
29
|
-
|
|
30
|
+
platform: "node",
|
|
30
31
|
sourcemap: false,
|
|
31
|
-
|
|
32
|
-
attw: false
|
|
32
|
+
unbundle: false
|
|
33
33
|
};
|
|
34
34
|
const tsdownConfig = createMergeConfigFn(baseConfig);
|
|
35
35
|
const tsdownBinConfig = createMergeConfigFn(binConfig);
|
|
36
36
|
//#endregion
|
|
37
37
|
export { tsdownBinConfig, tsdownConfig };
|
|
38
38
|
|
|
39
|
-
//# sourceMappingURL=tsdown.js.map
|
|
39
|
+
//# sourceMappingURL=tsdown.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn, OptionalMergeConfigFn } from \"#/utils.ts\"\nimport { createMergeConfigFn } from \"#/utils.ts\"\n\n// Force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n dts: {\n newContext: true,\n resolver: \"tsc\",\n sourcemap: true,\n },\n entry: [\"./src/index.ts\"],\n failOnWarn: true,\n fixedExtension: false,\n hash: false,\n minify: \"dce-only\",\n platform: \"neutral\",\n publint: true,\n sourcemap: true,\n target: false,\n unbundle: true,\n} as const satisfies StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n attw: false,\n dts: false,\n entry: [],\n outExtensions: () => ({ js: \"\" }),\n platform: \"node\",\n sourcemap: false,\n unbundle: false,\n} as const satisfies UserConfig\n\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,KAAK;EACH,YAAY;EACZ,UAAU;EACV,WAAW;CACb;CACA,OAAO,CAAC,gBAAgB;CACxB,YAAY;CACZ,gBAAgB;CAChB,MAAM;CACN,QAAQ;CACR,UAAU;CACV,SAAS;CACT,WAAW;CACX,QAAQ;CACR,UAAU;AACZ;AAEA,MAAM,YAAY;CAChB,GAAG;CACH,MAAM;CACN,KAAK;CACL,OAAO,CAAC;CACR,sBAAsB,EAAE,IAAI,GAAG;CAC/B,UAAU;CACV,WAAW;CACX,UAAU;AACZ;AAEA,MAAa,eAAmE,oBAAoB,UAAU;AAC9G,MAAa,kBAAuE,oBAAoB,SAAS"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { knipConfig } from "./configs/knip.js";
|
|
2
|
-
import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.js";
|
|
3
|
-
|
|
1
|
+
import { knipConfig } from "./configs/knip.base.js";
|
|
2
|
+
import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
3
|
+
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
4
|
+
import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
5
|
+
export { knipConfig, oxfmtConfig, oxlintConfig, tsdownBinConfig, tsdownConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { knipConfig } from "./configs/knip.js";
|
|
2
|
-
import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.js";
|
|
3
|
-
|
|
1
|
+
import { knipConfig } from "./configs/knip.base.js";
|
|
2
|
+
import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
3
|
+
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
4
|
+
import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
5
|
+
export { knipConfig, oxfmtConfig, oxlintConfig, tsdownBinConfig, tsdownConfig };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { MergeDeep } from "type-fest";
|
|
2
2
|
|
|
3
3
|
//#region src/utils.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
|
|
6
|
-
*/
|
|
4
|
+
/** The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`. */
|
|
7
5
|
interface MergeConfigFn<UserConfig, BaseConfig> {
|
|
8
6
|
<UserConfigToMerge extends UserConfig>(userConfig: UserConfigToMerge): MergeDeep<BaseConfig, UserConfigToMerge, {
|
|
9
7
|
arrayMergeMode: "spread";
|
|
10
8
|
}>;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
* The optional merge config function, where the `userConfig` argument is optional.
|
|
14
|
-
* - if `UserConfig` is
|
|
15
|
-
*
|
|
11
|
+
* The optional merge config function, where the `userConfig` argument is optional. - if `UserConfig` is not provided,
|
|
12
|
+
* the return type is `BaseConfig` - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and
|
|
13
|
+
* `UserConfig`.
|
|
16
14
|
*
|
|
17
15
|
* Note that this extends `MergeConfigFn`, so this type has both function signatures on it.
|
|
18
16
|
*/
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;UAaiB,aAAA;EAAA,2BAEY,UAAA,EACzB,UAAA,EAAY,iBAAA,GACX,SAAA,CAAU,UAAA,EAAY,iBAAA;IAAqB,cAAA;EAAA;AAAA;;;;;;;;UAW/B,qBAAA,iCAAsD,aAAA,CAAc,UAAA,EAAY,UAAA;EAAA,IAC3F,UAAA;AAAA"}
|
package/dist/utils.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import { mergeWith } from "es-toolkit";
|
|
2
|
-
import { clone } from "remeda";
|
|
1
|
+
import { cloneDeep, mergeWith } from "es-toolkit";
|
|
3
2
|
//#region src/utils.ts
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Creates a config merge function with proper type overloads for merging with a base config.
|
|
12
|
-
*/
|
|
13
|
-
function createMergeConfigFn(baseConfig) {
|
|
3
|
+
/** A wrapper around es-toolkit's `mergeWith` with a custom merge function that concatenates arrays. */
|
|
4
|
+
const merge = (target, source) => mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
5
|
+
/** Creates a config merge function with proper type overloads for merging with a base config. */
|
|
6
|
+
const createMergeConfigFn = (baseConfig) => {
|
|
14
7
|
const mergeConfigFn = (userConfig) => {
|
|
15
8
|
if (userConfig === void 0) return baseConfig;
|
|
16
|
-
return merge(
|
|
9
|
+
return merge(cloneDeep(baseConfig), cloneDeep(userConfig));
|
|
17
10
|
};
|
|
18
11
|
return mergeConfigFn;
|
|
19
|
-
}
|
|
12
|
+
};
|
|
20
13
|
//#endregion
|
|
21
14
|
export { createMergeConfigFn };
|
|
22
15
|
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { mergeWith } from \"es-toolkit\"\nimport
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { cloneDeep, mergeWith } from \"es-toolkit\"\nimport type { MergeDeep } from \"type-fest\"\n\ntype AnyObj = object\n\n/** A wrapper around es-toolkit's `mergeWith` with a custom merge function that concatenates arrays. */\nconst merge = <T extends AnyObj, S extends AnyObj>(target: T, source: S): T & S =>\n mergeWith(target, source, (objValue: unknown, srcValue: unknown) =>\n // oxlint-disable-next-line unicorn/prefer-spread\n Array.isArray(objValue) ? objValue.concat(srcValue) : undefined,\n )\n\n/** The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`. */\nexport interface MergeConfigFn<UserConfig, BaseConfig> {\n // oxlint-disable-next-line typescript/prefer-function-type - need to use call signature type\n <UserConfigToMerge extends UserConfig>(\n userConfig: UserConfigToMerge,\n ): MergeDeep<BaseConfig, UserConfigToMerge, { arrayMergeMode: \"spread\" }>\n // Instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n}\n\n/**\n * The optional merge config function, where the `userConfig` argument is optional. - if `UserConfig` is not provided,\n * the return type is `BaseConfig` - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and\n * `UserConfig`.\n *\n * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.\n */\nexport interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {\n (): BaseConfig\n}\n\n/** Creates a config merge function with proper type overloads for merging with a base config. */\nexport const createMergeConfigFn = <UserConfig extends AnyObj, BaseConfig extends UserConfig>(\n baseConfig: BaseConfig,\n) => {\n // We don't care about the specific type of userConfig here because we assert mergeConfigFn as the correct type below\n const mergeConfigFn = (userConfig?: AnyObj) => {\n if (userConfig === undefined) return baseConfig\n // Clone both target and source so we never mutate the original objects\n // oxlint-disable-next-line unicorn/prefer-structured-clone - structuredClone does not properly clone functions\n return merge(cloneDeep(baseConfig), cloneDeep(userConfig))\n }\n\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return mergeConfigFn as MergeConfigFn<UserConfig, BaseConfig> & OptionalMergeConfigFn<UserConfig, BaseConfig>\n}\n"],"mappings":";;;AAMA,MAAM,SAA6C,QAAW,WAC5D,UAAU,QAAQ,SAAS,UAAmB,aAE5C,MAAM,QAAQ,QAAQ,IAAI,SAAS,OAAO,QAAQ,IAAI,KAAA,CACxD;;AAuBF,MAAa,uBACX,eACG;CAEH,MAAM,iBAAiB,eAAwB;EAC7C,IAAI,eAAe,KAAA,GAAW,OAAO;EAGrC,OAAO,MAAM,UAAU,UAAU,GAAG,UAAU,UAAU,CAAC;CAC3D;CAGA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,59 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/adamhl8/configs.git"
|
|
8
|
-
},
|
|
3
|
+
"version": "0.20.1",
|
|
9
4
|
"homepage": "https://github.com/adamhl8/configs",
|
|
10
5
|
"bugs": {
|
|
11
6
|
"url": "https://github.com/adamhl8/configs/issues"
|
|
12
7
|
},
|
|
8
|
+
"license": "MIT",
|
|
13
9
|
"author": {
|
|
14
|
-
"email": "adamhl@pm.me",
|
|
15
10
|
"name": "Adam Langbert",
|
|
11
|
+
"email": "adamhl@pm.me",
|
|
16
12
|
"url": "https://github.com/adamhl8"
|
|
17
13
|
},
|
|
18
|
-
"
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/adamhl8/configs.git"
|
|
17
|
+
},
|
|
19
18
|
"bin": {
|
|
20
19
|
"adamhl8-knip": "./dist/adamhl8-knip/index"
|
|
21
20
|
},
|
|
21
|
+
"files": [
|
|
22
|
+
"./dist/"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"imports": {
|
|
26
|
+
"#/*": "./src/*"
|
|
27
|
+
},
|
|
22
28
|
"exports": {
|
|
23
29
|
"./tsconfig": "./dist/configs/tsconfig.base.json",
|
|
24
|
-
"./biome": "./dist/configs/biome.base.json",
|
|
25
30
|
".": {
|
|
26
31
|
"types": "./dist/index.d.ts",
|
|
27
32
|
"import": "./dist/index.js"
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"bundle": "bun lint && tsdown",
|
|
33
|
-
"lint": "bun ./enable-biome-nursery-rules.ts && markdown-toc -i --bullets '-' --maxdepth 3 ./README.md && tsc --noEmit && biome check --write && ./src/adamhl8-knip/index.ts",
|
|
34
|
-
"prepare": "find .githooks -type f -exec ln -srf {} .git/hooks/ \\; || true",
|
|
35
|
-
"prepublishOnly": "bun bundle",
|
|
36
|
-
"postinstall": "bun ./patch-knip.ts"
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"scripts": {
|
|
39
|
+
"bundle": "nub run lint && tsdown",
|
|
40
|
+
"lint": "markdown-toc -i --bullets '-' --maxdepth 3 ./README.md && oxfmt && oxlint --fix --fix-suggestions --fix-dangerously && ./src/adamhl8-knip/index.ts",
|
|
41
|
+
"prepare": "lefthook install && nub ./patch-knip.ts",
|
|
42
|
+
"prepublishOnly": "nub run bundle",
|
|
43
|
+
"bump-deps": "rm -f lock.yaml && nub update -L"
|
|
40
44
|
},
|
|
41
45
|
"dependencies": {
|
|
42
|
-
"es-toolkit": "^1.
|
|
43
|
-
"remeda": "^2.39.0",
|
|
46
|
+
"es-toolkit": "^1.49.0",
|
|
44
47
|
"type-fest": "^5.7.0"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
|
-
"@arethetypeswrong/core": "^0.18.
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"knip": "^6.17.1",
|
|
50
|
+
"@arethetypeswrong/core": "^0.18.4",
|
|
51
|
+
"@types/node": "^26.0.1",
|
|
52
|
+
"knip": "^6.22.0",
|
|
51
53
|
"markdown-toc": "^1.2.0",
|
|
54
|
+
"oxfmt": "^0.56.0",
|
|
55
|
+
"oxlint": "^1.71.0",
|
|
56
|
+
"oxlint-tsgolint": "^0.23.0",
|
|
52
57
|
"publint": "^0.3.21",
|
|
53
58
|
"tsdown": "^0.22.3",
|
|
54
59
|
"typescript": "^6.0.3"
|
|
55
60
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"typescript": "^6.0.0"
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
3
|
-
"root": false,
|
|
4
|
-
"vcs": {
|
|
5
|
-
"enabled": true,
|
|
6
|
-
"clientKind": "git",
|
|
7
|
-
"useIgnoreFile": true
|
|
8
|
-
},
|
|
9
|
-
"assist": {
|
|
10
|
-
"enabled": true,
|
|
11
|
-
"actions": {
|
|
12
|
-
"source": {
|
|
13
|
-
"organizeImports": {
|
|
14
|
-
"level": "on",
|
|
15
|
-
"options": {
|
|
16
|
-
"groups": [
|
|
17
|
-
[":NODE:", ":BUN:", ":PACKAGE_WITH_PROTOCOL:", ":URL:", ":PACKAGE:"],
|
|
18
|
-
":BLANK_LINE:",
|
|
19
|
-
[":ALIAS:", ":PATH:"]
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"overrides": [
|
|
27
|
-
{
|
|
28
|
-
"includes": ["**/*.tsx", "knip.ts", "prettier.config.js", "tsdown.config.ts", "astro.config.ts"],
|
|
29
|
-
"linter": {
|
|
30
|
-
"rules": {
|
|
31
|
-
"style": {
|
|
32
|
-
"noDefaultExport": "off"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"formatter": {
|
|
39
|
-
"indentStyle": "space",
|
|
40
|
-
"lineWidth": 120
|
|
41
|
-
},
|
|
42
|
-
"javascript": {
|
|
43
|
-
"formatter": {
|
|
44
|
-
"semicolons": "asNeeded"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"json": {
|
|
48
|
-
"formatter": {
|
|
49
|
-
"expand": "auto"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"css": {
|
|
53
|
-
"parser": {
|
|
54
|
-
"cssModules": true,
|
|
55
|
-
"tailwindDirectives": true
|
|
56
|
-
},
|
|
57
|
-
"formatter": {
|
|
58
|
-
"enabled": true
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"html": {
|
|
62
|
-
"experimentalFullSupportEnabled": true,
|
|
63
|
-
"formatter": {
|
|
64
|
-
"enabled": true,
|
|
65
|
-
"selfCloseVoidElements": "always"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"linter": {
|
|
69
|
-
"rules": {
|
|
70
|
-
"preset": "all",
|
|
71
|
-
"complexity": {
|
|
72
|
-
"noExcessiveCognitiveComplexity": "off",
|
|
73
|
-
"noExcessiveLinesPerFunction": "off",
|
|
74
|
-
"noForEach": "off",
|
|
75
|
-
"noVoid": "off",
|
|
76
|
-
"useLiteralKeys": "off"
|
|
77
|
-
},
|
|
78
|
-
"correctness": {
|
|
79
|
-
"noNodejsModules": "off",
|
|
80
|
-
"noQwikUseVisibleTask": "off",
|
|
81
|
-
"noSolidDestructuredProps": "off",
|
|
82
|
-
"noUndeclaredDependencies": "off",
|
|
83
|
-
"noUndeclaredVariables": "off",
|
|
84
|
-
"noUnresolvedImports": "off",
|
|
85
|
-
"noVueDataObjectDeclaration": "off",
|
|
86
|
-
"noVueDuplicateKeys": "off",
|
|
87
|
-
"noVueReservedKeys": "off",
|
|
88
|
-
"noVueReservedProps": "off",
|
|
89
|
-
"noVueVIfWithVFor": "off",
|
|
90
|
-
"useQwikClasslist": "off",
|
|
91
|
-
"useQwikMethodUsage": "off",
|
|
92
|
-
"useQwikValidLexicalScope": "off",
|
|
93
|
-
"useVueValidVBind": "off",
|
|
94
|
-
"useVueValidVElse": "off",
|
|
95
|
-
"useVueValidVElseIf": "off",
|
|
96
|
-
"useVueValidVHtml": "off",
|
|
97
|
-
"useVueValidVIf": "off",
|
|
98
|
-
"useVueValidVOn": "off",
|
|
99
|
-
"useVueValidVText": "off"
|
|
100
|
-
},
|
|
101
|
-
"nursery": {
|
|
102
|
-
"noReactNativeRawText": "off",
|
|
103
|
-
"noUntrustedLicenses": "off",
|
|
104
|
-
"useAwaitThenable": "off",
|
|
105
|
-
"useBaseline": {
|
|
106
|
-
"level": "error",
|
|
107
|
-
"options": {
|
|
108
|
-
"available": "newly"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"useExplicitReturnType": "off",
|
|
112
|
-
"useExplicitType": "off",
|
|
113
|
-
"useSortedClasses": {
|
|
114
|
-
"level": "error",
|
|
115
|
-
"fix": "safe"
|
|
116
|
-
},
|
|
117
|
-
"noBaseToString": "error",
|
|
118
|
-
"noComponentHookFactories": "error",
|
|
119
|
-
"noConditionalExpect": "error",
|
|
120
|
-
"noDrizzleDeleteWithoutWhere": "error",
|
|
121
|
-
"noDrizzleUpdateWithoutWhere": "error",
|
|
122
|
-
"noDuplicateFieldDefinitionNames": "error",
|
|
123
|
-
"noDuplicateSelectors": "error",
|
|
124
|
-
"noEmptyObjectKeys": "error",
|
|
125
|
-
"noExcessiveNestedCallbacks": "error",
|
|
126
|
-
"noExcessiveSelectorClasses": "error",
|
|
127
|
-
"noFloatingPromises": "error",
|
|
128
|
-
"noIdenticalTestTitle": "error",
|
|
129
|
-
"noImpliedEval": "error",
|
|
130
|
-
"noInlineStyles": "error",
|
|
131
|
-
"noJsxLeakedDollar": "error",
|
|
132
|
-
"noJsxNamespace": "error",
|
|
133
|
-
"noLoopFunc": "error",
|
|
134
|
-
"noMisleadingReturnType": "error",
|
|
135
|
-
"noMisusedPromises": "error",
|
|
136
|
-
"noPlaywrightElementHandle": "error",
|
|
137
|
-
"noPlaywrightEval": "error",
|
|
138
|
-
"noPlaywrightForceOption": "error",
|
|
139
|
-
"noPlaywrightMissingAwait": "error",
|
|
140
|
-
"noPlaywrightNetworkidle": "error",
|
|
141
|
-
"noPlaywrightPagePause": "error",
|
|
142
|
-
"noPlaywrightUselessAwait": "error",
|
|
143
|
-
"noPlaywrightWaitForNavigation": "error",
|
|
144
|
-
"noPlaywrightWaitForSelector": "error",
|
|
145
|
-
"noPlaywrightWaitForTimeout": "error",
|
|
146
|
-
"noReactNativeDeepImports": "error",
|
|
147
|
-
"noReactNativeLiteralColors": "error",
|
|
148
|
-
"noReactStringRefs": "error",
|
|
149
|
-
"noRestrictedDependencies": "error",
|
|
150
|
-
"noTopLevelLiterals": "error",
|
|
151
|
-
"noUndeclaredClasses": "error",
|
|
152
|
-
"noUnnecessaryTemplateExpression": "error",
|
|
153
|
-
"noUnsafePlusOperands": "error",
|
|
154
|
-
"noUnusedClasses": "error",
|
|
155
|
-
"noUselessTypeConversion": "error",
|
|
156
|
-
"noVueImportCompilerMacros": "error",
|
|
157
|
-
"noVueRefAsOperand": "error",
|
|
158
|
-
"noVueVOnNumberValues": "error",
|
|
159
|
-
"useArraySome": "error",
|
|
160
|
-
"useConsistentTestIt": "error",
|
|
161
|
-
"useDisposables": "error",
|
|
162
|
-
"useDomNodeTextContent": "error",
|
|
163
|
-
"useDomQuerySelector": "error",
|
|
164
|
-
"useExhaustiveSwitchCases": "error",
|
|
165
|
-
"useExpect": "error",
|
|
166
|
-
"useIframeSandbox": "error",
|
|
167
|
-
"useImportsFirst": "error",
|
|
168
|
-
"useIncludes": "error",
|
|
169
|
-
"useMathMinMax": "error",
|
|
170
|
-
"useNamedCaptureGroup": "error",
|
|
171
|
-
"useNullishCoalescing": "error",
|
|
172
|
-
"usePlaywrightValidDescribeCallback": "error",
|
|
173
|
-
"useQwikLoaderLocation": "error",
|
|
174
|
-
"useReactAsyncServerFunction": "error",
|
|
175
|
-
"useReactFunctionComponentDefinition": "error",
|
|
176
|
-
"useReactNativePlatformComponents": "error",
|
|
177
|
-
"useReduceTypeParameter": "error",
|
|
178
|
-
"useRegexpExec": "error",
|
|
179
|
-
"useRegexpTest": "error",
|
|
180
|
-
"useScopedStyles": "error",
|
|
181
|
-
"useStringStartsEndsWith": "error",
|
|
182
|
-
"useSvelteRequireEachKey": "error",
|
|
183
|
-
"useTestHooksInOrder": "error",
|
|
184
|
-
"useTestHooksOnTop": "error",
|
|
185
|
-
"useThisInClassMethods": "error",
|
|
186
|
-
"useUnicodeRegex": "error",
|
|
187
|
-
"useVarsOnTop": "error",
|
|
188
|
-
"useVueConsistentDefinePropsDeclaration": "error",
|
|
189
|
-
"useVueNextTickPromise": "error",
|
|
190
|
-
"useVueValidVFor": "error"
|
|
191
|
-
},
|
|
192
|
-
"performance": {
|
|
193
|
-
"noBarrelFile": "off",
|
|
194
|
-
"noNamespaceImport": "off",
|
|
195
|
-
"noSyncScripts": "off",
|
|
196
|
-
"useSolidForComponent": "off"
|
|
197
|
-
},
|
|
198
|
-
"security": {
|
|
199
|
-
"noSecrets": "off"
|
|
200
|
-
},
|
|
201
|
-
"style": {
|
|
202
|
-
"noContinue": "off",
|
|
203
|
-
"noEnum": "off",
|
|
204
|
-
"noExcessiveClassesPerFile": "off",
|
|
205
|
-
"noExcessiveLinesPerFile": "off",
|
|
206
|
-
"noHeadElement": "off",
|
|
207
|
-
"noIncrementDecrement": "off",
|
|
208
|
-
"noJsxLiterals": "off",
|
|
209
|
-
"noMagicNumbers": "off",
|
|
210
|
-
"noProcessEnv": "off",
|
|
211
|
-
"noTernary": "off",
|
|
212
|
-
"useBlockStatements": "off",
|
|
213
|
-
"useConsistentMemberAccessibility": {
|
|
214
|
-
"level": "error",
|
|
215
|
-
"options": {
|
|
216
|
-
"accessibility": "explicit"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
"useExportsLast": "off",
|
|
220
|
-
"useFilenamingConvention": "off",
|
|
221
|
-
"useImportType": {
|
|
222
|
-
"level": "error",
|
|
223
|
-
"options": {
|
|
224
|
-
"style": "separatedType"
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
"useNamingConvention": "off",
|
|
228
|
-
"useVueDefineMacrosOrder": "off",
|
|
229
|
-
"useVueHyphenatedAttributes": "off",
|
|
230
|
-
"useVueMultiWordComponentNames": "off"
|
|
231
|
-
},
|
|
232
|
-
"suspicious": {
|
|
233
|
-
"noConsole": "off",
|
|
234
|
-
"noReactSpecificProps": "off",
|
|
235
|
-
"noUnknownAttribute": {
|
|
236
|
-
"level": "error",
|
|
237
|
-
"options": {
|
|
238
|
-
"ignore": ["class", "class:list"]
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"mappings":";;;;cAWM,UAAA;EAAA;;;;cAMO,UAAA,EAAY,qBAAA,CAAsB,UAAA,SAAmB,UAAA"}
|
package/dist/configs/knip.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"knip.js","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport type { OptionalMergeConfigFn } from \"../utils.ts\"\nimport { createMergeConfigFn } from \"../utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nexport const DEFAULT_ENTRIES = [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"]\n\nconst baseConfig = {\n entry: DEFAULT_ENTRIES,\n project: [\"**\"],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAiBA,MAAa,aAAmE,oBAAoB;CALlG,OAAO;EAHuB;EAAkB;EAAgB;CAGzD;CACP,SAAS,CAAC,IAAI;CACd,QAAQ;AAG0F,CAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"mappings":";;;;;KAOK,gBAAA,GAAmB,WAAW,CAAC,UAAA;AAAA,cAE9B,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;cAsBA,SAAA;EAAA;;;;;;;;;;;;;;;;cAWO,YAAA,EAAc,aAAA,CAAc,gBAAA,SAAyB,UAAA;AAAA,cACrD,eAAA,EAAiB,qBAAA,CAAsB,UAAA,SAAmB,SAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn, OptionalMergeConfigFn } from \"../utils.ts\"\nimport { createMergeConfigFn } from \"../utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n fixedExtension: false,\n minify: \"dce-only\",\n sourcemap: true,\n hash: false,\n dts: {\n resolver: \"tsc\",\n newContext: true,\n sourcemap: true,\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n entry: [],\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }),\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n} as const satisfies UserConfig\n\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,UAAU;EACV,YAAY;EACZ,WAAW;CACb;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;AACd;AAEA,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;CAC/B,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;AACR;AAEA,MAAa,eAAmE,oBAAoB,UAAU;AAC9G,MAAa,kBAAuE,oBAAoB,SAAS"}
|