@adamhl8/configs 4.1.1 → 4.1.2
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 +2 -2
- package/dist/configs/knip.base.js.map +1 -1
- package/dist/configs/oxlint.base.js.map +1 -1
- package/dist/dep-report/dep-report.js +8 -1
- package/dist/dep-report/dep-report.js.map +1 -1
- package/dist/dep-report/prompt.md +1 -1
- package/dist/env/utils.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/test-utils/index.d.ts +2 -2
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/shell/command.js.map +1 -1
- package/dist/test-utils/shell/shell.d.ts +1 -3
- package/dist/test-utils/shell/shell.js +1 -2
- package/dist/test-utils/shell/shell.js.map +1 -1
- package/package.json +14 -14
- package/dist/configs/configs.d.ts +0 -7
- package/dist/configs/configs.js +0 -7
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ The base turns on every rule category as an error, with type-aware linting and t
|
|
|
158
158
|
- When the project depends on `react`: [react-web-api](https://github.com/Rel1cx/eslint-react) and [react-you-might-not-need-an-effect](https://github.com/nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect)
|
|
159
159
|
- When the project has a Tailwind stylesheet: [oxlint-tailwindcss](https://github.com/sergioazoc/oxlint-tailwindcss)
|
|
160
160
|
|
|
161
|
-
package-boundaries is off for tests, in `__tests__` dirs and `*.test.ts` files,
|
|
161
|
+
package-boundaries is off for tests, in `__tests__` dirs and `*.test.ts` files. A test may import code that uses the package it's in, and nothing imports a test, so it can't start a cycle.
|
|
162
162
|
|
|
163
163
|
The plugins are loaded from `@adamhl8/configs`'s own dependencies, so the project doesn't install them. In a project whose `package.json` has `engines.node`, the bunisms rules are off in `src/` (except in tests), because that code runs on Node.
|
|
164
164
|
|
|
@@ -180,7 +180,7 @@ The base leaves `fixtures` and `fixture` dirs out of the analysis, at any depth.
|
|
|
180
180
|
`knipConfig` returns a function, because knip passes it the CLI arguments. The `lint` task runs knip twice:
|
|
181
181
|
|
|
182
182
|
- `knip` checks everything, tests included.
|
|
183
|
-
- `knip --production` leaves out tests and devDependencies. It reports an export that only tests use,
|
|
183
|
+
- `knip --production` leaves out tests and devDependencies. It reports an export that only tests use, unless its own module uses it too, so a test can still import it from that module. It reports a package in `dependencies` that only tests import, because that belongs in `devDependencies`. It also leaves `__tests__` dirs out, and skips binaries, because dev tools come from devDependencies.
|
|
184
184
|
|
|
185
185
|
The production run starts from the entries marked with a trailing `!`. The base tsconfig's `outDir` lets knip map the `dist/` files in `package.json`'s `main`, `bin`, and `exports` back to `src/`, so those count without any marking. knip's default entries (`index`, `cli`, and `main`, at the root or in `src/`) are marked too. A project's own top-level `entry` replaces knip's default entries. So mark each runtime entry the project lists, like `entry: ["src/server.ts!"]`. An entry without the `!`, like a script or a test that runs by path, counts only in the plain run.
|
|
186
186
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig, KnipConfiguration } from \"knip\"\n\nimport type { ArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\ntype KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0]\n\n/**\n * The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every\n * option. Export it so a project's `knip.ts` can name it in its declarations.\n */\n// oxlint-disable-next-line typescript/no-empty-interface, typescript/no-empty-object-type - name knip's CLI args so a hover shows the name, not every option\nexport interface KnipArgs extends KnipCliArgs {}\n\n/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */\nconst createBaseConfig = ({ production }: KnipArgs) => {\n const isProduction = production === true\n return {\n // Mark `**/*` with `!`, because `knip --production` only reads marked patterns.\n // Mark the `__tests__` exclusion too, so it applies only to the production run.\n // Exclude fixtures with negated `project` globs because knip hints to remove an `ignore` glob that hides nothing.\n project: [\"**/*!\", \"!**/__tests__/**!\", \"!**/fixtures/**\", \"!**/fixture/**\"],\n bun: {\n // List `bask.ts` because bask loads it by path and nothing imports it.\n // Add it here because a top-level `entry` replaces knip's default entries.\n entry: [\"**/*.test.ts\", \"bask.ts\"],\n },\n // Keep an export that its own module uses, so a test can import it from that module.\n //
|
|
1
|
+
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig, KnipConfiguration } from \"knip\"\n\nimport type { ArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\ntype KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0]\n\n/**\n * The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every\n * option. Export it so a project's `knip.ts` can name it in its declarations.\n */\n// oxlint-disable-next-line typescript/no-empty-interface, typescript/no-empty-object-type - name knip's CLI args so a hover shows the name, not every option\nexport interface KnipArgs extends KnipCliArgs {}\n\n/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */\nconst createBaseConfig = ({ production }: KnipArgs) => {\n const isProduction = production === true\n return {\n // Mark `**/*` with `!`, because `knip --production` only reads marked patterns.\n // Mark the `__tests__` exclusion too, so it applies only to the production run.\n // Exclude fixtures with negated `project` globs because knip hints to remove an `ignore` glob that hides nothing.\n project: [\"**/*!\", \"!**/__tests__/**!\", \"!**/fixtures/**\", \"!**/fixture/**\"],\n bun: {\n // List `bask.ts` because bask loads it by path and nothing imports it.\n // Add it here because a top-level `entry` replaces knip's default entries.\n entry: [\"**/*.test.ts\", \"bask.ts\"],\n },\n // Keep an export that its own module uses, so a test can import it from that module.\n // Any other export that only tests use still shows up.\n ignoreExportsUsedInFile: isProduction,\n // Skip binaries in the production run, because it ignores devDependencies and reports the dev tools that configs run.\n // Mark each branch `as const`, because the outer `as const` doesn't reach into a conditional.\n exclude: isProduction ? ([\"binaries\"] as const) : ([] as const),\n } as const satisfies KnipConfiguration\n}\n\ntype BaseConfig = ReturnType<typeof createBaseConfig>\n\n// Return the config as a function, because knip calls it with its CLI arguments and the production run needs its own settings.\n// Annotate the export so the published types name knip's types instead of spelling them out.\nexport const knipConfig: ArgsMergeConfigFn<KnipConfiguration, BaseConfig, KnipArgs> = createArgsMergeConfigFn<\n KnipConfiguration,\n BaseConfig,\n KnipArgs\n>(createBaseConfig)\n"],"mappings":";;;AAeA,MAAM,oBAAoB,EAAE,iBAA2B;CACrD,MAAM,eAAe,eAAe;CACpC,OAAO;EAIL,SAAS;GAAC;GAAS;GAAqB;GAAmB;EAAgB;EAC3E,KAAK,EAGH,OAAO,CAAC,gBAAgB,SAAS,EACnC;EAGA,yBAAyB;EAGzB,SAAS,eAAgB,CAAC,UAAU,IAAe,CAAC;CACtD;AACF;AAMA,MAAa,aAAyE,wBAIpF,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.js","names":["directiveCommentsPluginRules","regexpPluginRules"],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import cleanModulesPlugin from \"@adamhl8/oxlint-plugin-clean-modules\"\nimport packageBoundariesPlugin from \"@adamhl8/oxlint-plugin-package-boundaries\"\nimport e18ePlugin from \"@e18e/eslint-plugin\"\nimport bunismsPlugin from \"eslint-plugin-bunisms\"\nimport honoPlugin from \"eslint-plugin-hono\"\nimport reactWebApiPlugin from \"eslint-plugin-react-web-api\"\nimport reactEffectPlugin from \"eslint-plugin-react-you-might-not-need-an-effect\"\nimport { rules as regexpPluginRules } from \"eslint-plugin-regexp\"\nimport type { DummyRule, OxlintConfig, OxlintOverride } from \"oxlint\"\nimport { rules as directiveCommentsPluginRules } from \"oxlint-plugin-directive-comments\"\nimport tailwindcssPlugin from \"oxlint-tailwindcss\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from \"#utils.ts\"\n\n/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */\nconst setAllPluginRules = (name: string, rules: Record<string, unknown>, severity: \"error\" | \"off\") =>\n Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity] as const))\n\n// Type plugin rules with oxlint's generic `DummyRule` because its per-rule config types aren't exported, which breaks declaration emit.\ntype PluginRules = Record<string, DummyRule>\n\n/** A JS plugin and the slice of oxlint config that goes with it. Each one is merged into the base config. */\ninterface PluginPart extends Omit<OxlintConfig, \"jsPlugins\" | \"overrides\" | \"rules\"> {\n overrides?: (Omit<OxlintOverride, \"rules\"> & { rules?: PluginRules })[]\n rules?: PluginRules\n /** Loads the plugin only when true. Defaults to true. */\n enabled?: boolean\n package: string\n /** The plugin's rule definitions, used to set every rule to \"error\". The part's own `rules` then take precedence. */\n pluginRules: Record<string, unknown> | undefined\n}\n\nconst { dependencies, engines } = readProjectPackageJson()\nconst tailwindStylesheet = resolveProjectTailwind()\n\n// Key each part by the rule namespace its plugin registers.\nconst plugins: Record<string, PluginPart> = {\n bunisms: {\n overrides: [\n {\n excludeFiles: [\"src/**/__tests__/**\", \"src/**/*.test.{ts,tsx}\", \"src/**/test-setup.ts\", \"src/**/test-utils.ts\"],\n // Turn off Bun suggestions in Node runtime code. Tests and tooling still run on Bun.\n files: engines.has(\"node\") ? [\"src/**\"] : [],\n rules: setAllPluginRules(\"bunisms\", bunismsPlugin.rules, \"off\"),\n },\n ],\n package: \"eslint-plugin-bunisms\",\n pluginRules: bunismsPlugin.rules,\n rules: {\n \"bunisms/prefer-mock-restore-in-after-each\": \"off\", // `test-setup.ts` preloads restore mocks globally\n },\n },\n \"clean-modules\": {\n package: \"@adamhl8/oxlint-plugin-clean-modules\",\n pluginRules: cleanModulesPlugin.rules,\n },\n \"directive-comments\": {\n package: \"oxlint-plugin-directive-comments\",\n pluginRules: directiveCommentsPluginRules,\n rules: {\n \"directive-comments/disable-enable-pair\": [\"error\", { allowWholeFile: true }],\n \"directive-comments/no-use\": \"off\", // bans every directive comment\n },\n },\n e18e: {\n package: \"@e18e/eslint-plugin\",\n pluginRules: e18ePlugin.rules,\n rules: {\n \"e18e/no-indexof-equality\": \"off\", // needs type information, which JS plugins don't get\n \"e18e/no-spread-in-reduce\": \"off\", // `oxc/no-accumulating-spread` covers this\n \"e18e/prefer-array-at\": \"off\", // `unicorn/prefer-at` covers this\n \"e18e/prefer-array-some\": \"off\", // `unicorn/prefer-array-some` covers this\n \"e18e/prefer-array-to-reversed\": \"off\", // `unicorn/no-array-reverse` covers this\n \"e18e/prefer-array-to-sorted\": \"off\", // `unicorn/no-array-sort` covers this\n \"e18e/prefer-date-now\": \"off\", // `unicorn/prefer-date-now` covers this\n \"e18e/prefer-exponentiation-operator\": \"off\", // `prefer-exponentiation-operator` covers this\n \"e18e/prefer-flatmap-over-map-flat\": \"off\", // `unicorn/prefer-array-flat-map` covers this\n \"e18e/prefer-includes\": \"off\", // `unicorn/prefer-includes` covers this\n \"e18e/prefer-nullish-coalescing\": \"off\", // `typescript/prefer-nullish-coalescing` covers this\n \"e18e/prefer-object-has-own\": \"off\", // `prefer-object-has-own` covers this\n \"e18e/prefer-slice-over-split-index\": \"off\",\n \"e18e/prefer-spread-syntax\": \"off\", // `unicorn/prefer-spread` and `prefer-object-spread` cover this\n },\n },\n hono: {\n enabled: dependencies.has(\"hono\"),\n package: \"eslint-plugin-hono\",\n pluginRules: honoPlugin.rules,\n rules: {\n \"hono/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n },\n },\n \"package-boundaries\": {\n overrides: [\n {\n files: [\"**/__tests__/**\", \"**/*.test.{ts,tsx}\"],\n // Let a test import any module, because it checks a package's internals, not only its public surface.\n rules: setAllPluginRules(\"package-boundaries\", packageBoundariesPlugin.rules, \"off\"),\n },\n ],\n package: \"@adamhl8/oxlint-plugin-package-boundaries\",\n pluginRules: packageBoundariesPlugin.rules,\n },\n \"react-web-api\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-web-api\",\n pluginRules: reactWebApiPlugin.rules,\n },\n \"react-you-might-not-need-an-effect\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-you-might-not-need-an-effect\",\n pluginRules: reactEffectPlugin.rules,\n rules: {\n \"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-chain-state-updates\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-derived-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-initialize-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n },\n },\n regexp: {\n package: \"eslint-plugin-regexp\",\n pluginRules: regexpPluginRules,\n rules: {\n \"regexp/letter-case\": [\"error\", { hexadecimalEscape: \"uppercase\", unicodeEscape: \"uppercase\" }], // match `unicorn/escape-case`\n \"regexp/no-control-character\": \"off\", // `no-control-regex` covers this\n \"regexp/no-empty-character-class\": \"off\", // `no-empty-character-class` covers this\n \"regexp/no-invalid-regexp\": \"off\", // `no-invalid-regexp` covers this\n \"regexp/no-super-linear-move\": \"off\",\n \"regexp/no-useless-escape\": \"off\", // `no-useless-escape` covers this\n \"regexp/prefer-named-capture-group\": \"off\", // `prefer-named-capture-group` covers this\n \"regexp/require-unicode-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/require-unicode-sets-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/sort-alternatives\": \"off\",\n },\n },\n tailwindcss: {\n // Load the Tailwind plugin only with a stylesheet because it reports every class string without one.\n enabled: Boolean(tailwindStylesheet),\n package: \"oxlint-tailwindcss\",\n pluginRules: tailwindcssPlugin.rules,\n rules: {\n \"tailwindcss/enforce-consistent-line-wrapping\": \"off\", // oxfmt handles line width\n \"tailwindcss/enforce-logical\": \"off\", // conflicts with `tailwindcss/enforce-physical`\n \"tailwindcss/enforce-sort-order\": \"off\", // oxfmt sorts classes\n \"tailwindcss/max-class-count\": \"off\",\n },\n // Keep `entryPoint` relative because the plugin resolves it against the directory of the project's oxlint config.\n settings: { tailwindcss: { entryPoint: tailwindStylesheet } },\n },\n}\n\nconst nativeConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n // Leave `typeCheck` off because `bask lint` runs `tsc`, which also reports declaration errors.\n typeCheck: false,\n },\n\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\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\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"declaration\", { allowArrowFunctions: true }],\n },\n },\n {\n files: [\"**/fixtures/**\", \"**/fixture/**\"],\n rules: {\n \"clean-modules/require-import-extensions\": \"off\",\n \"clean-modules/require-subpath-imports\": \"off\",\n \"import/no-default-export\": \"off\",\n },\n },\n ],\n\n rules: {\n /* Modified rules */\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"function-declaration\", unnamedComponents: \"arrow-function\" },\n ],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n /* Disabled rules */\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"init-declarations\": \"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-regex-spaces\": \"off\", // `regexp/prefer-quantifier` covers this\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"one-var\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n\n \"node/callback-return\": \"off\",\n \"node/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n\n \"react/exhaustive-effect-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/forbid-component-props\": \"off\",\n \"react/hooks\": \"off\", // `react/rules-of-hooks` covers this\n \"react/invariant\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/memo-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/no-deriving-state-in-effects\": \"off\", // `react/set-state-in-effect` covers this\n \"react/react-in-jsx-scope\": \"off\",\n \"react/rule-suppression\": \"off\",\n \"react/todo\": \"off\",\n\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\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n\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-importing-vitest-globals\": \"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\nconst enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true)\nconst enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin)\n// Resolve JS plugins to absolute paths so consumers load them from this package's own deps.\nconst resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package))\nconst pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? [])\nconst pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})))\n\n/** Lists a plugin's rules as entries */\nconst toPluginRuleEntries = ([name, { pluginRules = {}, rules }]: [string, PluginPart]) => {\n const defaultRules = setAllPluginRules(name, pluginRules, \"error\")\n const pluginRuleEntries = Object.entries({ ...defaultRules, ...rules })\n return pluginRuleEntries\n}\n\nconst resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries))\n\nconst baseConfig = {\n ...nativeConfig,\n jsPlugins: resolvedPluginPackages,\n overrides: [...nativeConfig.overrides, ...pluginOverrides],\n rules: {\n ...resolvedPluginRules,\n ...nativeConfig.rules,\n },\n settings: pluginSettings,\n} satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,qBAAqB,MAAc,OAAgC,aACvE,OAAO,YAAY,OAAO,KAAK,KAAK,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,KAAK,GAAG,QAAQ,QAAQ,CAAU,CAAC;AAgB7F,MAAM,EAAE,cAAc,YAAY,uBAAuB;AACzD,MAAM,qBAAqB,uBAAuB;AAGlD,MAAM,UAAsC;CAC1C,SAAS;EACP,WAAW,CACT;GACE,cAAc;IAAC;IAAuB;IAA0B;IAAwB;GAAsB;GAE9G,OAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC;GAC3C,OAAO,kBAAkB,WAAW,cAAc,OAAO,KAAK;EAChE,CACF;EACA,SAAS;EACT,aAAa,cAAc;EAC3B,OAAO,EACL,6CAA6C,MAC/C;CACF;CACA,iBAAiB;EACf,SAAS;EACT,aAAa,mBAAmB;CAClC;CACA,sBAAsB;EACpB,SAAS;EACT,aAAaA;EACb,OAAO;GACL,0CAA0C,CAAC,SAAS,EAAE,gBAAgB,KAAK,CAAC;GAC5E,6BAA6B;EAC/B;CACF;CACA,MAAM;EACJ,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AS,WAAW,OAAO,QAAQ,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;;AAGnH,MAAM,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,aAAmC;CACzF,MAAM,eAAe,kBAAkB,MAAM,aAAa,OAAO;CAEjE,OAD0B,OAAO,QAAQ;EAAE,GAAG;EAAc,GAAG;CAAM,CAC9C;AACzB;AAEA,MAAM,sBAAsB,OAAO,YAAY,qBAAqB,QAAQ,mBAAmB,CAAC;AAEhG,MAAM,aAAa;CACjB,GAAG;CACH,WAAW;CACX,WAAW,CAAC,GAAG,aAAa,WAAW,GAAG,eAAe;CACzD,OAAO;EACL,GAAG;EACH,GAAG,aAAa;CAClB;CACA,UAAU;AACZ;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
|
|
1
|
+
{"version":3,"file":"oxlint.base.js","names":["directiveCommentsPluginRules","regexpPluginRules"],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import cleanModulesPlugin from \"@adamhl8/oxlint-plugin-clean-modules\"\nimport packageBoundariesPlugin from \"@adamhl8/oxlint-plugin-package-boundaries\"\nimport e18ePlugin from \"@e18e/eslint-plugin\"\nimport bunismsPlugin from \"eslint-plugin-bunisms\"\nimport honoPlugin from \"eslint-plugin-hono\"\nimport reactWebApiPlugin from \"eslint-plugin-react-web-api\"\nimport reactEffectPlugin from \"eslint-plugin-react-you-might-not-need-an-effect\"\nimport { rules as regexpPluginRules } from \"eslint-plugin-regexp\"\nimport type { DummyRule, OxlintConfig, OxlintOverride } from \"oxlint\"\nimport { rules as directiveCommentsPluginRules } from \"oxlint-plugin-directive-comments\"\nimport tailwindcssPlugin from \"oxlint-tailwindcss\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from \"#utils.ts\"\n\n/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */\nconst setAllPluginRules = (name: string, rules: Record<string, unknown>, severity: \"error\" | \"off\") =>\n Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity] as const))\n\n// Type plugin rules with oxlint's generic `DummyRule` because its per-rule config types aren't exported, which breaks declaration emit.\ntype PluginRules = Record<string, DummyRule>\n\n/** A JS plugin and the slice of oxlint config that goes with it. Each one is merged into the base config. */\ninterface PluginPart extends Omit<OxlintConfig, \"jsPlugins\" | \"overrides\" | \"rules\"> {\n overrides?: (Omit<OxlintOverride, \"rules\"> & { rules?: PluginRules })[]\n rules?: PluginRules\n /** Loads the plugin only when true. Defaults to true. */\n enabled?: boolean\n package: string\n /** The plugin's rule definitions, used to set every rule to \"error\". The part's own `rules` then take precedence. */\n pluginRules: Record<string, unknown> | undefined\n}\n\nconst { dependencies, engines } = readProjectPackageJson()\nconst tailwindStylesheet = resolveProjectTailwind()\n\n// Key each part by the rule namespace its plugin registers.\nconst plugins: Record<string, PluginPart> = {\n bunisms: {\n overrides: [\n {\n excludeFiles: [\"src/**/__tests__/**\", \"src/**/*.test.{ts,tsx}\", \"src/**/test-setup.ts\", \"src/**/test-utils.ts\"],\n // Turn off Bun suggestions in Node runtime code. Tests and tooling still run on Bun.\n files: engines.has(\"node\") ? [\"src/**\"] : [],\n rules: setAllPluginRules(\"bunisms\", bunismsPlugin.rules, \"off\"),\n },\n ],\n package: \"eslint-plugin-bunisms\",\n pluginRules: bunismsPlugin.rules,\n rules: {\n \"bunisms/prefer-mock-restore-in-after-each\": \"off\", // `test-setup.ts` preloads restore mocks globally\n },\n },\n \"clean-modules\": {\n package: \"@adamhl8/oxlint-plugin-clean-modules\",\n pluginRules: cleanModulesPlugin.rules,\n },\n \"directive-comments\": {\n package: \"oxlint-plugin-directive-comments\",\n pluginRules: directiveCommentsPluginRules,\n rules: {\n \"directive-comments/disable-enable-pair\": [\"error\", { allowWholeFile: true }],\n \"directive-comments/no-use\": \"off\", // bans every directive comment\n },\n },\n e18e: {\n package: \"@e18e/eslint-plugin\",\n pluginRules: e18ePlugin.rules,\n rules: {\n \"e18e/no-indexof-equality\": \"off\", // needs type information, which JS plugins don't get\n \"e18e/no-spread-in-reduce\": \"off\", // `oxc/no-accumulating-spread` covers this\n \"e18e/prefer-array-at\": \"off\", // `unicorn/prefer-at` covers this\n \"e18e/prefer-array-some\": \"off\", // `unicorn/prefer-array-some` covers this\n \"e18e/prefer-array-to-reversed\": \"off\", // `unicorn/no-array-reverse` covers this\n \"e18e/prefer-array-to-sorted\": \"off\", // `unicorn/no-array-sort` covers this\n \"e18e/prefer-date-now\": \"off\", // `unicorn/prefer-date-now` covers this\n \"e18e/prefer-exponentiation-operator\": \"off\", // `prefer-exponentiation-operator` covers this\n \"e18e/prefer-flatmap-over-map-flat\": \"off\", // `unicorn/prefer-array-flat-map` covers this\n \"e18e/prefer-includes\": \"off\", // `unicorn/prefer-includes` covers this\n \"e18e/prefer-nullish-coalescing\": \"off\", // `typescript/prefer-nullish-coalescing` covers this\n \"e18e/prefer-object-has-own\": \"off\", // `prefer-object-has-own` covers this\n \"e18e/prefer-slice-over-split-index\": \"off\",\n \"e18e/prefer-spread-syntax\": \"off\", // `unicorn/prefer-spread` and `prefer-object-spread` cover this\n },\n },\n hono: {\n enabled: dependencies.has(\"hono\"),\n package: \"eslint-plugin-hono\",\n pluginRules: honoPlugin.rules,\n rules: {\n \"hono/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n },\n },\n \"package-boundaries\": {\n overrides: [\n {\n files: [\"**/__tests__/**\", \"**/*.test.{ts,tsx}\"],\n // Let a test import code that uses the package it's in.\n // Nothing imports a test, so it can't start a cycle.\n rules: setAllPluginRules(\"package-boundaries\", packageBoundariesPlugin.rules, \"off\"),\n },\n ],\n package: \"@adamhl8/oxlint-plugin-package-boundaries\",\n pluginRules: packageBoundariesPlugin.rules,\n },\n \"react-web-api\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-web-api\",\n pluginRules: reactWebApiPlugin.rules,\n },\n \"react-you-might-not-need-an-effect\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-you-might-not-need-an-effect\",\n pluginRules: reactEffectPlugin.rules,\n rules: {\n \"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-chain-state-updates\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-derived-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-initialize-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n },\n },\n regexp: {\n package: \"eslint-plugin-regexp\",\n pluginRules: regexpPluginRules,\n rules: {\n \"regexp/letter-case\": [\"error\", { hexadecimalEscape: \"uppercase\", unicodeEscape: \"uppercase\" }], // match `unicorn/escape-case`\n \"regexp/no-control-character\": \"off\", // `no-control-regex` covers this\n \"regexp/no-empty-character-class\": \"off\", // `no-empty-character-class` covers this\n \"regexp/no-invalid-regexp\": \"off\", // `no-invalid-regexp` covers this\n \"regexp/no-super-linear-move\": \"off\",\n \"regexp/no-useless-escape\": \"off\", // `no-useless-escape` covers this\n \"regexp/prefer-named-capture-group\": \"off\", // `prefer-named-capture-group` covers this\n \"regexp/require-unicode-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/require-unicode-sets-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/sort-alternatives\": \"off\",\n },\n },\n tailwindcss: {\n // Load the Tailwind plugin only with a stylesheet because it reports every class string without one.\n enabled: Boolean(tailwindStylesheet),\n package: \"oxlint-tailwindcss\",\n pluginRules: tailwindcssPlugin.rules,\n rules: {\n \"tailwindcss/enforce-consistent-line-wrapping\": \"off\", // oxfmt handles line width\n \"tailwindcss/enforce-logical\": \"off\", // conflicts with `tailwindcss/enforce-physical`\n \"tailwindcss/enforce-sort-order\": \"off\", // oxfmt sorts classes\n \"tailwindcss/max-class-count\": \"off\",\n },\n // Keep `entryPoint` relative because the plugin resolves it against the directory of the project's oxlint config.\n settings: { tailwindcss: { entryPoint: tailwindStylesheet } },\n },\n}\n\nconst nativeConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n // Leave `typeCheck` off because `bask lint` runs `tsc`, which also reports declaration errors.\n typeCheck: false,\n },\n\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\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\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"declaration\", { allowArrowFunctions: true }],\n },\n },\n {\n files: [\"**/fixtures/**\", \"**/fixture/**\"],\n rules: {\n \"clean-modules/require-import-extensions\": \"off\",\n \"clean-modules/require-subpath-imports\": \"off\",\n \"import/no-default-export\": \"off\",\n },\n },\n ],\n\n rules: {\n /* Modified rules */\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"function-declaration\", unnamedComponents: \"arrow-function\" },\n ],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n /* Disabled rules */\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"init-declarations\": \"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-regex-spaces\": \"off\", // `regexp/prefer-quantifier` covers this\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"one-var\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n\n \"node/callback-return\": \"off\",\n \"node/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n\n \"react/exhaustive-effect-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/forbid-component-props\": \"off\",\n \"react/hooks\": \"off\", // `react/rules-of-hooks` covers this\n \"react/invariant\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/memo-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/no-deriving-state-in-effects\": \"off\", // `react/set-state-in-effect` covers this\n \"react/react-in-jsx-scope\": \"off\",\n \"react/rule-suppression\": \"off\",\n \"react/todo\": \"off\",\n\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\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n\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-importing-vitest-globals\": \"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\nconst enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true)\nconst enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin)\n// Resolve JS plugins to absolute paths so consumers load them from this package's own deps.\nconst resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package))\nconst pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? [])\nconst pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})))\n\n/** Lists a plugin's rules as entries */\nconst toPluginRuleEntries = ([name, { pluginRules = {}, rules }]: [string, PluginPart]) => {\n const defaultRules = setAllPluginRules(name, pluginRules, \"error\")\n const pluginRuleEntries = Object.entries({ ...defaultRules, ...rules })\n return pluginRuleEntries\n}\n\nconst resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries))\n\nconst baseConfig = {\n ...nativeConfig,\n jsPlugins: resolvedPluginPackages,\n overrides: [...nativeConfig.overrides, ...pluginOverrides],\n rules: {\n ...resolvedPluginRules,\n ...nativeConfig.rules,\n },\n settings: pluginSettings,\n} satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,qBAAqB,MAAc,OAAgC,aACvE,OAAO,YAAY,OAAO,KAAK,KAAK,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,KAAK,GAAG,QAAQ,QAAQ,CAAU,CAAC;AAgB7F,MAAM,EAAE,cAAc,YAAY,uBAAuB;AACzD,MAAM,qBAAqB,uBAAuB;AAGlD,MAAM,UAAsC;CAC1C,SAAS;EACP,WAAW,CACT;GACE,cAAc;IAAC;IAAuB;IAA0B;IAAwB;GAAsB;GAE9G,OAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC;GAC3C,OAAO,kBAAkB,WAAW,cAAc,OAAO,KAAK;EAChE,CACF;EACA,SAAS;EACT,aAAa,cAAc;EAC3B,OAAO,EACL,6CAA6C,MAC/C;CACF;CACA,iBAAiB;EACf,SAAS;EACT,aAAa,mBAAmB;CAClC;CACA,sBAAsB;EACpB,SAAS;EACT,aAAaA;EACb,OAAO;GACL,0CAA0C,CAAC,SAAS,EAAE,gBAAgB,KAAK,CAAC;GAC5E,6BAA6B;EAC/B;CACF;CACA,MAAM;EACJ,SAAS;EACT,aAAa,WAAW;EACxB,OAAO;GACL,4BAA4B;GAC5B,4BAA4B;GAC5B,wBAAwB;GACxB,0BAA0B;GAC1B,iCAAi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AAC,GAAG,aAAmC;CACzF,MAAM,eAAe,kBAAkB,MAAM,aAAa,OAAO;CAEjE,OAD0B,OAAO,QAAQ;EAAE,GAAG;EAAc,GAAG;CAAM,CAC9C;AACzB;AAEA,MAAM,sBAAsB,OAAO,YAAY,qBAAqB,QAAQ,mBAAmB,CAAC;AAEhG,MAAM,aAAa;CACjB,GAAG;CACH,WAAW;CACX,WAAW,CAAC,GAAG,aAAa,WAAW,GAAG,eAAe;CACzD,OAAO;EACL,GAAG;EACH,GAAG,aAAa;CAClB;CACA,UAAU;AACZ;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
|
|
@@ -38,6 +38,12 @@ const isPatchOnlyChange = (oldRange, newRange) => {
|
|
|
38
38
|
const listRangeChanges = (before, after) => {
|
|
39
39
|
return [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].filter((key) => before.get(key) !== after.get(key) && !isPatchOnlyChange(before.get(key), after.get(key))).map((key) => `${key}: ${before.get(key) ?? "(none)"} -> ${after.get(key) ?? "(none)"}`);
|
|
40
40
|
};
|
|
41
|
+
/** Renders markdown for the terminal, with colors and clickable links when the output supports them. */
|
|
42
|
+
const renderMarkdown = (markdown) => Bun.markdown.ansi(markdown, {
|
|
43
|
+
colors: Bun.enableANSIColors,
|
|
44
|
+
hyperlinks: Bun.enableANSIColors,
|
|
45
|
+
columns: process.stdout.columns
|
|
46
|
+
}).trimEnd();
|
|
41
47
|
/**
|
|
42
48
|
* Snapshots the project's dependency ranges and loads the prompt. Returns a function that asks Claude Code to research
|
|
43
49
|
* the ranges that changed since the snapshot and prints its report. That function skips the report when nothing changed
|
|
@@ -61,7 +67,8 @@ const prepareDependencyReport = async () => {
|
|
|
61
67
|
console.log(`\nThe dependency report failed:\n${output.stderr.toString() || output.stdout.toString()}`);
|
|
62
68
|
return;
|
|
63
69
|
}
|
|
64
|
-
|
|
70
|
+
const rule = renderMarkdown("---");
|
|
71
|
+
console.log(`\n${rule}\n\n${renderMarkdown(parsed.result)}\n\n${rule}`);
|
|
65
72
|
const cost = parsed.total_cost_usd === void 0 ? "" : ` (cost: $${parsed.total_cost_usd.toFixed(2)})`;
|
|
66
73
|
console.log(`\nFollow up with: claude --resume ${parsed.session_id}${cost}`);
|
|
67
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep-report.js","names":[],"sources":["../../src/dep-report/dep-report.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\"\nimport { fileURLToPath } from \"node:url\"\n\nimport { $ } from \"bun\"\nimport { isPlainObject } from \"es-toolkit/predicate\"\nimport { difference, findMinimumForRange, tryParseRange } from \"verkit\"\n\nconst DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"] as const\n\n/** Reads every dependency range in the project's `package.json`, keyed by `<field> <name>`. */\nconst readDependencyRanges = () => {\n const packageJson: unknown = JSON.parse(readFileSync(\"package.json\", \"utf8\"))\n const fields = isPlainObject(packageJson) ? packageJson : {}\n\n const ranges = new Map<string, string>()\n for (const field of DEPENDENCY_FIELDS) {\n const dependencies: unknown = fields[field]\n if (!isPlainObject(dependencies)) continue\n for (const [name, range] of Object.entries(dependencies))\n if (typeof range === \"string\") ranges.set(`${field} ${name}`, range)\n }\n return ranges\n}\n\n/** Returns the lowest version a range allows, or nothing for a missing or non-semver range like `workspace:*`. */\nconst lowestVersion = (range: string | undefined) => {\n const parsedRange = range === undefined ? undefined : tryParseRange(range)\n return parsedRange ? findMinimumForRange(parsedRange) : undefined\n}\n\n/** Checks whether a range change only bumps the patch version of a 1.0+ package. */\nconst isPatchOnlyChange = (oldRange: string | undefined, newRange: string | undefined) => {\n const oldVersion = lowestVersion(oldRange)\n const newVersion = lowestVersion(newRange)\n if (!oldVersion || !newVersion) return false\n // Keep 0.x patch bumps because a 0.x patch release can add features or break things.\n return oldVersion.major > 0 && difference(oldVersion, newVersion) === \"patch\"\n}\n\n/** Lists each range that changed by more than a patch as `<field> <name>: <old> -> <new>`. */\nconst listRangeChanges = (before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>) => {\n const keys = new Set([...before.keys(), ...after.keys()])\n return [...keys]\n .filter((key) => before.get(key) !== after.get(key) && !isPatchOnlyChange(before.get(key), after.get(key)))\n .map((key) => `${key}: ${before.get(key) ?? \"(none)\"} -> ${after.get(key) ?? \"(none)\"}`)\n}\n\ninterface ClaudeResult {\n is_error: boolean\n result: string\n session_id: string\n total_cost_usd?: number\n}\n\n/**\n * Snapshots the project's dependency ranges and loads the prompt. Returns a function that asks Claude Code to research\n * the ranges that changed since the snapshot and prints its report. That function skips the report when nothing changed\n * or `claude` isn't installed.\n */\nexport const prepareDependencyReport = async () => {\n const rangesBefore = readDependencyRanges()\n // Read the prompt now because the reinstall can move this package to a new folder and delete the old one.\n const instructions = await Bun.file(fileURLToPath(new URL(\"prompt.md\", import.meta.url))).text()\n\n return async () => {\n const changes = listRangeChanges(rangesBefore, readDependencyRanges())\n if (changes.length === 0) return\n if (!Bun.which(\"claude\")) {\n console.log(\"\\nSkipping the dependency report because `claude` isn't installed.\")\n return\n }\n\n console.log(\"\\nAsking Claude to review the dependency changes. This takes a few minutes.\")\n const prompt = `${instructions}\\n${changes.join(\"\\n\")}\\n`\n\n // Use `auto` because the research runs commands that an allowlist can't predict.\n // Deny the file tools because the report must not change the project.\n const output =\n await $`claude -p ${prompt} --output-format json --permission-mode auto --disallowedTools Edit,Write,NotebookEdit --name ${\"bump-deps report\"}`\n .nothrow()\n .quiet()\n\n // Report a failure without throwing because the dependencies are already bumped.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `claude --output-format json` prints\n const parsed = output.exitCode === 0 ? (output.json() as ClaudeResult) : undefined\n if (!parsed || parsed.is_error) {\n console.log(`\\nThe dependency report failed:\\n${output.stderr.toString() || output.stdout.toString()}`)\n return\n }\n\n console.log(`\\n${parsed.result}`)\n const cost = parsed.total_cost_usd === undefined ? \"\" : ` (cost: $${parsed.total_cost_usd.toFixed(2)})`\n console.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M,MAAM,IAAI,GAAG,KAAK,UAAU;AAC3F;;;;;;
|
|
1
|
+
{"version":3,"file":"dep-report.js","names":[],"sources":["../../src/dep-report/dep-report.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\"\nimport { fileURLToPath } from \"node:url\"\n\nimport { $ } from \"bun\"\nimport { isPlainObject } from \"es-toolkit/predicate\"\nimport { difference, findMinimumForRange, tryParseRange } from \"verkit\"\n\nconst DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"] as const\n\n/** Reads every dependency range in the project's `package.json`, keyed by `<field> <name>`. */\nconst readDependencyRanges = () => {\n const packageJson: unknown = JSON.parse(readFileSync(\"package.json\", \"utf8\"))\n const fields = isPlainObject(packageJson) ? packageJson : {}\n\n const ranges = new Map<string, string>()\n for (const field of DEPENDENCY_FIELDS) {\n const dependencies: unknown = fields[field]\n if (!isPlainObject(dependencies)) continue\n for (const [name, range] of Object.entries(dependencies))\n if (typeof range === \"string\") ranges.set(`${field} ${name}`, range)\n }\n return ranges\n}\n\n/** Returns the lowest version a range allows, or nothing for a missing or non-semver range like `workspace:*`. */\nconst lowestVersion = (range: string | undefined) => {\n const parsedRange = range === undefined ? undefined : tryParseRange(range)\n return parsedRange ? findMinimumForRange(parsedRange) : undefined\n}\n\n/** Checks whether a range change only bumps the patch version of a 1.0+ package. */\nconst isPatchOnlyChange = (oldRange: string | undefined, newRange: string | undefined) => {\n const oldVersion = lowestVersion(oldRange)\n const newVersion = lowestVersion(newRange)\n if (!oldVersion || !newVersion) return false\n // Keep 0.x patch bumps because a 0.x patch release can add features or break things.\n return oldVersion.major > 0 && difference(oldVersion, newVersion) === \"patch\"\n}\n\n/** Lists each range that changed by more than a patch as `<field> <name>: <old> -> <new>`. */\nconst listRangeChanges = (before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>) => {\n const keys = new Set([...before.keys(), ...after.keys()])\n return [...keys]\n .filter((key) => before.get(key) !== after.get(key) && !isPatchOnlyChange(before.get(key), after.get(key)))\n .map((key) => `${key}: ${before.get(key) ?? \"(none)\"} -> ${after.get(key) ?? \"(none)\"}`)\n}\n\n/** Renders markdown for the terminal, with colors and clickable links when the output supports them. */\nconst renderMarkdown = (markdown: string) =>\n Bun.markdown\n .ansi(markdown, {\n colors: Bun.enableANSIColors,\n hyperlinks: Bun.enableANSIColors,\n // Leave `columns` undefined when piped so the renderer uses its default width.\n columns: process.stdout.columns,\n })\n .trimEnd()\n\ninterface ClaudeResult {\n is_error: boolean\n result: string\n session_id: string\n total_cost_usd?: number\n}\n\n/**\n * Snapshots the project's dependency ranges and loads the prompt. Returns a function that asks Claude Code to research\n * the ranges that changed since the snapshot and prints its report. That function skips the report when nothing changed\n * or `claude` isn't installed.\n */\nexport const prepareDependencyReport = async () => {\n const rangesBefore = readDependencyRanges()\n // Read the prompt now because the reinstall can move this package to a new folder and delete the old one.\n const instructions = await Bun.file(fileURLToPath(new URL(\"prompt.md\", import.meta.url))).text()\n\n return async () => {\n const changes = listRangeChanges(rangesBefore, readDependencyRanges())\n if (changes.length === 0) return\n if (!Bun.which(\"claude\")) {\n console.log(\"\\nSkipping the dependency report because `claude` isn't installed.\")\n return\n }\n\n console.log(\"\\nAsking Claude to review the dependency changes. This takes a few minutes.\")\n const prompt = `${instructions}\\n${changes.join(\"\\n\")}\\n`\n\n // Use `auto` because the research runs commands that an allowlist can't predict.\n // Deny the file tools because the report must not change the project.\n const output =\n await $`claude -p ${prompt} --output-format json --permission-mode auto --disallowedTools Edit,Write,NotebookEdit --name ${\"bump-deps report\"}`\n .nothrow()\n .quiet()\n\n // Report a failure without throwing because the dependencies are already bumped.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `claude --output-format json` prints\n const parsed = output.exitCode === 0 ? (output.json() as ClaudeResult) : undefined\n if (!parsed || parsed.is_error) {\n console.log(`\\nThe dependency report failed:\\n${output.stderr.toString() || output.stdout.toString()}`)\n return\n }\n\n // Render the rules on their own so an unclosed code fence in the report can't swallow them.\n const rule = renderMarkdown(\"---\")\n console.log(`\\n${rule}\\n\\n${renderMarkdown(parsed.result)}\\n\\n${rule}`)\n const cost = parsed.total_cost_usd === undefined ? \"\" : ` (cost: $${parsed.total_cost_usd.toFixed(2)})`\n console.log(`\\nFollow up with: claude --resume ${parsed.session_id}${cost}`)\n }\n}\n"],"mappings":";;;;;;AAOA,MAAM,oBAAoB;CAAC;CAAgB;CAAmB;CAAoB;AAAsB;;AAGxG,MAAM,6BAA6B;CACjC,MAAM,cAAuB,KAAK,MAAM,aAAa,gBAAgB,MAAM,CAAC;CAC5E,MAAM,SAAS,cAAc,WAAW,IAAI,cAAc,CAAC;CAE3D,MAAM,yBAAS,IAAI,IAAoB;CACvC,KAAK,MAAM,SAAS,mBAAmB;EACrC,MAAM,eAAwB,OAAO;EACrC,IAAI,CAAC,cAAc,YAAY,GAAG;EAClC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,YAAY,GACrD,IAAI,OAAO,UAAU,UAAU,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,KAAK;CACvE;CACA,OAAO;AACT;;AAGA,MAAM,iBAAiB,UAA8B;CACnD,MAAM,cAAc,UAAU,KAAA,IAAY,KAAA,IAAY,cAAc,KAAK;CACzE,OAAO,cAAc,oBAAoB,WAAW,IAAI,KAAA;AAC1D;;AAGA,MAAM,qBAAqB,UAA8B,aAAiC;CACxF,MAAM,aAAa,cAAc,QAAQ;CACzC,MAAM,aAAa,cAAc,QAAQ;CACzC,IAAI,CAAC,cAAc,CAAC,YAAY,OAAO;CAEvC,OAAO,WAAW,QAAQ,KAAK,WAAW,YAAY,UAAU,MAAM;AACxE;;AAGA,MAAM,oBAAoB,QAAqC,UAAuC;CAEpG,OAAO,CAAC,mBAAG,IADM,IAAI,CAAC,GAAG,OAAO,KAAK,GAAG,GAAG,MAAM,KAAK,CAAC,CACzC,CAAC,CAAC,CACb,QAAQ,QAAQ,OAAO,IAAI,GAAG,MAAM,MAAM,I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EAAE;EACrG,QAAQ,IAAI,qCAAqC,OAAO,aAAa,MAAM;CAC7E;AACF"}
|
|
@@ -17,7 +17,7 @@ Find anything in these updates that matters for this project, and report it. You
|
|
|
17
17
|
|
|
18
18
|
## Report
|
|
19
19
|
|
|
20
|
-
Write
|
|
20
|
+
Write GitHub-flavored markdown. The terminal renders it with colors, so headings, bold, inline code, links, and code blocks all work. Keep it skimmable with short headings and `-` bullets. Group findings under these headings and skip empty ones:
|
|
21
21
|
|
|
22
22
|
- Needs action: failing checks, or config that a bump breaks. Name the file and line, and say what to change. Say whether the linter's `--fix` would rewrite it, and whether that rewrite is safe.
|
|
23
23
|
- Worth knowing: new rules, options, or behavior that changes how the project's tools run, and new features the project might want to use.
|
package/dist/env/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":["type","arkenvType"],"sources":["../../src/env/utils.ts"],"sourcesContent":["import { type as arkenvType } from \"arkenv\"\nimport type { type as arktype } from \"arktype\"\n\n/**\n * Makes an env var required while `when` is true, otherwise optional.\n *\n * A set value must always satisfy `def`. An unset var takes `fallback` (exempt from `def` validation), or the key is\n * omitted entirely if no fallback is given.\n */\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n): ReturnType<arktype.instantiate<def>[\"optional\"]>\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n fallback: arktype.infer<def>,\n): arktype.instantiate<def>\n/* oxlint-disable typescript/no-unsafe-type-assertion - cast to the types the overload signatures declare */\nexport function requireWhen(when: boolean, type: unknown, ...rest: [unknown?]): never {\n const t = arkenvType.raw(type)\n if (when) return t as never\n if (rest.length === 0) return t.optional() as never\n const [fallback] = rest\n // defaulting to a sentinel keeps the fallback exempt from def validation without\n // letting an explicitly set value bypass it (env values can never be a symbol)\n const unset = Symbol(\"unset\")\n return t\n .or(arkenvType.unit(unset))\n .pipe((v: unknown) => (v === unset ? fallback : v))\n .default(unset as never) as never\n}\n/* oxlint-enable typescript/no-unsafe-type-assertion - limit the exemption to `requireWhen` */\n"],"mappings":";;AAmBA,SAAgB,YAAY,MAAeA,QAAe,GAAG,MAAyB;CACpF,MAAM,IAAIC,KAAW,IAAID,MAAI;CAC7B,IAAI,MAAM,OAAO;CACjB,IAAI,KAAK,WAAW,GAAG,OAAO,EAAE,SAAS;CACzC,MAAM,CAAC,YAAY;CAGnB,MAAM,QAAQ,OAAO,OAAO;CAC5B,OAAO,EACJ,GAAGC,KAAW,KAAK,KAAK,CAAC,CAAC,CAC1B,MAAM,MAAgB,MAAM,QAAQ,WAAW,CAAE,CAAC,CAClD,QAAQ,KAAc;AAC3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
|
4
4
|
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
5
5
|
import { releaseItConfig } from "./configs/release-it.base.js";
|
|
6
6
|
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
7
|
-
import "./configs/configs.js";
|
|
8
7
|
export { type KnipArgs, commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,4 @@ import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
|
4
4
|
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
5
5
|
import { releaseItConfig } from "./configs/release-it.base.js";
|
|
6
6
|
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
7
|
-
import "./configs/configs.js";
|
|
8
7
|
export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ShellCommand } from "./shell/command.js";
|
|
2
|
-
import { minimalEnv } from "./shell/env.js";
|
|
3
1
|
import { CopyFixtureOptions, copyFixture } from "./fixture.js";
|
|
4
2
|
import { packPackage } from "./pack.js";
|
|
3
|
+
import { ShellCommand } from "./shell/command.js";
|
|
4
|
+
import { minimalEnv } from "./shell/env.js";
|
|
5
5
|
import { Shell, ShellEnv, ShellOptions, ShellResult, createShell } from "./shell/shell.js";
|
|
6
6
|
import { makeTempDir } from "./temp-dir.js";
|
|
7
7
|
export { type CopyFixtureOptions, type Shell, type ShellCommand, type ShellEnv, type ShellOptions, type ShellResult, copyFixture, createShell, makeTempDir, minimalEnv, packPackage };
|
package/dist/test-utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { minimalEnv } from "./shell/env.js";
|
|
2
1
|
import { copyFixture } from "./fixture.js";
|
|
3
2
|
import { packPackage } from "./pack.js";
|
|
3
|
+
import { minimalEnv } from "./shell/env.js";
|
|
4
4
|
import { createShell } from "./shell/shell.js";
|
|
5
5
|
import { makeTempDir } from "./temp-dir.js";
|
|
6
6
|
export { copyFixture, createShell, makeTempDir, minimalEnv, packPackage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":[],"sources":["../../../src/test-utils/shell/command.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\nimport type { $ as BunShell } from \"bun\"\n\nimport { addBinDirs } from \"#test-utils/shell/bin-dirs.ts\"\nimport { removeNodeShims } from \"#test-utils/shell/node-shim.ts\"\nimport type { ShellEnv, ShellOptions, ShellResult } from \"#test-utils/shell/shell.ts\"\n\nconst FINAL_NEWLINE = /\\r?\\n$/v\n\nconst stripFinalNewline = (output: Buffer) => output.toString().replace(FINAL_NEWLINE, \"\")\n\n/** Wraps Bun's `ShellPromise` to apply its settings when it runs and return its output as strings. */\nexport class ShellCommand implements PromiseLike<ShellResult> {\n readonly #shellPromise: BunShell.ShellPromise\n readonly #settings: Required<ShellOptions>\n #result: Promise<ShellResult> | undefined\n\n /** Starts from the shell's settings, which the command's own methods can then override. */\n public constructor(shellPromise: BunShell.ShellPromise, settings: Required<ShellOptions>) {\n this.#shellPromise = shellPromise\n // Copy `settings` so this command's changes don't reach the shell.\n this.#settings = { ...settings }\n }\n\n /** Change the working directory for the command. Relative paths resolve against `process.cwd()`. */\n public cwd(newCwd: string) {\n this.#settings.cwd = newCwd\n return this\n }\n\n /** Add environment variables for the command, on top of the shell's. Set one to `undefined` to remove it. */\n public env(newEnv: ShellEnv) {\n this.#settings.env = { ...this.#settings.env, ...newEnv }\n return this\n }\n\n /** Configure whether the command puts `node_modules/.bin` of its cwd and each of its parents first on `PATH`. */\n public localBins(useLocalBins: boolean) {\n this.#settings.localBins = useLocalBins\n return this\n }\n\n /** Configure the command to not throw an exception on a non-zero exit code. */\n public nothrow() {\n this.#settings.throws = false\n return this\n }\n\n // oxlint-disable-next-line unicorn/no-thenable - awaiting a command runs it, like Bun's `ShellPromise`\n public async then<TResult1 = ShellResult, TResult2 = never>(\n onfulfilled?: ((value: ShellResult) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ) {\n // Keep the first run because Bun rejects settings on a command that already started.\n this.#result ??= this.#run()\n // oxlint-disable-next-line promise/prefer-catch - forward both handlers so `onrejected` doesn't catch errors from `onfulfilled`\n return this.#result.then(onfulfilled, onrejected)\n }\n\n async #run(): Promise<ShellResult> {\n const { env, localBins, throws } = this.#settings\n const cwd = path.resolve(this.#settings.cwd)\n const envWithBins = localBins ? addBinDirs(cwd, env) : env\n const finalEnv = removeNodeShims(envWithBins)\n\n const output = await this.#shellPromise\n .cwd(cwd)\n .env(finalEnv)\n .quiet()\n .throws(throws)\n .catch((error: unknown) => {\n if (error instanceof bun.$.ShellError) throw error\n // Name the cwd because Bun's start errors (like a missing cwd) don't.\n throw new Error(`Command failed to start (cwd: ${cwd})`, { cause: error })\n })\n\n return {\n stdout: stripFinalNewline(output.stdout),\n stderr: stripFinalNewline(output.stderr),\n exitCode: output.exitCode,\n }\n }\n}\n"],"mappings":";;;;;AASA,MAAM,gBAAgB;AAEtB,MAAM,qBAAqB,WAAmB,OAAO,SAAS,CAAC,CAAC,QAAQ,eAAe,EAAE;;AAGzF,IAAa,eAAb,MAA8D;
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../src/test-utils/shell/command.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\nimport type { $ as BunShell } from \"bun\"\n\nimport { addBinDirs } from \"#test-utils/shell/bin-dirs.ts\"\nimport { removeNodeShims } from \"#test-utils/shell/node-shim.ts\"\nimport type { ShellEnv, ShellOptions, ShellResult } from \"#test-utils/shell/shell.ts\"\n\nconst FINAL_NEWLINE = /\\r?\\n$/v\n\nconst stripFinalNewline = (output: Buffer) => output.toString().replace(FINAL_NEWLINE, \"\")\n\n/** Wraps Bun's `ShellPromise` to apply its settings when it runs and return its output as strings. */\nexport class ShellCommand implements PromiseLike<ShellResult> {\n readonly #shellPromise: BunShell.ShellPromise\n readonly #settings: Required<ShellOptions>\n #result: Promise<ShellResult> | undefined\n\n /** Starts from the shell's settings, which the command's own methods can then override. */\n public constructor(shellPromise: BunShell.ShellPromise, settings: Required<ShellOptions>) {\n this.#shellPromise = shellPromise\n // Copy `settings` so this command's changes don't reach the shell.\n this.#settings = { ...settings }\n }\n\n /** Change the working directory for the command. Relative paths resolve against `process.cwd()`. */\n public cwd(newCwd: string) {\n this.#settings.cwd = newCwd\n return this\n }\n\n /** Add environment variables for the command, on top of the shell's. Set one to `undefined` to remove it. */\n public env(newEnv: ShellEnv) {\n this.#settings.env = { ...this.#settings.env, ...newEnv }\n return this\n }\n\n /** Configure whether the command puts `node_modules/.bin` of its cwd and each of its parents first on `PATH`. */\n public localBins(useLocalBins: boolean) {\n this.#settings.localBins = useLocalBins\n return this\n }\n\n /** Configure the command to not throw an exception on a non-zero exit code. */\n public nothrow() {\n this.#settings.throws = false\n return this\n }\n\n // oxlint-disable-next-line unicorn/no-thenable - awaiting a command runs it, like Bun's `ShellPromise`\n public async then<TResult1 = ShellResult, TResult2 = never>(\n onfulfilled?: ((value: ShellResult) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ) {\n // Keep the first run because Bun rejects settings on a command that already started.\n this.#result ??= this.#run()\n // oxlint-disable-next-line promise/prefer-catch - forward both handlers so `onrejected` doesn't catch errors from `onfulfilled`\n return this.#result.then(onfulfilled, onrejected)\n }\n\n async #run(): Promise<ShellResult> {\n const { env, localBins, throws } = this.#settings\n const cwd = path.resolve(this.#settings.cwd)\n const envWithBins = localBins ? addBinDirs(cwd, env) : env\n const finalEnv = removeNodeShims(envWithBins)\n\n const output = await this.#shellPromise\n .cwd(cwd)\n .env(finalEnv)\n .quiet()\n .throws(throws)\n .catch((error: unknown) => {\n if (error instanceof bun.$.ShellError) throw error\n // Name the cwd because Bun's start errors (like a missing cwd) don't.\n throw new Error(`Command failed to start (cwd: ${cwd})`, { cause: error })\n })\n\n return {\n stdout: stripFinalNewline(output.stdout),\n stderr: stripFinalNewline(output.stderr),\n exitCode: output.exitCode,\n }\n }\n}\n"],"mappings":";;;;;AASA,MAAM,gBAAgB;AAEtB,MAAM,qBAAqB,WAAmB,OAAO,SAAS,CAAC,CAAC,QAAQ,eAAe,EAAE;;AAGzF,IAAa,eAAb,MAA8D;CACnD;CACA;CACT;;CAGO,YAAY,cAAqC,UAAkC;EACxF,KAAK,gBAAgB;EAErB,KAAK,YAAY,EAAE,GAAG,SAAS;CACjC;;CAGO,IAAI,QAAgB;EACzB,KAAK,UAAU,MAAM;EACrB,OAAO;CACT;;CAGO,IAAI,QAAkB;EAC3B,KAAK,UAAU,MAAM;GAAE,GAAG,KAAK,UAAU;GAAK,GAAG;EAAO;EACxD,OAAO;CACT;;CAGO,UAAU,cAAuB;EACtC,KAAK,UAAU,YAAY;EAC3B,OAAO;CACT;;CAGO,UAAU;EACf,KAAK,UAAU,SAAS;EACxB,OAAO;CACT;CAGA,MAAa,KACX,aACA,YACA;EAEA,KAAK,YAAY,KAAK,KAAK;EAE3B,OAAO,KAAK,QAAQ,KAAK,aAAa,UAAU;CAClD;CAEA,MAAM,OAA6B;EACjC,MAAM,EAAE,KAAK,WAAW,WAAW,KAAK;EACxC,MAAM,MAAM,KAAK,QAAQ,KAAK,UAAU,GAAG;EAC3C,MAAM,cAAc,YAAY,WAAW,KAAK,GAAG,IAAI;EACvD,MAAM,WAAW,gBAAgB,WAAW;EAE5C,MAAM,SAAS,MAAM,KAAK,cACvB,IAAI,GAAG,CAAC,CACR,IAAI,QAAQ,CAAC,CACb,MAAM,CAAC,CACP,OAAO,MAAM,CAAC,CACd,OAAO,UAAmB;GACzB,IAAI,iBAAiB,IAAI,EAAE,YAAY,MAAM;GAE7C,MAAM,IAAI,MAAM,iCAAiC,IAAI,IAAI,EAAE,OAAO,MAAM,CAAC;EAC3E,CAAC;EAEH,OAAO;GACL,QAAQ,kBAAkB,OAAO,MAAM;GACvC,QAAQ,kBAAkB,OAAO,MAAM;GACvC,UAAU,OAAO;EACnB;CACF;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ShellCommand } from "./command.js";
|
|
2
|
-
import { minimalEnv } from "./env.js";
|
|
3
2
|
import { ShellExpression } from "bun";
|
|
4
3
|
export type ShellEnv = Record<string, string | undefined>;
|
|
5
4
|
export interface ShellOptions {
|
|
@@ -39,5 +38,4 @@ export type Shell = (strings: TemplateStringsArray, ...expressions: ShellExpress
|
|
|
39
38
|
* Creates a shell that runs each command quietly and returns its output with one trailing newline stripped. Commands
|
|
40
39
|
* read the test runner's stdin, so add `< /dev/null` to a command that might prompt.
|
|
41
40
|
*/
|
|
42
|
-
export declare const createShell: (options?: ShellOptions) => Shell;
|
|
43
|
-
export { type ShellCommand, minimalEnv };
|
|
41
|
+
export declare const createShell: (options?: ShellOptions) => Shell;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ShellCommand } from "./command.js";
|
|
2
|
-
import { minimalEnv } from "./env.js";
|
|
3
2
|
import process from "node:process";
|
|
4
3
|
import bun from "bun";
|
|
5
4
|
// src/test-utils/shell/shell.ts
|
|
@@ -20,6 +19,6 @@ const createShell = (options = {}) => {
|
|
|
20
19
|
};
|
|
21
20
|
return (strings, ...expressions) => new ShellCommand(bunShell(strings, ...expressions), settings);
|
|
22
21
|
};
|
|
23
|
-
export { createShell
|
|
22
|
+
export { createShell };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=shell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","names":[],"sources":["../../../src/test-utils/shell/shell.ts"],"sourcesContent":["import process from \"node:process\"\n\nimport bun from \"bun\"\nimport type { ShellExpression } from \"bun\"\n\nimport { ShellCommand } from \"#test-utils/shell/command.ts\"\n\nexport type
|
|
1
|
+
{"version":3,"file":"shell.js","names":[],"sources":["../../../src/test-utils/shell/shell.ts"],"sourcesContent":["import process from \"node:process\"\n\nimport bun from \"bun\"\nimport type { ShellExpression } from \"bun\"\n\nimport { ShellCommand } from \"#test-utils/shell/command.ts\"\n\nexport type ShellEnv = Record<string, string | undefined>\n\nexport interface ShellOptions {\n /**\n * The working directory for commands. Relative paths resolve against `process.cwd()`.\n *\n * @default process.cwd()\n */\n cwd?: string\n /**\n * The environment for commands. Replaces `process.env`.\n *\n * @default process.env without `FORCE_COLOR`\n */\n env?: ShellEnv\n /**\n * Put `node_modules/.bin` of the cwd and each of its parents first on `PATH`.\n *\n * @default true\n */\n localBins?: boolean\n /**\n * Throw Bun's `ShellError` on a non-zero exit code.\n *\n * @default true\n */\n throws?: boolean\n}\n\nexport interface ShellResult {\n stdout: string\n stderr: string\n exitCode: number\n}\n\n/** Runs commands like Bun's `$`, quietly, starting from the shell's options. */\nexport type Shell = (strings: TemplateStringsArray, ...expressions: ShellExpression[]) => ShellCommand\n\n/**\n * Creates a shell that runs each command quietly and returns its output with one trailing newline stripped. Commands\n * read the test runner's stdin, so add `< /dev/null` to a command that might prompt.\n */\nexport const createShell = (options: ShellOptions = {}): Shell => {\n // Use a separate instance so settings on Bun's global `$` don't apply here.\n const bunShell = new bun.$.Shell()\n const settings: Required<ShellOptions> = {\n cwd: options.cwd ?? process.cwd(),\n // Drop `FORCE_COLOR` because `bask` sets it when the tests run in a terminal and CI does not.\n env: options.env ?? { ...process.env, FORCE_COLOR: undefined },\n localBins: options.localBins ?? true,\n throws: options.throws ?? true,\n }\n\n return (strings, ...expressions) => new ShellCommand(bunShell(strings, ...expressions), settings)\n}\n"],"mappings":";;;;;;;;AAiDA,MAAa,eAAe,UAAwB,CAAC,MAAa;CAEhE,MAAM,WAAW,IAAI,IAAI,EAAE,MAAM;CACjC,MAAM,WAAmC;EACvC,KAAK,QAAQ,OAAO,QAAQ,IAAI;EAEhC,KAAK,QAAQ,OAAO;GAAE,GAAG,QAAQ;GAAK,aAAa,KAAA;EAAU;EAC7D,WAAW,QAAQ,aAAa;EAChC,QAAQ,QAAQ,UAAU;CAC5B;CAEA,QAAQ,SAAS,GAAG,gBAAgB,IAAI,aAAa,SAAS,SAAS,GAAG,WAAW,GAAG,QAAQ;AAClG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "My shared configs for TS projects",
|
|
5
5
|
"homepage": "https://github.com/adamhl8/configs",
|
|
6
6
|
"bugs": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"prepare": "bask prepare"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@adamhl8/oxlint-plugin-clean-modules": "^0.
|
|
63
|
-
"@adamhl8/oxlint-plugin-package-boundaries": "^0.
|
|
62
|
+
"@adamhl8/oxlint-plugin-clean-modules": "^0.3.0",
|
|
63
|
+
"@adamhl8/oxlint-plugin-package-boundaries": "^0.2.0",
|
|
64
64
|
"@commitlint/config-conventional": "^21.2.4",
|
|
65
65
|
"@commitlint/types": "^21.2.3",
|
|
66
66
|
"@e18e/eslint-plugin": "^0.8.1",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"arktype": "^2.2.9",
|
|
69
69
|
"es-toolkit": "^1.53.2",
|
|
70
70
|
"eslint-plugin-bunisms": "^0.11.0",
|
|
71
|
-
"eslint-plugin-hono": "^1.
|
|
72
|
-
"eslint-plugin-react-web-api": "^5.30.
|
|
71
|
+
"eslint-plugin-hono": "^1.3.0",
|
|
72
|
+
"eslint-plugin-react-web-api": "^5.30.4",
|
|
73
73
|
"eslint-plugin-react-you-might-not-need-an-effect": "^1.2.0",
|
|
74
74
|
"eslint-plugin-regexp": "^3.3.3",
|
|
75
75
|
"oxlint-plugin-directive-comments": "^0.1.0",
|
|
76
|
-
"oxlint-tailwindcss": "^1.17.
|
|
76
|
+
"oxlint-tailwindcss": "^1.17.2",
|
|
77
77
|
"ts-explicit-errors": "^5.0.1",
|
|
78
|
-
"type-fest": "^
|
|
78
|
+
"type-fest": "^6.0.1",
|
|
79
79
|
"verkit": "^0.5.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"@arethetypeswrong/core": "^0.18.5",
|
|
85
85
|
"@commitlint/cli": "^21.2.4",
|
|
86
86
|
"@types/bun": "^1.4.4",
|
|
87
|
-
"knip": "^6.45.
|
|
87
|
+
"knip": "^6.45.1",
|
|
88
88
|
"markdown-toc": "^1.2.0",
|
|
89
|
-
"oxfmt": "^0.
|
|
90
|
-
"oxlint": "^1.
|
|
91
|
-
"oxlint-tsgolint": "^7.0.
|
|
89
|
+
"oxfmt": "^0.79.0",
|
|
90
|
+
"oxlint": "^1.94.0",
|
|
91
|
+
"oxlint-tsgolint": "^7.0.2007",
|
|
92
92
|
"publint": "^0.3.25",
|
|
93
93
|
"release-it": "^21.1.2",
|
|
94
94
|
"release-it-git-cliff": "^0.2.1",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"@tailwindcss/language-server": ">=0.16",
|
|
104
104
|
"knip": ">=6.45",
|
|
105
105
|
"markdown-toc": ">=1.2",
|
|
106
|
-
"oxfmt": ">=0.
|
|
107
|
-
"oxlint": ">=1.
|
|
108
|
-
"oxlint-tsgolint": ">=7.0.
|
|
106
|
+
"oxfmt": ">=0.79",
|
|
107
|
+
"oxlint": ">=1.94",
|
|
108
|
+
"oxlint-tsgolint": ">=7.0.2007",
|
|
109
109
|
"publint": ">=0.3",
|
|
110
110
|
"release-it": ">=21.1",
|
|
111
111
|
"release-it-git-cliff": ">=0.2",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { commitlintConfig } from "./commitlint.base.js";
|
|
2
|
-
import { KnipArgs, knipConfig } from "./knip.base.js";
|
|
3
|
-
import { oxfmtConfig } from "./oxfmt.base.js";
|
|
4
|
-
import { oxlintConfig } from "./oxlint.base.js";
|
|
5
|
-
import { releaseItConfig } from "./release-it.base.js";
|
|
6
|
-
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
|
|
7
|
-
export { type KnipArgs, commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
package/dist/configs/configs.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { commitlintConfig } from "./commitlint.base.js";
|
|
2
|
-
import { knipConfig } from "./knip.base.js";
|
|
3
|
-
import { oxfmtConfig } from "./oxfmt.base.js";
|
|
4
|
-
import { oxlintConfig } from "./oxlint.base.js";
|
|
5
|
-
import { releaseItConfig } from "./release-it.base.js";
|
|
6
|
-
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
|
|
7
|
-
export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|