@adamhl8/configs 0.23.9 → 0.24.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 +40 -0
- package/dist/configs/knip.base.d.ts +1 -1
- package/dist/configs/knip.base.js +1 -1
- package/dist/configs/knip.base.js.map +1 -1
- package/dist/configs/oxlint.base.d.ts +4 -0
- package/dist/configs/oxlint.base.d.ts.map +1 -1
- package/dist/configs/oxlint.base.js +4 -0
- package/dist/configs/oxlint.base.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -55,6 +55,46 @@ const config = vitestConfig({ ... })
|
|
|
55
55
|
export default defineConfig(config)
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## GitHub Actions
|
|
59
|
+
|
|
60
|
+
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).
|
|
61
|
+
|
|
62
|
+
- `ci.yml`: runs `bundle` (build + lint) on pushes/PRs and lints commit messages with commitlint
|
|
63
|
+
- `update-deps.yml`: weekly `bump-deps` run that opens a dependency-update PR
|
|
64
|
+
|
|
65
|
+
Reference `@main` for latest, or pin to a release tag or commit SHA to update deliberately.
|
|
66
|
+
|
|
67
|
+
### CI
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# .github/workflows/ci.yml
|
|
71
|
+
name: CI
|
|
72
|
+
on:
|
|
73
|
+
push:
|
|
74
|
+
branches: [main]
|
|
75
|
+
pull_request:
|
|
76
|
+
jobs:
|
|
77
|
+
ci:
|
|
78
|
+
uses: adamhl8/configs/.github/workflows/ci.yml@main
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Update dependencies
|
|
82
|
+
|
|
83
|
+
Requires a `CI_TOKEN` repo secret (a PAT with `contents` and `pull-requests` write) so the opened PR triggers the CI workflow.
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
# .github/workflows/update-deps.yml
|
|
87
|
+
name: Update dependencies
|
|
88
|
+
on:
|
|
89
|
+
schedule:
|
|
90
|
+
- cron: "0 13 * * 5" # Fridays, 13:00 UTC
|
|
91
|
+
workflow_dispatch: {}
|
|
92
|
+
jobs:
|
|
93
|
+
update-deps:
|
|
94
|
+
uses: adamhl8/configs/.github/workflows/update-deps.yml@main
|
|
95
|
+
secrets: inherit
|
|
96
|
+
```
|
|
97
|
+
|
|
58
98
|
## Notes
|
|
59
99
|
|
|
60
100
|
The `prepare` script looks like: `"prepare": "lefthook install && nub ./patch-knip.ts && tsdown"`
|
|
@@ -6,7 +6,7 @@ declare const baseConfig: {
|
|
|
6
6
|
readonly project: ["**"];
|
|
7
7
|
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
8
8
|
readonly ignoreBinaries: ["lefthook"];
|
|
9
|
-
readonly ignoreDependencies:
|
|
9
|
+
readonly ignoreDependencies: string[];
|
|
10
10
|
readonly tsdown: false;
|
|
11
11
|
};
|
|
12
12
|
declare const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig>;
|
|
@@ -10,7 +10,7 @@ const knipConfig = createMergeConfigFn({
|
|
|
10
10
|
project: ["**"],
|
|
11
11
|
entry: DEFAULT_ENTRIES,
|
|
12
12
|
ignoreBinaries: ["lefthook"],
|
|
13
|
-
ignoreDependencies: [
|
|
13
|
+
ignoreDependencies: [...IGNORE_DEPENDENCIES_UNLISTED],
|
|
14
14
|
tsdown: false
|
|
15
15
|
});
|
|
16
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport
|
|
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"}
|
|
@@ -12,6 +12,7 @@ declare const baseConfig: {
|
|
|
12
12
|
readonly style: "error";
|
|
13
13
|
readonly suspicious: "error";
|
|
14
14
|
};
|
|
15
|
+
readonly jsPlugins: ["@adamhl8/eslint-plugin-clean-modules"];
|
|
15
16
|
readonly options: {
|
|
16
17
|
readonly reportUnusedDisableDirectives: "error";
|
|
17
18
|
readonly typeAware: true;
|
|
@@ -25,6 +26,9 @@ declare const baseConfig: {
|
|
|
25
26
|
}];
|
|
26
27
|
readonly plugins: ["eslint", "react", "unicorn", "typescript", "oxc", "import", "jsdoc", "vitest", "jsx-a11y", "react-perf", "promise", "node"];
|
|
27
28
|
readonly rules: {
|
|
29
|
+
readonly "clean-modules/require-direct-exports": "error";
|
|
30
|
+
readonly "clean-modules/require-import-extensions": "error";
|
|
31
|
+
readonly "clean-modules/require-subpath-imports": "error";
|
|
28
32
|
readonly curly: ["error", "multi-or-nest"];
|
|
29
33
|
readonly "func-style": ["error", "expression"];
|
|
30
34
|
readonly "require-unicode-regexp": ["error", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;;cAKM,UAAA;EAAA
|
|
1
|
+
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;;cAKM,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GO,YAAA,EAAc,qBAAA,CAAsB,YAAA,SAAqB,UAAA"}
|
|
@@ -9,6 +9,7 @@ const oxlintConfig = createMergeConfigFn({
|
|
|
9
9
|
style: "error",
|
|
10
10
|
suspicious: "error"
|
|
11
11
|
},
|
|
12
|
+
jsPlugins: ["@adamhl8/eslint-plugin-clean-modules"],
|
|
12
13
|
options: {
|
|
13
14
|
reportUnusedDisableDirectives: "error",
|
|
14
15
|
typeAware: true,
|
|
@@ -41,6 +42,9 @@ const oxlintConfig = createMergeConfigFn({
|
|
|
41
42
|
"node"
|
|
42
43
|
],
|
|
43
44
|
rules: {
|
|
45
|
+
"clean-modules/require-direct-exports": "error",
|
|
46
|
+
"clean-modules/require-import-extensions": "error",
|
|
47
|
+
"clean-modules/require-subpath-imports": "error",
|
|
44
48
|
curly: ["error", "multi-or-nest"],
|
|
45
49
|
"func-style": ["error", "expression"],
|
|
46
50
|
"require-unicode-regexp": ["error", { requireFlag: "v" }],
|
|
@@ -1 +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: [\n \".release-it.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"tsdown.config.ts\",\n \"vitest.config.ts\",\n ],\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 \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\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 \"init-declarations\": \"off\",\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"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-plusplus\": \"off\",\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"node/callback-return\": \"off\",\n \"node/no-sync\": \"off\",\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n \"typescript/consistent-return\": \"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 \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nexport const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";
|
|
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 jsPlugins: [\"@adamhl8/eslint-plugin-clean-modules\"],\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"tsdown.config.ts\",\n \"vitest.config.ts\",\n ],\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 \"clean-modules/require-direct-exports\": \"error\",\n \"clean-modules/require-import-extensions\": \"error\",\n \"clean-modules/require-subpath-imports\": \"error\",\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\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 \"init-declarations\": \"off\",\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"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-plusplus\": \"off\",\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"node/callback-return\": \"off\",\n \"node/no-sync\": \"off\",\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n \"typescript/consistent-return\": \"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 \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nexport const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AA+GA,MAAa,eAAuE,oBAAoB;CAzGtG,YAAY;EACV,aAAa;EACb,SAAS;EACT,UAAU;EACV,MAAM;EACN,aAAa;EACb,OAAO;EACP,YAAY;CACd;CACA,WAAW,CAAC,sCAAsC;CAClD,SAAS;EACP,+BAA+B;EAC/B,WAAW;EACX,WAAW;CACb;CACA,WAAW,CACT;EACE,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO,EACL,4BAA4B,MAC9B;CACF,CACF;CACA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,OAAO;EACL,wCAAwC;EACxC,2CAA2C;EAC3C,yCAAyC;EAEzC,OAAO,CAAC,SAAS,eAAe;EAChC,cAAc,CAAC,SAAS,YAAY;EACpC,0BAA0B,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC;EAExD,wBAAwB;EACxB,aAAa;EACb,uBAAuB;EACvB,wBAAwB;EACxB,0BAA0B;EAC1B,4BAA4B;EAC5B,gCAAgC;EAChC,qBAAqB;EACrB,uBAAuB;EACvB,yBAAyB;EACzB,wBAAwB;EACxB,aAAa;EACb,0BAA0B;EAC1B,kBAAkB;EAClB,cAAc;EACd,eAAe;EACf,wBAAwB;EACxB,sBAAsB;EACtB,oBAAoB;EACpB,eAAe;EACf,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,wBAAwB;EACxB,gBAAgB;EAChB,sBAAsB;EACtB,4BAA4B;EAC5B,iCAAiC;EACjC,gBAAgB;EAChB,aAAa;EACb,gCAAgC;EAChC,4CAA4C;EAC5C,6CAA6C;EAC7C,8CAA8C;EAC9C,yCAAyC;EACzC,uCAAuC;EACvC,yCAAyC;EACzC,8BAA8B;EAC9B,mBAAmB;EACnB,sCAAsC;EACtC,yCAAyC;EACzC,mCAAmC;EACnC,iCAAiC;EACjC,6BAA6B;EAC7B,8BAA8B;EAC9B,uBAAuB;EACvB,+BAA+B;CACjC;AAGsG,CAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"homepage": "https://github.com/adamhl8/configs",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/adamhl8/configs/issues"
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"lint": "markdown-toc -i --bullets '-' --maxdepth 3 ./README.md && oxfmt && oxlint --fix --fix-suggestions --fix-dangerously && adamhl8-knip",
|
|
41
|
-
"bump-deps": "nub update -L && rm -f lock.yaml && nub i && oxfmt lock.yaml",
|
|
41
|
+
"bump-deps": "nub update -L && rm -f lock.yaml && nub i --no-frozen-lockfile && oxfmt lock.yaml",
|
|
42
42
|
"bundle": "nub run lint && tsdown",
|
|
43
43
|
"release": "release-it --ci -i \"$(adamhl8-cliff --bumped-version)\"",
|
|
44
44
|
"prepare": "lefthook install && nub ./patch-knip.ts && tsdown"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@adamhl8/eslint-plugin-clean-modules": "^0.1.1",
|
|
47
48
|
"@commitlint/config-conventional": "^21.1.0",
|
|
48
49
|
"@commitlint/types": "^21.1.0",
|
|
49
50
|
"es-toolkit": "^1.49.0",
|
|
@@ -55,8 +56,8 @@
|
|
|
55
56
|
"@types/node": "^26.0.1",
|
|
56
57
|
"knip": "^6.23.0",
|
|
57
58
|
"markdown-toc": "^1.2.0",
|
|
58
|
-
"oxfmt": "^0.
|
|
59
|
-
"oxlint": "^1.
|
|
59
|
+
"oxfmt": "^0.57.0",
|
|
60
|
+
"oxlint": "^1.72.0",
|
|
60
61
|
"oxlint-tsgolint": "^0.23.0",
|
|
61
62
|
"publint": "^0.3.21",
|
|
62
63
|
"release-it": "^20.2.1",
|