@anolilab/lint-staged-config 9.0.0 → 11.0.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## @anolilab/lint-staged-config [11.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@10.0.0...@anolilab/lint-staged-config@11.0.0) (2026-04-07)
2
+
3
+ ### ⚠ BREAKING CHANGES
4
+
5
+ * Minimum Node.js version raised from 20.18 to 22.12.0
6
+ (current active LTS). Node 20 lacks Object.groupBy which is required by
7
+ eslint-flat-config-utils and lint-staged-config. Updated engines in all
8
+ packages and .nvmrc.
9
+
10
+ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
11
+
12
+ ### Features
13
+
14
+ * require Node.js >=22.12.0 ([7c491c6](https://github.com/anolilab/javascript-style-guide/commit/7c491c660ea3ec96262dd4d9a17cc3e280b91579))
15
+
16
+ ### Bug Fixes
17
+
18
+ * **lint-staged-config:** fix eslint errors across source and test files ([a207a13](https://github.com/anolilab/javascript-style-guide/commit/a207a139e75c0ebc31323df217b76fd392c330f3))
19
+
20
+
21
+ ### Dependencies
22
+
23
+ * **@anolilab/eslint-config:** upgraded to 27.0.0
24
+ * **@anolilab/prettier-config:** upgraded to 10.0.0
25
+
26
+ ## @anolilab/lint-staged-config [10.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@9.0.0...@anolilab/lint-staged-config@10.0.0) (2026-04-01)
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * **@anolilab/eslint-config:** upgraded to 26.0.0
32
+
1
33
  ## @anolilab/lint-staged-config [9.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@8.0.0...@anolilab/lint-staged-config@9.0.0) (2026-03-28)
2
34
 
3
35
 
package/dist/bin.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var g=Object.defineProperty;var h=(n,o)=>g(n,"name",{value:o,configurable:!0});import{existsSync as u}from"node:fs";import{join as s}from"node:path";import{exit as f}from"node:process";import{writeFileSync as c,ensureDirSync as p,isAccessibleSync as $}from"@visulima/fs";import{parsePackageJson as _,hasPackageJsonAnyDependency as d}from"@visulima/package";var y=Object.defineProperty,l=h((n,o)=>y(n,"name",{value:o,configurable:!0}),"c");const r=l(n=>$(n)?(console.warn(`⚠️ ${n} already exists;`),!0):!1,"checkIfFileExists"),w=l(async(n,o)=>{const e=".lintstagedrc";for(const i of[e,`${e}.js`,`${e}.cjs`,`${e}.mjs`,`${e}.json`,`${e}.yaml`,`${e}.yml`,"lint-staged.config.js","lint-staged.config.mjs","lint-staged.config.cjs"])if(r(s(n,i))){console.warn(`⚠️ ${i} already exists;`);return}const t=s(n,".lintstagedrc.js");c(t,`${o?'import { defineConfig } from "@anolilab/lint-staged-config"':'const { defineConfig } = require("@anolilab/lint-staged-config")'};
2
+ var g=Object.defineProperty;var h=(o,n)=>g(o,"name",{value:n,configurable:!0});import{existsSync as u}from"node:fs";import{join as s}from"node:path";import{exit as f}from"node:process";import{writeFileSync as r,ensureDirSync as p,isAccessibleSync as $}from"@visulima/fs";import{parsePackageJson as _,hasPackageJsonAnyDependency as d}from"@visulima/package";var y=Object.defineProperty,l=h((o,n)=>y(o,"name",{value:n,configurable:!0}),"r");const c=l(o=>$(o)?(console.warn(`⚠️ ${o} already exists;`),!0):!1,"checkIfFileExists"),I=l((o,n)=>{const e=".lintstagedrc",t=[e,`${e}.js`,`${e}.cjs`,`${e}.mjs`,`${e}.json`,`${e}.yaml`,`${e}.yml`,"lint-staged.config.js","lint-staged.config.mjs","lint-staged.config.cjs"];for(const i of t)if(c(s(o,i))){console.warn(`⚠️ ${i} already exists;`);return}const a=s(o,".lintstagedrc.js");r(a,`${n?'import { defineConfig } from "@anolilab/lint-staged-config"':'const { defineConfig } = require("@anolilab/lint-staged-config")'};
3
3
 
4
- ${o?"export default":"module.exports ="} defineConfig();
5
- `)},"writeLintStagedRc"),I=l(async(n,o)=>{const e=".nano-staged";for(const i of[e,`${e}.js`,`${e}.cjs`,`${e}.mjs`,`${e}.json`,`${e.replace(".","")}.js`,`${e.replace(".","")}.cjs`,`${e.replace(".","")}.mjs`,`${e.replace(".","")}.json`,".nanostagedrc"])if(r(s(n,i))){console.warn(`⚠️ ${i} already exists;`);return}const t=s(n,".nano-staged.js");c(t,`${o?'import { defineConfig } from "@anolilab/lint-staged-config"':'const { defineConfig } = require("@anolilab/lint-staged-config")'};
4
+ ${n?"export default":"module.exports ="} defineConfig();
5
+ `)},"writeLintStagedRc"),x=l((o,n)=>{const e=".nano-staged",t=[e,`${e}.js`,`${e}.cjs`,`${e}.mjs`,`${e}.json`,`${e.replace(".","")}.js`,`${e.replace(".","")}.cjs`,`${e.replace(".","")}.mjs`,`${e.replace(".","")}.json`,".nanostagedrc"];for(const i of t)if(c(s(o,i))){console.warn(`⚠️ ${i} already exists;`);return}const a=s(o,".nano-staged.js");r(a,`${n?'import { defineConfig } from "@anolilab/lint-staged-config"':'const { defineConfig } = require("@anolilab/lint-staged-config")'};
6
6
 
7
- ${o?"export default":"module.exports ="} defineConfig();
8
- `)},"writeNanoStagedRc"),x=l(async(n,o,e)=>{if(!d(o,["husky"])){console.warn("⚠️ husky is not installed;");return}const t=s(n,".husky");p(t);const i=s(t,"common.sh");r(i)||c(i,`#!/bin/sh
7
+ ${n?"export default":"module.exports ="} defineConfig();
8
+ `)},"writeNanoStagedRc"),w=l((o,n,e)=>{if(!d(n,["husky"])){console.warn("⚠️ husky is not installed;");return}const t=s(o,".husky");p(t);const a=s(t,"common.sh");c(a)||r(a,`#!/bin/sh
9
9
 
10
10
  command_exists () {
11
11
  command -v "$1" >/dev/null 2>&1
@@ -27,7 +27,7 @@ if [ "$IS_WINDOWS" = "true" ]; then
27
27
  exec < /dev/tty
28
28
  fi
29
29
  fi
30
- `);const a=s(t,"pre-commit");r(a)||c(a,`#!/bin/sh
30
+ `);const i=s(t,"pre-commit");c(i)||r(i,`#!/bin/sh
31
31
 
32
32
  . "$(dirname "$0")/_/husky.sh"
33
33
  . "$(dirname "$0")/common.sh"
@@ -42,7 +42,7 @@ ${e?"./node_modules/.bin/nano-staged":"./node_modules/.bin/lint-staged --verbose
42
42
 
43
43
  echo Finished Git hook: pre-commit
44
44
  echo --------------------------------------------
45
- `);const m=s(t,"prepare-commit-msg");d(o,["commitizen"])&&!r(m)&&c(m,`#!/bin/sh
45
+ `);const m=s(t,"prepare-commit-msg");d(n,["commitizen"])&&!c(m)&&r(m,`#!/bin/sh
46
46
 
47
47
  . "$(dirname "$0")/_/husky.sh"
48
48
  . "$(dirname "$0")/common.sh"
@@ -84,5 +84,5 @@ fi
84
84
 
85
85
  echo Finished Git hook: prepare-commit-msg
86
86
  echo --------------------------------------------
87
- `)},"writeHuskyFiles");(async()=>{const n=process.cwd();console.log("Configuring @anolilab/lint-staged-config",n,`
88
- `);const o=s(n,"package.json");u(o)||(console.error("No package.json found in the current directory. You need to run this command in a directory with a package.json file."),f(1));const e=await _(o),t=e.type==="module",i=d(e,["lint-staged"]),a=d(e,["nano-staged"]);try{i?await w(n,t):a&&await I(n,t),await x(n,e,a),console.log("Everything went well, have fun!"),f(0)}catch(m){console.error("Something went wrong:",m),f(1)}})();
87
+ `)},"writeHuskyFiles");(async()=>{const o=process.cwd();console.log("Configuring @anolilab/lint-staged-config",o,`
88
+ `);const n=s(o,"package.json");u(n)||(console.error("No package.json found in the current directory. You need to run this command in a directory with a package.json file."),f(1));const e=await _(n),t=e.type==="module",a=d(e,["lint-staged"]),i=d(e,["nano-staged"]);try{a?I(o,t):i&&x(o,t),w(o,e,i),console.log("Everything went well, have fun!"),f(0)}catch(m){console.error("Something went wrong:",m),f(1)}})();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"node:fs";import"@visulima/package";import{d as n,e as o,s as p,t as r}from"./packem_shared/index-eCPAX7na.js";export{n as defineConfig,o as eslintExtensions,p as stylesheetsExtensions,r as typescriptExtensions};
1
+ import"node:fs";import"@visulima/package";import{d as n,e as o,s as p,t as r}from"./packem_shared/index-BXiLYtC8.js";export{n as defineConfig,o as eslintExtensions,p as stylesheetsExtensions,r as typescriptExtensions};
@@ -1,5 +1,5 @@
1
- var g=Object.defineProperty;var l=(e,n)=>g(e,"name",{value:n,configurable:!0});import{hasPackageJsonAnyDependency as f}from"@visulima/package";import{n as $,P as d}from"../packem_shared/index-eCPAX7na.js";import{dirname as y}from"node:path";import{ESLint as v}from"eslint";import{quote as x}from"shell-quote";var j=Object.defineProperty,w=l((e,n)=>j(e,"name",{value:n,configurable:!0}),"i");const b=w(e=>{const n={};return e.forEach(t=>{const r=y(t);n[r]||(n[r]=[]),n[r].push(t)}),n},"groupFilePathsByDirectoryName");var P=Object.defineProperty,E=l((e,n)=>P(e,"name",{value:n,configurable:!0}),"o");const N=E(async(e,n=new v)=>{const t=(await Promise.allSettled(e.map(async r=>await n.isPathIgnored(r)))).map(r=>{if(r.status==="fulfilled")return r.value;throw console.error(`
1
+ var h=Object.defineProperty;var l=(e,n)=>h(e,"name",{value:n,configurable:!0});import{hasPackageJsonAnyDependency as f}from"@visulima/package";import{n as $,P as d}from"../packem_shared/index-BXiLYtC8.js";import{dirname as y}from"node:path";import{ESLint as v}from"eslint";import{quote as x}from"shell-quote";var j=Object.defineProperty,w=l((e,n)=>j(e,"name",{value:n,configurable:!0}),"e");const b=w(e=>{const n={};return e.forEach(t=>{const r=y(t);n[r]??=[],n[r].push(t)}),n},"groupFilePathsByDirectoryName");var P=Object.defineProperty,E=l((e,n)=>P(e,"name",{value:n,configurable:!0}),"o");const S=E(async(e,n=new v)=>{const t=(await Promise.allSettled(e.map(async r=>await n.isPathIgnored(r)))).map(r=>{if(r.status==="fulfilled")return r.value;throw console.error(`
2
2
  Unable to determine if file is ignored.
3
3
 
4
4
 
5
- ${r.reason}`),new Error("Stopping lint-staged because of an error.")});return e.filter((r,a)=>!t[a]).map(r=>`"${$?r:x([r])}"`)},"removeIgnoredFiles");var O=Object.defineProperty,p=l((e,n)=>O(e,"name",{value:n,configurable:!0}),"m");const s=".eslintrc",k=p((e,n)=>{const t=[];e["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?t.push(`--max-warnings=${e["max-warnings"]}`):e["max-warnings"]!==!1&&t.push("--max-warnings=0");const r=[];f(n,["eslint-plugin-react-hooks"])&&r.push("react-hooks/exhaustive-deps:off"),f(n,["eslint-plugin-eslint-comments"])&&r.push("eslint-comments/no-unused-disable:off");const a=[...e.rules??[],...r].filter(o=>o.trim().length>0);a.length>0&&t.push(a.map(o=>`--rule "${o}"`).join(" "));const i=[...e["fix-type"]??["layout"]].filter(o=>o.trim().length>0);return i.length>0&&t.push(`--fix-type ${i.join(",")}`,"--fix"),e.cache&&t.push("--cache"),t},"createEslintArguments"),B=p(async(e,n,t,r)=>{const a=await N(r),i=k(t,n);if(t.config)return a.length===0?[]:(i.push(`--config ${t.config}`),[`${e} exec eslint ${i.join(" ")} ${a.join(" ")}`]);const o=b(a),u=[];return Object.values(o).forEach(m=>{let c;[s,`${s}.js`,`${s}.cjs`,`${s}.json`,`${s}.yaml`,`${s}.yml`].forEach(h=>{if(!c)try{c=d(h,m[0])}catch{}}),c&&u.push(`${e} exec eslint ${i.join(" ")} --config ${c} ${m.join(" ")}`)}),u},"createEslintCommands");export{B as default};
5
+ ${String(r.reason)}`),new Error("Stopping lint-staged because of an error.")});return e.filter((r,a)=>!t[a]).map(r=>`"${$?r:x([r])}"`)},"removeIgnoredFiles");var N=Object.defineProperty,p=l((e,n)=>N(e,"name",{value:n,configurable:!0}),"m");const s=".eslintrc",O=p((e,n)=>{const t=[];e["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?t.push(`--max-warnings=${String(e["max-warnings"])}`):e["max-warnings"]!==!1&&t.push("--max-warnings=0");const r=[];f(n,["eslint-plugin-react-hooks"])&&r.push("react-hooks/exhaustive-deps:off"),f(n,["eslint-plugin-eslint-comments"])&&r.push("eslint-comments/no-unused-disable:off");const a=[...e.rules??[],...r].filter(i=>i.trim().length>0);a.length>0&&t.push(a.map(i=>`--rule "${i}"`).join(" "));const o=[...e["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return o.length>0&&t.push(`--fix-type ${o.join(",")}`,"--fix"),e.cache&&t.push("--cache"),t},"createEslintArguments"),B=p(async(e,n,t,r)=>{const a=await S(r),o=O(t,n);if(t.config)return a.length===0?[]:(o.push(`--config ${t.config}`),[`${e} exec eslint ${o.join(" ")} ${a.join(" ")}`]);const i=b(a),u=[];return Object.values(i).forEach(m=>{let c;[s,`${s}.js`,`${s}.cjs`,`${s}.json`,`${s}.yaml`,`${s}.yml`].forEach(g=>{if(!c)try{c=d(g,m[0])}catch{}}),c&&u.push(`${e} exec eslint ${o.join(" ")} --config ${c} ${m.join(" ")}`)}),u},"createEslintCommands");export{B as default};
@@ -0,0 +1 @@
1
+ var $=Object.defineProperty;var f=(n,e)=>$(n,"name",{value:e,configurable:!0});import{existsSync as g}from"node:fs";import{parsePackageJsonSync as h,findPackageManagerSync as w,hasPackageJsonAnyDependency as a}from"@visulima/package";import{quote as k}from"shell-quote";import{platform as _,env as v}from"node:process";import{dirname as E,join as P}from"node:path";import{findUpSync as b,isAccessibleSync as A}from"@visulima/fs";const T=_==="win32"||/^(msys|cygwin)$/u.test(v.OSTYPE??"");var S=Object.defineProperty,C=f((n,e)=>S(n,"name",{value:e,configurable:!0}),"t");const i=C(n=>n.map(e=>`"${T?e:k([e])}"`).join(" ").replaceAll("/@","/@"),"concatFiles");var R=Object.defineProperty,x=f((n,e)=>R(n,"name",{value:e,configurable:!0}),"o");const O=x(n=>{const e=b("package.json",{cwd:n});return e&&E(e)},"packageDirectorySync"),N=x(n=>{const e=O(n??process.cwd());if(e?.startsWith("/"))return e;throw new Error(`Cannot determine the nearest root of the package for the file: ${n??"unknown"}!`)},"getNearestPackageRootPath"),q=x(n=>{const e=P(...n);if(e.startsWith("/"))return e;throw new TypeError("Joined path did not return an absolute path.")},"joinPaths"),G=x((n,e)=>{const c=N(e),o=q([c,n]);if(A(o))return o;throw new Error(`Cannot locate nearest "${n}" file!`)},"getNearestConfigPath");var J=Object.defineProperty,y=f((n,e)=>J(n,"name",{value:e,configurable:!0}),"g");const L=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml","json","json5","jsonc"],D=["cts","ts","mts","tsx","ctsx"],H=["css","scss","sass","less","styl","stylus","pcss","postcss","sss"],I=y((n={})=>{const e={debug:!1,eslint:{extensions:L},stylesheets:{extensions:H},typescript:{exclude:[],extensions:D},...n},c=e.cwd??process.cwd();if(!g(`${c}/package.json`))throw new Error(`No package.json found in the current working directory: ${c}; Please adjust the "cwd" option.`);const o=h(`${c}/package.json`,{resolveCatalogs:!0}),{packageManager:t}=w(c);e.debug&&console.debug("Package manager found:",t);const j=a(o,["markdownlint-cli"]),m=a(o,["markdownlint-cli2"]),p=a(o,["prettier"]);let r={};if(e.eslint!==!1&&a(o,["eslint"])){if(!Array.isArray(e.eslint.extensions)||e.eslint.extensions.length===0)throw new Error("The `extensions` option is required for the ESLint configuration.");!j&&!m&&e.eslint.extensions.push("md"),r[`**/*.{${e.eslint.extensions.join(",")}}`]=async s=>{const{default:d}=await import("../packem_chunks/create-eslint-commands.js");return[...p?[`${t} exec prettier --write ${i(s)}`]:[],...await d(t,o,e.eslint,s)]}}if(e.json!==!1&&a(o,["sort-package-json"])&&(r["**/package.json"]=s=>[`${t} exec sort-package-json ${i(s)}`]),e.markdown!==!1&&j&&(r={...r,"**/*.md":y(s=>[...p?[`${t} exec prettier --write ${i(s)}`]:[],`${t} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${i(s)}`,...m?[`${t} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${i(s)}`]:[]],"**/*.md"),"**/*.mdx":y(s=>[...p?[`${t} exec prettier --write ${i(s)}`]:[]],"**/*.mdx")}),e.secretlint!==!1&&a(o,["secretlint"])&&(r["**/*"]=s=>[`${t} exec secretlint ${i(s)}`]),e.stylesheets!==!1&&a(o,["stylelint"])){if(!Array.isArray(e.stylesheets.extensions)||e.stylesheets.extensions.length===0)throw new Error("The `extensions` option is required for the Stylesheets configuration.");r[`**/*.{${e.stylesheets.extensions.join(",")}}`]=s=>[...p?[`${t} exec prettier --ignore-unknown --write ${i(s)}`]:[],`${t} exec stylelint --fix`]}if(e.typescript!==!1&&a(o,["typescript"])){if(!Array.isArray(e.typescript.extensions)||e.typescript.extensions.length===0)throw new Error("The `extensions` option is required for the TypeScript configuration.");r[`**/*.{${e.typescript.extensions.join(",")}}`]=s=>{const d=new Set;return s.forEach(u=>{if(!(typeof e.typescript.exclude=="object"&&Array.isArray(e.typescript.exclude)&&e.typescript.exclude.some(l=>u.includes(l))))try{const l=G("tsconfig.json",u);d.add(`${t} exec tsc --noEmit --project ${l}`)}catch(l){e.debug&&console.error(l)}}),[...d]}}return a(o,["vitest"])&&(r["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=["vitest related --run"],r["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${t} exec vitest related --run`]),a(o,["jest"])&&(r["**/*.spec.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/*.test.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=[`${t} exec jest --findRelatedTests`],r["**/__mocks__/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${t} exec jest --findRelatedTests`],r["**/__tests__/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/test/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`]),a(o,["ava"])&&(r["**/(test|tests|__tests__)/**/*.js"]=s=>[`${t} exec ava ${i(s)}`],r["**/*.(spec|test).js"]=s=>[`${t} exec ava ${i(s)}`],r["**/test.js"]=s=>[`${t} exec ava ${i(s)}`],r["**/test-*.js"]=s=>[`${t} exec ava ${i(s)}`]),r},"defineConfig");export{G as P,I as d,L as e,T as n,H as s,D as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/lint-staged-config",
3
- "version": "9.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Shareable Lint-Staged Config for any project.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -66,7 +66,7 @@
66
66
  "type-fest": "5.5.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "eslint": "10.1.0",
69
+ "eslint": "10.2.0",
70
70
  "husky": "^9.x",
71
71
  "jest": "^29.0.0",
72
72
  "lint-staged": "^16.x",
@@ -104,7 +104,7 @@
104
104
  },
105
105
  "optionalDependencies": {},
106
106
  "engines": {
107
- "node": ">=20.18.* <=25.*"
107
+ "node": ">=22.12.0 <=25.*"
108
108
  },
109
109
  "publishConfig": {
110
110
  "access": "public",
@@ -1 +0,0 @@
1
- var $=Object.defineProperty;var f=(n,e)=>$(n,"name",{value:e,configurable:!0});import{existsSync as h}from"node:fs";import{parsePackageJsonSync as w,findPackageManagerSync as k,hasPackageJsonAnyDependency as a}from"@visulima/package";import{quote as _}from"shell-quote";import{platform as v,env as E}from"node:process";import{dirname as b,join as P}from"node:path";import{findUpSync as A,isAccessibleSync as T}from"@visulima/fs";const S=v==="win32"||/^(msys|cygwin)$/u.test(E.OSTYPE??"");var C=Object.defineProperty,R=f((n,e)=>C(n,"name",{value:e,configurable:!0}),"t");const o=R(n=>n.map(e=>`"${S?e:_([e])}"`).join(" ").replaceAll("/@","/@"),"concatFiles");var O=Object.defineProperty,x=f((n,e)=>O(n,"name",{value:e,configurable:!0}),"o");const N=x(n=>{const e=A("package.json",{cwd:n});return e&&b(e)},"packageDirectorySync"),q=x(n=>{const e=N(n??process.cwd());if(e?.startsWith("/"))return e;throw new Error(`Cannot determine the nearest root of the package for the file: ${n}!`)},"getNearestPackageRootPath"),G=x(n=>{const e=P(...n);if(e.startsWith("/"))return e;throw new TypeError("Joined path did not return an absolute path.")},"joinPaths"),J=x((n,e)=>{const l=q(e),i=G([l,n]);if(T(i))return i;throw new Error(`Cannot locate nearest "${n}" file!`)},"getNearestConfigPath");var L=Object.defineProperty,j=f((n,e)=>L(n,"name",{value:e,configurable:!0}),"g");const D=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml","json","json5","jsonc"],H=["cts","ts","mts","tsx","ctsx"],M=["css","scss","sass","less","styl","stylus","pcss","postcss","sss"],K=j((n={})=>{const e={debug:!1,eslint:{extensions:D},stylesheets:{extensions:M},typescript:{exclude:[],extensions:H},...n},l=e.cwd||process.cwd();if(!h(`${l}/package.json`))throw new Error(`No package.json found in the current working directory: ${l}; Please adjust the "cwd" option.`);const i=w(`${l}/package.json`,{resolveCatalogs:!0}),{packageManager:t}=k(l);e.debug&&console.debug("Package manager found:",t);const u=a(i,["markdownlint-cli"]),m=a(i,["markdownlint-cli2"]),p=a(i,["prettier"]);let r={};if(e.eslint!==!1&&a(i,["eslint"])){if(!Array.isArray(e.eslint.extensions)||e.eslint.extensions.length===0)throw new Error("The `extensions` option is required for the ESLint configuration.");!u&&!m&&e.eslint.extensions.push("md"),r[`**/*.{${e.eslint.extensions.join(",")}}`]=async s=>{const{default:d}=await import("../packem_chunks/create-eslint-commands.js");return[...p?[`${t} exec prettier --write ${o(s)}`]:[],...await d(t,i,e.eslint,s)]}}if(e.json!==!1&&a(i,["sort-package-json"])&&(r["**/package.json"]=s=>[`${t} exec sort-package-json ${o(s)}`]),e.markdown!==!1&&u&&(r={...r,"**/*.md":j(s=>[...p?[`${t} exec prettier --write ${o(s)}`]:[],...u?[`${t} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${o(s)}`]:[],...m?[`${t} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${o(s)}`]:[]],"**/*.md"),"**/*.mdx":j(s=>[...p?[`${t} exec prettier --write ${o(s)}`]:[]],"**/*.mdx")}),e.secretlint!==!1&&a(i,["secretlint"])&&(r["**/*"]=s=>[`${t} exec secretlint ${o(s)}`]),e.stylesheets!==!1&&a(i,["stylelint"])){if(!Array.isArray(e.stylesheets.extensions)||e.stylesheets.extensions.length===0)throw new Error("The `extensions` option is required for the Stylesheets configuration.");r[`**/*.{${e.stylesheets.extensions.join(",")}}`]=s=>[...p?[`${t} exec prettier --ignore-unknown --write ${o(s)}`]:[],`${t} exec stylelint --fix`]}if(e.typescript!==!1&&a(i,["typescript"])){if(!Array.isArray(e.typescript.extensions)||e.typescript.extensions.length===0)throw new Error("The `extensions` option is required for the TypeScript configuration.");r[`**/*.{${e.typescript.extensions.join(",")}}`]=s=>{const d=new Set;return s.forEach(y=>{if(typeof e.typescript?.exclude=="object"&&Array.isArray(e.typescript.exclude)){let c=!1;if(e.typescript.exclude.forEach(g=>{!c&&y.includes(g)&&(c=!0)}),c){e.debug&&console.info(`Skipping ${y} as it's excluded in the settings.`);return}}try{const c=J("tsconfig.json",y);d.add(`${t} exec tsc --noEmit --project ${c}`)}catch(c){e.debug&&console.error(c)}}),[...d]}}return a(i,["vitest"])&&(r["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=["vitest related --run"],r["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${t} exec vitest related --run`]),a(i,["jest"])&&(r["**/*.spec.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/*.test.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=[`${t} exec jest --findRelatedTests`],r["**/__mocks__/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${t} exec jest --findRelatedTests`],r["**/__tests__/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`],r["**/test/*.{js,ts,tsx}"]=[`${t} exec jest --findRelatedTests`]),a(i,["ava"])&&(r["**/(test|tests|__tests__)/**/*.js"]=s=>[`${t} exec ava ${o(s)}`],r["**/*.(spec|test).js"]=s=>[`${t} exec ava ${o(s)}`],r["**/test.js"]=s=>[`${t} exec ava ${o(s)}`],r["**/test-*.js"]=s=>[`${t} exec ava ${o(s)}`]),r},"defineConfig");export{J as P,K as d,D as e,S as n,M as s,H as t};