@anolilab/lint-staged-config 10.0.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ ## @anolilab/lint-staged-config [11.0.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@11.0.0...@anolilab/lint-staged-config@11.0.1) (2026-05-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * updated deps ([d98d102](https://github.com/anolilab/javascript-style-guide/commit/d98d102727966141f8a49adecf58d649159fd1a2))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@anolilab/eslint-config:** upgraded to 27.0.2
11
+ * **@anolilab/prettier-config:** upgraded to 10.0.1
12
+
13
+ ## @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)
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * Minimum Node.js version raised from 20.18 to 22.12.0
18
+ (current active LTS). Node 20 lacks Object.groupBy which is required by
19
+ eslint-flat-config-utils and lint-staged-config. Updated engines in all
20
+ packages and .nvmrc.
21
+
22
+ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23
+
24
+ ### Features
25
+
26
+ * require Node.js >=22.12.0 ([7c491c6](https://github.com/anolilab/javascript-style-guide/commit/7c491c660ea3ec96262dd4d9a17cc3e280b91579))
27
+
28
+ ### Bug Fixes
29
+
30
+ * **lint-staged-config:** fix eslint errors across source and test files ([a207a13](https://github.com/anolilab/javascript-style-guide/commit/a207a139e75c0ebc31323df217b76fd392c330f3))
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * **@anolilab/eslint-config:** upgraded to 27.0.0
36
+ * **@anolilab/prettier-config:** upgraded to 10.0.0
37
+
1
38
  ## @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)
2
39
 
3
40
 
package/LICENSE.md CHANGED
@@ -27,134 +27,34 @@ SOFTWARE.
27
27
 
28
28
  # Licenses of bundled types
29
29
  The published @anolilab/lint-staged-config artifact additionally contains code with the following licenses:
30
- (MIT OR CC0-1.0)
30
+ MIT
31
31
 
32
32
  # Bundled types:
33
- ## type-fest
34
- License: (MIT OR CC0-1.0)
35
- By: Sindre Sorhus
36
- Repository: sindresorhus/type-fest
37
-
38
- > Creative Commons Legal Code
39
- >
40
- > CC0 1.0 Universal
41
- >
42
- > CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
43
- > LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
44
- > ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
45
- > INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
46
- > REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
47
- > PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
48
- > THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
49
- > HEREUNDER.
50
- >
51
- > Statement of Purpose
52
- >
53
- > The laws of most jurisdictions throughout the world automatically confer
54
- > exclusive Copyright and Related Rights (defined below) upon the creator
55
- > and subsequent owner(s) (each and all, an "owner") of an original work of
56
- > authorship and/or a database (each, a "Work").
57
- >
58
- > Certain owners wish to permanently relinquish those rights to a Work for
59
- > the purpose of contributing to a commons of creative, cultural and
60
- > scientific works ("Commons") that the public can reliably and without fear
61
- > of later claims of infringement build upon, modify, incorporate in other
62
- > works, reuse and redistribute as freely as possible in any form whatsoever
63
- > and for any purposes, including without limitation commercial purposes.
64
- > These owners may contribute to the Commons to promote the ideal of a free
65
- > culture and the further production of creative, cultural and scientific
66
- > works, or to gain reputation or greater distribution for their Work in
67
- > part through the use and efforts of others.
68
- >
69
- > For these and/or other purposes and motivations, and without any
70
- > expectation of additional consideration or compensation, the person
71
- > associating CC0 with a Work (the "Affirmer"), to the extent that he or she
72
- > is an owner of Copyright and Related Rights in the Work, voluntarily
73
- > elects to apply CC0 to the Work and publicly distribute the Work under its
74
- > terms, with knowledge of his or her Copyright and Related Rights in the
75
- > Work and the meaning and intended legal effect of CC0 on those rights.
76
- >
77
- > 1. Copyright and Related Rights. A Work made available under CC0 may be
78
- > protected by copyright and related or neighboring rights ("Copyright and
79
- > Related Rights"). Copyright and Related Rights include, but are not
80
- > limited to, the following:
81
- >
82
- > i. the right to reproduce, adapt, distribute, perform, display,
83
- > communicate, and translate a Work;
84
- > ii. moral rights retained by the original author(s) and/or performer(s);
85
- > iii. publicity and privacy rights pertaining to a person's image or
86
- > likeness depicted in a Work;
87
- > iv. rights protecting against unfair competition in regards to a Work,
88
- > subject to the limitations in paragraph 4(a), below;
89
- > v. rights protecting the extraction, dissemination, use and reuse of data
90
- > in a Work;
91
- > vi. database rights (such as those arising under Directive 96/9/EC of the
92
- > European Parliament and of the Council of 11 March 1996 on the legal
93
- > protection of databases, and under any national implementation
94
- > thereof, including any amended or successor version of such
95
- > directive); and
96
- > vii. other similar, equivalent or corresponding rights throughout the
97
- > world based on applicable law or treaty, and any national
98
- > implementations thereof.
99
- >
100
- > 2. Waiver. To the greatest extent permitted by, but not in contravention
101
- > of, applicable law, Affirmer hereby overtly, fully, permanently,
102
- > irrevocably and unconditionally waives, abandons, and surrenders all of
103
- > Affirmer's Copyright and Related Rights and associated claims and causes
104
- > of action, whether now known or unknown (including existing as well as
105
- > future claims and causes of action), in the Work (i) in all territories
106
- > worldwide, (ii) for the maximum duration provided by applicable law or
107
- > treaty (including future time extensions), (iii) in any current or future
108
- > medium and for any number of copies, and (iv) for any purpose whatsoever,
109
- > including without limitation commercial, advertising or promotional
110
- > purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
111
- > member of the public at large and to the detriment of Affirmer's heirs and
112
- > successors, fully intending that such Waiver shall not be subject to
113
- > revocation, rescission, cancellation, termination, or any other legal or
114
- > equitable action to disrupt the quiet enjoyment of the Work by the public
115
- > as contemplated by Affirmer's express Statement of Purpose.
116
- >
117
- > 3. Public License Fallback. Should any part of the Waiver for any reason
118
- > be judged legally invalid or ineffective under applicable law, then the
119
- > Waiver shall be preserved to the maximum extent permitted taking into
120
- > account Affirmer's express Statement of Purpose. In addition, to the
121
- > extent the Waiver is so judged Affirmer hereby grants to each affected
122
- > person a royalty-free, non transferable, non sublicensable, non exclusive,
123
- > irrevocable and unconditional license to exercise Affirmer's Copyright and
124
- > Related Rights in the Work (i) in all territories worldwide, (ii) for the
125
- > maximum duration provided by applicable law or treaty (including future
126
- > time extensions), (iii) in any current or future medium and for any number
127
- > of copies, and (iv) for any purpose whatsoever, including without
128
- > limitation commercial, advertising or promotional purposes (the
129
- > "License"). The License shall be deemed effective as of the date CC0 was
130
- > applied by Affirmer to the Work. Should any part of the License for any
131
- > reason be judged legally invalid or ineffective under applicable law, such
132
- > partial invalidity or ineffectiveness shall not invalidate the remainder
133
- > of the License, and in such case Affirmer hereby affirms that he or she
134
- > will not (i) exercise any of his or her remaining Copyright and Related
135
- > Rights in the Work or (ii) assert any associated claims and causes of
136
- > action with respect to the Work, in either case contrary to Affirmer's
137
- > express Statement of Purpose.
138
- >
139
- > 4. Limitations and Disclaimers.
140
- >
141
- > a. No trademark or patent rights held by Affirmer are waived, abandoned,
142
- > surrendered, licensed or otherwise affected by this document.
143
- > b. Affirmer offers the Work as-is and makes no representations or
144
- > warranties of any kind concerning the Work, express, implied,
145
- > statutory or otherwise, including without limitation warranties of
146
- > title, merchantability, fitness for a particular purpose, non
147
- > infringement, or the absence of latent or other defects, accuracy, or
148
- > the present or absence of errors, whether or not discoverable, all to
149
- > the greatest extent permissible under applicable law.
150
- > c. Affirmer disclaims responsibility for clearing rights of other persons
151
- > that may apply to the Work or any use thereof, including without
152
- > limitation any person's Copyright and Related Rights in the Work.
153
- > Further, Affirmer disclaims responsibility for obtaining any necessary
154
- > consents, permissions or other rights required for any use of the
155
- > Work.
156
- > d. Affirmer understands and acknowledges that Creative Commons is not a
157
- > party to this document and has no duty or obligation with respect to
158
- > this CC0 or use of the Work.
33
+ ## lint-staged
34
+ License: MIT
35
+ By: Andrey Okonetchnikov, Iiro Jäppinen <iiro@jappinen.fi> (https://iiro.fi)
36
+ Repository: git+https://github.com/lint-staged/lint-staged.git
37
+
38
+ > The MIT License (MIT)
39
+ >
40
+ > Copyright (c) 2016 Andrey Okonetchnikov
41
+ >
42
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ > of this software and associated documentation files (the "Software"), to deal
44
+ > in the Software without restriction, including without limitation the rights
45
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ > copies of the Software, and to permit persons to whom the Software is
47
+ > furnished to do so, subject to the following conditions:
48
+ >
49
+ > The above copyright notice and this permission notice shall be included in all
50
+ > copies or substantial portions of the Software.
51
+ >
52
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
+ > SOFTWARE.
159
59
 
160
60
  <!-- /TYPE_DEPENDENCIES -->
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.d.ts CHANGED
@@ -1,34 +1,39 @@
1
- import { Configuration } from 'lint-staged';
2
-
1
+ import 'type-fest';
2
+ type SyncGenerateTask = (stagedFileNames: readonly string[]) => string | string[];
3
+ type AsyncGenerateTask = (stagedFileNames: readonly string[]) => Promise<string | string[]>;
4
+ type GenerateTask = SyncGenerateTask | AsyncGenerateTask;
5
+ type TaskFunction = {
6
+ title: string;
7
+ task: (stagedFileNames: readonly string[]) => void | Promise<void>;
8
+ };
9
+ type Configuration = Record<string, string | TaskFunction | GenerateTask | (string | GenerateTask)[]> | GenerateTask;
3
10
  interface EslintConfig {
4
- cache?: boolean;
5
- config?: string;
6
- extensions?: string[];
7
- "fix-type"?: string[];
8
- "max-warnings"?: number | string | false;
9
- rules?: string[];
11
+ cache?: boolean;
12
+ config?: string;
13
+ extensions?: string[];
14
+ "fix-type"?: string[];
15
+ "max-warnings"?: number | string | false;
16
+ rules?: string[];
10
17
  }
11
-
12
18
  interface StylesheetsConfig {
13
- extensions?: (typeof stylesheetsExtensions)[number][];
19
+ extensions?: (typeof stylesheetsExtensions)[number][];
14
20
  }
15
21
  interface TypescriptConfig {
16
- exclude?: string[];
17
- extensions?: (typeof typescriptExtensions)[number][];
22
+ exclude?: string[];
23
+ extensions?: (typeof typescriptExtensions)[number][];
18
24
  }
19
25
  declare const eslintExtensions: readonly ["cjs", "js", "mjs", "cts", "ts", "mts", "yml", "yaml", "jsx", "tsx", "mdx", "toml", "json", "json5", "jsonc"];
20
26
  declare const typescriptExtensions: readonly ["cts", "ts", "mts", "tsx", "ctsx"];
21
27
  declare const stylesheetsExtensions: readonly ["css", "scss", "sass", "less", "styl", "stylus", "pcss", "postcss", "sss"];
22
28
  declare const defineConfig: (options?: {
23
- cwd?: string;
24
- debug?: boolean;
25
- eslint?: EslintConfig | false;
26
- json?: false;
27
- markdown?: false;
28
- secretlint?: false;
29
- stylesheets?: StylesheetsConfig | false;
30
- tests?: false;
31
- typescript?: TypescriptConfig | false;
29
+ cwd?: string;
30
+ debug?: boolean;
31
+ eslint?: EslintConfig | false;
32
+ json?: false;
33
+ markdown?: false;
34
+ secretlint?: false;
35
+ stylesheets?: StylesheetsConfig | false;
36
+ tests?: false;
37
+ typescript?: TypescriptConfig | false;
32
38
  }) => Configuration;
33
-
34
39
  export { defineConfig, eslintExtensions, stylesheetsExtensions, typescriptExtensions };
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": "10.0.0",
3
+ "version": "11.0.1",
4
4
  "description": "Shareable Lint-Staged Config for any project.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -63,15 +63,15 @@
63
63
  "@visulima/fs": "4.1.0",
64
64
  "@visulima/package": "^4.1.7",
65
65
  "shell-quote": "^1.8.3",
66
- "type-fest": "5.5.0"
66
+ "type-fest": "5.6.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "eslint": "10.1.0",
69
+ "eslint": "10.3.0",
70
70
  "husky": "^9.x",
71
71
  "jest": "^29.0.0",
72
72
  "lint-staged": "^16.x",
73
- "nano-staged": "^0.9.0",
74
- "prettier": "3.8.1",
73
+ "nano-staged": "1.0.2",
74
+ "prettier": "3.8.3",
75
75
  "secretlint": "^11.0.0",
76
76
  "stylelint": "^16.x || ^17.x",
77
77
  "vitest": "^3.x || ^4.x"
@@ -102,9 +102,8 @@
102
102
  "optional": true
103
103
  }
104
104
  },
105
- "optionalDependencies": {},
106
105
  "engines": {
107
- "node": ">=20.18.* <=25.*"
106
+ "node": ">=22.12.0 <=25.*"
108
107
  },
109
108
  "publishConfig": {
110
109
  "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};