@adamhl8/configs 0.24.2 → 0.24.4

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 CHANGED
@@ -14,7 +14,7 @@ nub add -D @adamhl8/configs
14
14
  }
15
15
  ```
16
16
 
17
- ### oxfmt / oxlint
17
+ ### oxfmt
18
18
 
19
19
  ```ts
20
20
  import { oxfmtConfig } from "@adamhl8/configs"
@@ -25,6 +25,17 @@ const config = oxfmtConfig({ ... })
25
25
  export default defineConfig(config)
26
26
  ```
27
27
 
28
+ ### oxlint
29
+
30
+ ```ts
31
+ import { oxlintConfig } from "@adamhl8/configs"
32
+ import { defineConfig } from "oxlint"
33
+
34
+ const config = oxlintConfig({ ... })
35
+
36
+ export default defineConfig(config)
37
+ ```
38
+
28
39
  ### knip
29
40
 
30
41
  ```ts
@@ -44,6 +55,8 @@ const config = tsdownConfig({ ... })
44
55
  export default defineConfig(config)
45
56
  ```
46
57
 
58
+ `tsdownBinConfig` is also exported for building `package.json` bin executables: a bundled, single-file, extensionless build with no type declarations.
59
+
47
60
  ### vitest
48
61
 
49
62
  ```ts
@@ -55,6 +68,46 @@ const config = vitestConfig({ ... })
55
68
  export default defineConfig(config)
56
69
  ```
57
70
 
71
+ ### commitlint
72
+
73
+ ```ts
74
+ import { commitlintConfig } from "@adamhl8/configs"
75
+
76
+ export default commitlintConfig({ ... })
77
+ ```
78
+
79
+ ### release-it
80
+
81
+ ```ts
82
+ import { releaseItConfig } from "@adamhl8/configs"
83
+
84
+ export default releaseItConfig({ ... })
85
+ ```
86
+
87
+ The release config wires up its hooks to use `adamhl8-cliff` for the changelog and release notes, so the two are meant to be used together.
88
+
89
+ ### git-cliff
90
+
91
+ There is no per-project file to write. The `adamhl8-cliff` bin wraps `git-cliff` with the bundled config (`cliff.base.toml`), so run it in place of `git-cliff`:
92
+
93
+ ```sh
94
+ adamhl8-cliff --bumped-version
95
+ ```
96
+
97
+ `releaseItConfig` already calls it to build the changelog and release notes.
98
+
99
+ ### lefthook
100
+
101
+ `lefthook.base.yaml` runs `lint` on pre-commit and `commitlint` on commit-msg. Extend it from your `lefthook.yaml`:
102
+
103
+ ```yaml
104
+ # lefthook.yaml
105
+ extends:
106
+ - node_modules/@adamhl8/configs/dist/configs/lefthook.base.yaml
107
+ ```
108
+
109
+ `lefthook install` (run it from `prepare`) sets up the hooks.
110
+
58
111
  ## GitHub Actions
59
112
 
60
113
  This repo hosts two reusable workflows you can call from other projects instead of copy/pasting them. The calling project must use `nub` and define `lint` / `bundle` / `bump-deps` scripts and a commitlint config (e.g. via these configs).
@@ -6,13 +6,18 @@ const DEFAULT_ENTRIES = [
6
6
  "**/*.test.ts",
7
7
  "./tsdown.config.ts"
8
8
  ];
9
- const IGNORE_DEPENDENCIES_UNLISTED = ["@commitlint/config-conventional"];
10
- [...IGNORE_DEPENDENCIES_UNLISTED];
9
+ /**
10
+ * Consuming projects show these transitive dependencies as unlisted. e.g. knip resolves
11
+ * `@adamhl8/eslint-plugin-clean-modules` via the oxlint config, but we don't need to install it directly in the
12
+ * consuming project.
13
+ */
14
+ const UNLISTED_DEPENDENCIES = ["@adamhl8/eslint-plugin-clean-modules"];
15
+ const IGNORE_DEPENDENCIES = [...["@commitlint/cli"], ...UNLISTED_DEPENDENCIES];
11
16
  //#endregion
12
17
  //#region src/adamhl8-knip/knip-preprocessor.ts
13
18
  const preprocess = (options) => {
14
19
  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")));
15
- options.configurationHints = options.configurationHints.filter((hint) => !(IGNORE_DEPENDENCIES_UNLISTED.some((dep) => typeof hint.identifier === "string" && hint.identifier.includes(dep)) && hint.type === "ignoreDependencies"));
20
+ options.configurationHints = options.configurationHints.filter((hint) => !(IGNORE_DEPENDENCIES.some((dep) => typeof hint.identifier === "string" && hint.identifier.includes(dep)) && hint.type === "ignoreDependencies"));
16
21
  return options;
17
22
  };
18
23
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"knip.base.d.ts","names":[],"sources":["../../src/configs/knip.base.ts"],"mappings":";;;;cAaM,UAAA;EAAA;;;;;;cAQO,UAAA,EAAY,qBAAA,CAAsB,UAAA,SAAmB,UAAA"}
1
+ {"version":3,"file":"knip.base.d.ts","names":[],"sources":["../../src/configs/knip.base.ts"],"mappings":";;;;cAwBM,UAAA;EAAA;;;;;;cAQO,UAAA,EAAY,qBAAA,CAAsB,UAAA,SAAmB,UAAA"}
@@ -5,15 +5,21 @@ const DEFAULT_ENTRIES = [
5
5
  "**/*.test.ts",
6
6
  "./tsdown.config.ts"
7
7
  ];
8
- const IGNORE_DEPENDENCIES_UNLISTED = ["@commitlint/config-conventional"];
8
+ /**
9
+ * Consuming projects show these transitive dependencies as unlisted. e.g. knip resolves
10
+ * `@adamhl8/eslint-plugin-clean-modules` via the oxlint config, but we don't need to install it directly in the
11
+ * consuming project.
12
+ */
13
+ const UNLISTED_DEPENDENCIES = ["@adamhl8/eslint-plugin-clean-modules"];
14
+ const IGNORE_DEPENDENCIES = [...["@commitlint/cli"], ...UNLISTED_DEPENDENCIES];
9
15
  const knipConfig = createMergeConfigFn({
10
16
  project: ["**"],
11
17
  entry: DEFAULT_ENTRIES,
12
18
  ignoreBinaries: ["lefthook"],
13
- ignoreDependencies: [...IGNORE_DEPENDENCIES_UNLISTED],
19
+ ignoreDependencies: IGNORE_DEPENDENCIES,
14
20
  tsdown: false
15
21
  });
16
22
  //#endregion
17
- export { DEFAULT_ENTRIES, IGNORE_DEPENDENCIES_UNLISTED, knipConfig };
23
+ export { DEFAULT_ENTRIES, IGNORE_DEPENDENCIES, knipConfig };
18
24
 
19
25
  //# sourceMappingURL=knip.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport { createMergeConfigFn } from \"#/utils.ts\"\nimport type { OptionalMergeConfigFn } 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// In consuming projects, for some reason knip complains about these dependencies being unlisted.\nexport const IGNORE_DEPENDENCIES_UNLISTED = [\"@commitlint/config-conventional\"]\n\nconst baseConfig = {\n project: [\"**\"],\n entry: DEFAULT_ENTRIES,\n ignoreBinaries: [\"lefthook\"],\n ignoreDependencies: [...IGNORE_DEPENDENCIES_UNLISTED],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";;AASA,MAAa,kBAAkB;CAAC;CAAkB;CAAgB;AAAoB;AAEtF,MAAa,+BAA+B,CAAC,iCAAiC;AAU9E,MAAa,aAAmE,oBAAoB;CAPlG,SAAS,CAAC,IAAI;CACd,OAAO;CACP,gBAAgB,CAAC,UAAU;CAC3B,oBAAoB,CAAC,GAAG,4BAA4B;CACpD,QAAQ;AAG0F,CAAU"}
1
+ {"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport { createMergeConfigFn } from \"#/utils.ts\"\nimport type { OptionalMergeConfigFn } 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\n/**\n * Consuming projects show these transitive dependencies as unlisted. e.g. knip resolves\n * `@adamhl8/eslint-plugin-clean-modules` via the oxlint config, but we don't need to install it directly in the\n * consuming project.\n */\nconst UNLISTED_DEPENDENCIES = [\"@adamhl8/eslint-plugin-clean-modules\"]\n/**\n * Consuming projects show these dependencies as unused. e.g. `@commitlint/cli` can't be found by knip because it's\n * hidden by the fact that we call/extend our GitHub workflows.\n */\nconst UNUSED_DEPENDENCIES = [\"@commitlint/cli\"]\nexport const IGNORE_DEPENDENCIES = [...UNUSED_DEPENDENCIES, ...UNLISTED_DEPENDENCIES]\n\nconst baseConfig = {\n project: [\"**\"],\n entry: DEFAULT_ENTRIES,\n ignoreBinaries: [\"lefthook\"],\n ignoreDependencies: IGNORE_DEPENDENCIES,\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";;AASA,MAAa,kBAAkB;CAAC;CAAkB;CAAgB;AAAoB;;;;;;AAOtF,MAAM,wBAAwB,CAAC,sCAAsC;AAMrE,MAAa,sBAAsB,CAAC,GAAG,CADV,iBACU,GAAqB,GAAG,qBAAqB;AAUpF,MAAa,aAAmE,oBAAoB;CAPlG,SAAS,CAAC,IAAI;CACd,OAAO;CACP,gBAAgB,CAAC,UAAU;CAC3B,oBAAoB;CACpB,QAAQ;AAG0F,CAAU"}
@@ -6,7 +6,6 @@ declare const baseConfig: {
6
6
  readonly printWidth: 120;
7
7
  readonly semi: false;
8
8
  readonly jsdoc: true;
9
- readonly proseWrap: "never";
10
9
  readonly sortImports: {
11
10
  readonly groups: ["builtin", "external", ["subpath", "internal"], ["index", "sibling", "parent"], "side_effect", ["style", "side_effect_style"]];
12
11
  };
@@ -1 +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"}
1
+ {"version":3,"file":"oxfmt.base.d.ts","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;;cAKM,UAAA;EAAA;;;;;;;;cAiBO,WAAA,EAAa,qBAAA,CAAsB,WAAA,SAAoB,UAAA"}
@@ -3,7 +3,6 @@ const oxfmtConfig = createMergeConfigFn({
3
3
  printWidth: 120,
4
4
  semi: false,
5
5
  jsdoc: true,
6
- proseWrap: "never",
7
6
  sortImports: { groups: [
8
7
  "builtin",
9
8
  "external",
@@ -1 +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 printWidth: 120,\n semi: false,\n jsdoc: true,\n proseWrap: \"never\",\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,YAAY;CACZ,MAAM;CACN,OAAO;CACP,WAAW;CACX,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"}
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 printWidth: 120,\n semi: false,\n jsdoc: true,\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":";AAsBA,MAAa,cAAqE,oBAAoB;CAhBpG,YAAY;CACZ,MAAM;CACN,OAAO;CACP,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "0.24.2",
3
+ "version": "0.24.4",
4
4
  "homepage": "https://github.com/adamhl8/configs",
5
5
  "bugs": {
6
6
  "url": "https://github.com/adamhl8/configs/issues"
@@ -45,20 +45,20 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@adamhl8/eslint-plugin-clean-modules": "^0.1.1",
48
- "@commitlint/config-conventional": "^21.1.0",
49
- "@commitlint/types": "^21.1.0",
48
+ "@commitlint/config-conventional": "^21.2.0",
49
+ "@commitlint/types": "^21.2.0",
50
50
  "es-toolkit": "^1.49.0",
51
51
  "type-fest": "^5.7.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@arethetypeswrong/core": "^0.18.4",
55
- "@commitlint/cli": "^21.1.0",
55
+ "@commitlint/cli": "^21.2.0",
56
56
  "@types/node": "^26.0.1",
57
57
  "knip": "^6.23.0",
58
58
  "markdown-toc": "^1.2.0",
59
59
  "oxfmt": "^0.57.0",
60
60
  "oxlint": "^1.72.0",
61
- "oxlint-tsgolint": "^0.23.0",
61
+ "oxlint-tsgolint": "^0.24.0",
62
62
  "publint": "^0.3.21",
63
63
  "release-it": "^20.2.1",
64
64
  "tsdown": "^0.22.3",
@@ -66,6 +66,7 @@
66
66
  "vitest": "^4.1.9"
67
67
  },
68
68
  "peerDependencies": {
69
+ "@commitlint/config-conventional": "^21.0.0",
69
70
  "typescript": "^6.0.0"
70
71
  }
71
72
  }