@anolilab/lint-staged-config 1.0.1 → 1.1.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 +40 -0
- package/dist/chunk-26UFUGBI.js +11 -0
- package/dist/chunk-26UFUGBI.js.map +1 -0
- package/dist/chunk-32WCNCA6.mjs +8 -0
- package/dist/chunk-32WCNCA6.mjs.map +1 -0
- package/dist/{chunk-2NJHQVOR.mjs → chunk-3GJFQHMH.mjs} +2 -2
- package/dist/{chunk-X6YOEYWM.js → chunk-57F5GRFM.js} +3 -3
- package/dist/chunk-7NERYZQR.mjs +8 -0
- package/dist/{chunk-BVGKAMQV.mjs.map → chunk-7NERYZQR.mjs.map} +1 -1
- package/dist/{chunk-CCERQD4S.js → chunk-B7BKRXC3.js} +1 -1
- package/dist/{chunk-CCERQD4S.js.map → chunk-B7BKRXC3.js.map} +1 -1
- package/dist/{chunk-5AJKEWYR.js → chunk-CZNOXHD3.js} +3 -3
- package/dist/chunk-EFS7QODA.js +15 -0
- package/dist/chunk-EFS7QODA.js.map +1 -0
- package/dist/{chunk-VWUDOPED.js → chunk-FHMGSJ6B.js} +3 -3
- package/dist/{chunk-A5GQULUO.mjs → chunk-JPSOVV4A.mjs} +2 -2
- package/dist/{chunk-QUK4P43M.mjs → chunk-KNLP6LX4.mjs} +2 -2
- package/dist/chunk-KQX2BKNX.mjs +12 -0
- package/dist/chunk-KQX2BKNX.mjs.map +1 -0
- package/dist/chunk-NRIST5UV.js +9 -0
- package/dist/{chunk-MQKG4NW7.mjs → chunk-OKIQX5HY.mjs} +2 -2
- package/dist/chunk-VAUDCZ4C.js +10 -0
- package/dist/{chunk-MCOYFEKC.js.map → chunk-VAUDCZ4C.js.map} +1 -1
- package/dist/{chunk-YUER2OJU.mjs → chunk-WAVKF2WX.mjs} +1 -1
- package/dist/{chunk-YUER2OJU.mjs.map → chunk-WAVKF2WX.mjs.map} +1 -1
- package/dist/groups/eslint/index.js +4 -4
- package/dist/groups/eslint/index.mjs +3 -3
- package/dist/groups/json.js +3 -3
- package/dist/groups/json.mjs +2 -2
- package/dist/groups/markdown.js +3 -3
- package/dist/groups/markdown.mjs +2 -2
- package/dist/groups/stylesheets.js +3 -3
- package/dist/groups/stylesheets.mjs +2 -2
- package/dist/groups/tests.js +3 -3
- package/dist/groups/tests.mjs +2 -2
- package/dist/groups/typescript.js +3 -3
- package/dist/groups/typescript.mjs +2 -2
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/dist/postinstall.js +13 -12
- package/dist/postinstall.js.map +1 -1
- package/dist/postinstall.mjs +13 -12
- package/dist/postinstall.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-5IWFJALT.mjs +0 -12
- package/dist/chunk-5IWFJALT.mjs.map +0 -1
- package/dist/chunk-BVGKAMQV.mjs +0 -8
- package/dist/chunk-GXZBYQVF.js +0 -9
- package/dist/chunk-HAERDTLI.js +0 -11
- package/dist/chunk-HAERDTLI.js.map +0 -1
- package/dist/chunk-MCOYFEKC.js +0 -10
- package/dist/chunk-MKZ4RRUB.mjs +0 -8
- package/dist/chunk-MKZ4RRUB.mjs.map +0 -1
- package/dist/chunk-TWU5ONPK.js +0 -15
- package/dist/chunk-TWU5ONPK.js.map +0 -1
- /package/dist/{chunk-2NJHQVOR.mjs.map → chunk-3GJFQHMH.mjs.map} +0 -0
- /package/dist/{chunk-X6YOEYWM.js.map → chunk-57F5GRFM.js.map} +0 -0
- /package/dist/{chunk-5AJKEWYR.js.map → chunk-CZNOXHD3.js.map} +0 -0
- /package/dist/{chunk-VWUDOPED.js.map → chunk-FHMGSJ6B.js.map} +0 -0
- /package/dist/{chunk-A5GQULUO.mjs.map → chunk-JPSOVV4A.mjs.map} +0 -0
- /package/dist/{chunk-QUK4P43M.mjs.map → chunk-KNLP6LX4.mjs.map} +0 -0
- /package/dist/{chunk-GXZBYQVF.js.map → chunk-NRIST5UV.js.map} +0 -0
- /package/dist/{chunk-MQKG4NW7.mjs.map → chunk-OKIQX5HY.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## @anolilab/lint-staged-config [1.1.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@1.1.0...@anolilab/lint-staged-config@1.1.1) (2023-07-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Revise optional chaining and promise handling in scripts ([4f1d996](https://github.com/anolilab/javascript-style-guide/commit/4f1d9965e862d72d3a50ef8652347d63ac5ef990))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Dependencies
|
|
11
|
+
|
|
12
|
+
* **@anolilab/package-json-utils:** upgraded to 2.0.1
|
|
13
|
+
* **@anolilab/semantic-release-preset:** upgraded to 5.0.1
|
|
14
|
+
|
|
15
|
+
## @anolilab/lint-staged-config [1.1.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@1.0.1...@anolilab/lint-staged-config@1.1.0) (2023-07-03)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Update dependencies version in pnpm-lock.yaml ([1f75f7b](https://github.com/anolilab/javascript-style-guide/commit/1f75f7bec8190da5ae6f2ba7e6ac249d802fabb4))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Styles
|
|
24
|
+
|
|
25
|
+
* "Rearrange order of task definitions and disable ESLint on non-literal fs filename" ([d48a8c0](https://github.com/anolilab/javascript-style-guide/commit/d48a8c0a0f87582e8a7389a4f9e025cdcbb113da))
|
|
26
|
+
* sorted some keys ([dcd5718](https://github.com/anolilab/javascript-style-guide/commit/dcd5718d38849314fce1816f0a2018e45b1a9076))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
* **deps:** update all non-major dependencies ([aad272a](https://github.com/anolilab/javascript-style-guide/commit/aad272ab8efd6f058414e0d2cb5208eb9a5fb3d1))
|
|
32
|
+
* **deps:** update eslint ([c83ef20](https://github.com/anolilab/javascript-style-guide/commit/c83ef20aa4dd8ecaa917089b2ef532730efd8038))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Dependencies
|
|
37
|
+
|
|
38
|
+
* **@anolilab/package-json-utils:** upgraded to 2.0.0
|
|
39
|
+
* **@anolilab/semantic-release-preset:** upgraded to 5.0.0
|
|
40
|
+
|
|
1
41
|
## @anolilab/lint-staged-config [1.0.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@1.0.0...@anolilab/lint-staged-config@1.0.1) (2023-06-29)
|
|
2
42
|
|
|
3
43
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var shellQuote = require('shell-quote');
|
|
4
|
+
var process = require('process');
|
|
5
|
+
|
|
6
|
+
var n=process.platform==="win32"||/^(msys|cygwin)$/.test(process.env.OSTYPE??""),t=n;var p=i=>i.map(o=>`"${t?o:shellQuote.quote([o])}"`).join(" "),d=p;
|
|
7
|
+
|
|
8
|
+
exports.a = t;
|
|
9
|
+
exports.b = d;
|
|
10
|
+
//# sourceMappingURL=out.js.map
|
|
11
|
+
//# sourceMappingURL=chunk-26UFUGBI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","platform","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,EAAK,YAAAC,MAAgB,UAG9B,IAAMC,EAAYD,IAAa,SAAW,kBAAkB,KAAKD,EAAI,QAAa,EAAE,EAE7EG,EAAQD,EDUf,IAAME,EAAeC,GAAgCA,EAAU,IAAKC,GAAa,IAAIH,EAAYG,EAAWP,EAAM,CAACO,CAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,GAAG,EAEnIC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string => filenames.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`).join(\" \");\n\nexport default concatFiles;\n","import { env, platform } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = platform === \"win32\" || /^(msys|cygwin)$/.test(env[\"OSTYPE\"] ?? \"\");\n\nexport default isWindows;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { quote } from 'shell-quote';
|
|
2
|
+
import { platform, env } from 'process';
|
|
3
|
+
|
|
4
|
+
var n=platform==="win32"||/^(msys|cygwin)$/.test(env.OSTYPE??""),t=n;var p=i=>i.map(o=>`"${t?o:quote([o])}"`).join(" "),d=p;
|
|
5
|
+
|
|
6
|
+
export { t as a, d as b };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-32WCNCA6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","platform","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,EAAK,YAAAC,MAAgB,UAG9B,IAAMC,EAAYD,IAAa,SAAW,kBAAkB,KAAKD,EAAI,QAAa,EAAE,EAE7EG,EAAQD,EDUf,IAAME,EAAeC,GAAgCA,EAAU,IAAKC,GAAa,IAAIH,EAAYG,EAAWP,EAAM,CAACO,CAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,GAAG,EAEnIC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string => filenames.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`).join(\" \");\n\nexport default concatFiles;\n","import { env, platform } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = platform === \"win32\" || /^(msys|cygwin)$/.test(env[\"OSTYPE\"] ?? \"\");\n\nexport default isWindows;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b } from './chunk-
|
|
1
|
+
import { b } from './chunk-32WCNCA6.mjs';
|
|
2
2
|
|
|
3
3
|
var i={[`*.{${["css","sass","scss","less"].join(",")}}`]:t=>[`prettier --ignore-unknown --write ${b(t)}`,"stylelint --fix"]},n=i;
|
|
4
4
|
|
|
5
5
|
export { n as a };
|
|
6
6
|
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-3GJFQHMH.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
4
4
|
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
5
|
|
|
6
|
-
var a=packageJsonUtils.hasDependency("sort-package-json")||packageJsonUtils.hasDevDependency("sort-package-json"),t={[`*.{${["json","json5","jsonc"].join(",")}}`]:o=>[`prettier --write ${
|
|
6
|
+
var a=packageJsonUtils.hasDependency("sort-package-json")||packageJsonUtils.hasDevDependency("sort-package-json"),t={[`*.{${["json","json5","jsonc"].join(",")}}`]:o=>[`prettier --write ${chunk26UFUGBI_js.b(o)}`],...a?{"package.json,{packages,apps}/*/package.json":o=>[`sort-package-json ${chunk26UFUGBI_js.b(o)}`]}:{}},c=t;
|
|
7
7
|
|
|
8
8
|
exports.a = c;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-57F5GRFM.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b } from './chunk-32WCNCA6.mjs';
|
|
2
|
+
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
|
+
|
|
4
|
+
var n=hasDependency("vitest")||hasDevDependency("vitest"),i=hasDependency("jest")||hasDevDependency("jest"),j=hasDependency("ava")||hasDevDependency("ava"),d={...n&&{"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["vitest related --run"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["vitest related --run"]},...i&&{"**/*.spec.{js,ts,tsx}":["jest --findRelatedTests"],"**/*.test.{js,ts,tsx}":["jest --findRelatedTests"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/__mocks__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/__tests__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/test/*.{js,ts,tsx}":["jest --findRelatedTests"]},...j&&{"**/(test|tests|__tests__)/**/*.js":t=>[`ava ${b(t)}`],"**/*.(spec|test).js":t=>[`ava ${b(t)}`],"**/test.js":t=>[`ava ${b(t)}`],"**/test-*.js":t=>[`ava ${b(t)}`]}},o=d;
|
|
5
|
+
|
|
6
|
+
export { o as a };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-7NERYZQR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/groups/tests.ts"],"names":["hasDependency","hasDevDependency","hasVitest","hasJest","hasAva","group","filenames","concat_files_default","tests_default"],"mappings":"yCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAYF,EAAc,QAAQ,GAAKC,EAAiB,QAAQ,EAChEE,EAAUH,EAAc,MAAM,GAAKC,EAAiB,MAAM,EAC1DG,EAASJ,EAAc,KAAK,GAAKC,EAAiB,KAAK,EAEvDI,EAAgB,CAClB,GAAIH,GAAa,CAAE,
|
|
1
|
+
{"version":3,"sources":["../src/groups/tests.ts"],"names":["hasDependency","hasDevDependency","hasVitest","hasJest","hasAva","group","filenames","concat_files_default","tests_default"],"mappings":"yCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAYF,EAAc,QAAQ,GAAKC,EAAiB,QAAQ,EAChEE,EAAUH,EAAc,MAAM,GAAKC,EAAiB,MAAM,EAC1DG,EAASJ,EAAc,KAAK,GAAKC,EAAiB,KAAK,EAEvDI,EAAgB,CAClB,GAAIH,GAAa,CAAE,sCAAuC,CAAC,sBAAsB,EAAG,oCAAqC,CAAC,sBAAsB,CAAE,EAClJ,GAAIC,GAAW,CACX,wBAAyB,CAAC,yBAAyB,EACnD,wBAAyB,CAAC,yBAAyB,EACnD,sCAAuC,CAAC,yBAAyB,EACjE,6BAA8B,CAAC,yBAAyB,EACxD,oCAAqC,CAAC,yBAAyB,EAC/D,6BAA8B,CAAC,yBAAyB,EACxD,wBAAyB,CAAC,yBAAyB,CACvD,EACA,GAAIC,GAAU,CACV,oCAAsCE,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EAC9F,sBAAwBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EAChF,aAAeA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EACvE,eAAiBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,CAC7E,CACJ,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst hasVitest = hasDependency(\"vitest\") || hasDevDependency(\"vitest\");\nconst hasJest = hasDependency(\"jest\") || hasDevDependency(\"jest\");\nconst hasAva = hasDependency(\"ava\") || hasDevDependency(\"ava\");\n\nconst group: Config = {\n ...(hasVitest && { \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"vitest related --run\"], \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"vitest related --run\"] }),\n ...(hasJest && {\n \"**/*.spec.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/*.test.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n \"**/__mocks__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n \"**/__tests__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/test/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n }),\n ...(hasAva && {\n \"**/(test|tests|__tests__)/**/*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/*.(spec|test).js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/test.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/test-*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n }),\n};\n\nexport default group;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAMOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport type AbsolutePath = `/${string}`;\nexport type ConfigFileName = string;\nexport type ConfigPath<A extends AbsolutePath, N extends ConfigFileName> = Join<[A, N], \"/\">;\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
4
4
|
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
5
|
|
|
6
|
-
global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));var a={"**/*.md":i=>[`prettier --write ${
|
|
6
|
+
global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));var a={"**/*.md":i=>[`prettier --write ${chunk26UFUGBI_js.b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${chunk26UFUGBI_js.b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${chunk26UFUGBI_js.b(i)}`]:[]],"**/*.mdx":i=>[`prettier --write ${chunk26UFUGBI_js.b(i)}`]},r=a;
|
|
7
7
|
|
|
8
8
|
exports.a = r;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-CZNOXHD3.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkB7BKRXC3_js = require('./chunk-B7BKRXC3.js');
|
|
4
|
+
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
5
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var eslint = require('eslint');
|
|
8
|
+
var shellQuote = require('shell-quote');
|
|
9
|
+
|
|
10
|
+
!global.anolilabLintStagedPackageJsonConfig&&packageJsonUtils.pkg&&(global.anolilabLintStagedPackageJsonConfig=packageJsonUtils.pkg.anolilab?.["lint-staged-config"]);var $=global.anolilabLintStagedPackageJsonConfig??{},u=$;var k=n=>{let t={};return n.forEach(s=>{let i=path.dirname(s);t[i]||(t[i]=[]),t[i].push(s);}),t},p=k;var F=async n=>{let t=new eslint.ESLint,s=await Promise.all(n.map(async o=>await t.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${chunk26UFUGBI_js.a?o:shellQuote.quote([o])}"`)},h=F;var e=u.settings.eslint??{},y=["react-hooks/exhaustive-deps: off"],r=".eslintrc",A=()=>{let n=[];e?.["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e?.["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[];e?.rules!==void 0&&Array.isArray(e.rules)?t.push([...e.rules,...y].filter(i=>i.trim().length>0).map(i=>`"${i.trim()}"`)):t.push(y.map(i=>`"${i.trim()}"`)),t.length>0&&n.push(`--rule ${t.join(" --rule ")}`);let s=[...e?.["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e?.cache&&n.push("--cache"),n},E=async n=>{let t=await h(n),s=A();if(e?.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${t.join(" ")}`];let i=p(t),o=[];return Object.values(i).forEach(a=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach(S=>{if(!l)try{l=chunkB7BKRXC3_js.a(S,a[0]);}catch{}}),l&&o.push(`cross-env NO_LOGS=true eslint ${s.join(" ")} --config ${l} ${a.join(" ")}`);}),o},g=E;var x=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml"];global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));!global.hasAnolilabLintStagedMarkdownCli&&!global.hasAnolilabLintStagedMarkdownCli2&&x.push("md");var N={[`*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await g(n)],[`*.{${[x].join(",")}}`]:async n=>[`prettier --write ${chunk26UFUGBI_js.b(n)}`,...await g(n)]},K=N;
|
|
11
|
+
|
|
12
|
+
exports.a = u;
|
|
13
|
+
exports.b = K;
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-EFS7QODA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/eslint/index.ts","../src/utils/lint-staged-config.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts","../src/groups/eslint/create-eslint-commands.ts"],"names":["hasDependency","hasDevDependency","pkg","config","lint_staged_config_default","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","r","fixType","type","createEslintCommands","filteredFiles","groupedFilesNames","eslintCommands","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"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","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport createEslintCommands from \"./create-eslint-commands\";\n\nconst extensions = [\"cjs\", \"js\", \"mjs\", \"cts\", \"ts\", \"mts\", \"yml\", \"yaml\", \"jsx\", \"tsx\", \"mdx\", \"toml\"];\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli && !global.hasAnolilabLintStagedMarkdownCli2) {\n extensions.push(\"md\");\n}\n\nconst group: Config = {\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n [`*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n `prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: { [key: string]: boolean | undefined } = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): { [key: string]: string[] } => {\n const groups: { [key: string]: string[] } = {};\n\n filePaths.forEach((filePath) => {\n const directoryName = dirname(filePath);\n\n // eslint-disable-next-line security/detect-object-injection\n if (!groups[directoryName]) {\n // eslint-disable-next-line security/detect-object-injection\n groups[directoryName] = [];\n }\n // eslint-disable-next-line security/detect-object-injection\n (groups[directoryName] as string[]).push(filePath);\n });\n\n return groups;\n};\n\nexport default groupFilePathsByDirectoryName;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ESLint } from \"eslint\";\nimport { quote } from \"shell-quote\";\n\nimport isWindows from \"../../utils/is-windows\";\n\nconst removeIgnoredFiles = async (filenames: string[]): Promise<string[]> => {\n const eslint = new ESLint();\n // eslint-disable-next-line compat/compat\n const ignoredFiles = await Promise.all(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n // eslint-disable-next-line security/detect-object-injection\n const filteredFiles = filenames.filter((_, index) => !ignoredFiles[index]);\n\n return filteredFiles.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`);\n};\n\nexport default removeIgnoredFiles;\n","import getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ntype ESLintSettings = {\n settings: {\n eslint?: {\n cache?: boolean;\n config?: string;\n \"fix-type\": string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n };\n };\n};\n\nconst eslintSettings: ESLintSettings[\"settings\"][\"eslint\"] =\n (anolilabLintStagedConfig as unknown as ESLintSettings).settings.eslint ?? ({} as ESLintSettings[\"settings\"][\"eslint\"]);\n\nconst eslintGlobalRulesForFix = [\n // react-hooks/eslint and react in general is very strict about exhaustively\n // declaring the dependencies when using the useEffect, useCallback... hooks.\n //\n // In some specific scenarios declaring the deps seems 'less' wanted or 'less' applicable\n // by the developer, leading to some exceptions in the code. That said it should be avoided.\n //\n // While the 'react-hooks/exhaustive-deps' rule is a good rule of thumb, it's not recommended to\n // automatically fix it from lint-staged as it can potentially break a legit intent.\n //\n // Reminder that a good practice is to always declare the dependencies when using the hooks,\n // and if not applicable, add an eslint disable comment to the useEffect, useCallback... such as:\n //\n // // eslint-disable-next-line react-hooks/exhaustive-deps\n //\n // Another approach can be to use hooks such as https://github.com/kentcdodds/use-deep-compare-effect to quickly bypass\n // shallow rendering limitations.\n //\n // @see https://reactjs.org/docs/hooks-rules.html\n // @see https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments\n \"react-hooks/exhaustive-deps: off\",\n];\n\nconst configFile = \".eslintrc\";\n\nconst createEslintArguments = (): string[] => {\n const eslintArguments: string[] = [];\n\n if (eslintSettings?.[\"max-warnings\"] !== undefined && Number.isNaN(eslintSettings[\"max-warnings\"])) {\n eslintArguments.push(`--max-warnings=${eslintSettings[\"max-warnings\"]}`);\n } else if (eslintSettings?.[\"max-warnings\"] !== false) {\n eslintArguments.push(\"--max-warnings=0\");\n }\n\n const rules = [];\n\n if (eslintSettings?.rules !== undefined && Array.isArray(eslintSettings.rules)) {\n rules.push([...eslintSettings.rules, ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0).map((r) => `\"${r.trim()}\"`));\n } else {\n rules.push(eslintGlobalRulesForFix.map((r) => `\"${r.trim()}\"`));\n }\n\n if (rules.length > 0) {\n eslintArguments.push(`--rule ${rules.join(\" --rule \")}`);\n }\n\n // For lint-staged it's safer to not apply the fix command if it changes the AST\n // @see https://eslint.org/docs/user-guide/command-line-interface#--fix-type\n const fixType = [...(eslintSettings?.[\"fix-type\"] ?? [\"layout\"])].filter((type) => type.trim().length > 0);\n\n if (fixType.length > 0) {\n eslintArguments.push(`--fix-type ${fixType.join(\",\")}`, \"--fix\");\n }\n\n if (eslintSettings?.cache) {\n eslintArguments.push(\"--cache\");\n }\n\n return eslintArguments;\n};\n\nconst createEslintCommands = async (filenames: string[]): Promise<string[]> => {\n const filteredFiles = await removeIgnoredFiles(filenames);\n\n const eslintArguments = createEslintArguments();\n\n if (eslintSettings?.config) {\n eslintArguments.push(`--config ${eslintSettings.config}`);\n\n return [`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} ${filteredFiles.join(\" \")}`];\n }\n\n const groupedFilesNames = groupFilePathsByDirectoryName(filteredFiles);\n const eslintCommands: string[] = [];\n\n Object.values(groupedFilesNames).forEach((filePaths) => {\n let config: string | undefined;\n\n [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`].forEach((configName) => {\n if (config) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-template-curly-in-string\n config = getNearestConfigPath(configName, filePaths[0] as \"/${string}\");\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkB7BKRXC3_js = require('./chunk-B7BKRXC3.js');
|
|
4
4
|
var process = require('process');
|
|
5
5
|
|
|
6
|
-
var i={[`*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=
|
|
6
|
+
var i={[`*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=chunkB7BKRXC3_js.a("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){process.env.DEBUG&&console.error(t);}}),[...o]}},f=i;
|
|
7
7
|
|
|
8
8
|
exports.a = f;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-FHMGSJ6B.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-WAVKF2WX.mjs';
|
|
2
2
|
import { env } from 'process';
|
|
3
3
|
|
|
4
4
|
var i={[`*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=a("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){env.DEBUG&&console.error(t);}}),[...o]}},f=i;
|
|
5
5
|
|
|
6
6
|
export { f as a };
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-JPSOVV4A.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b } from './chunk-
|
|
1
|
+
import { b } from './chunk-32WCNCA6.mjs';
|
|
2
2
|
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
3
|
|
|
4
4
|
global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));var a={"**/*.md":i=>[`prettier --write ${b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${b(i)}`]:[]],"**/*.mdx":i=>[`prettier --write ${b(i)}`]},r=a;
|
|
5
5
|
|
|
6
6
|
export { r as a };
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-KNLP6LX4.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a } from './chunk-WAVKF2WX.mjs';
|
|
2
|
+
import { b, a as a$1 } from './chunk-32WCNCA6.mjs';
|
|
3
|
+
import { pkg, hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
import { ESLint } from 'eslint';
|
|
6
|
+
import { quote } from 'shell-quote';
|
|
7
|
+
|
|
8
|
+
!global.anolilabLintStagedPackageJsonConfig&&pkg&&(global.anolilabLintStagedPackageJsonConfig=pkg.anolilab?.["lint-staged-config"]);var $=global.anolilabLintStagedPackageJsonConfig??{},u=$;var k=n=>{let t={};return n.forEach(s=>{let i=dirname(s);t[i]||(t[i]=[]),t[i].push(s);}),t},p=k;var F=async n=>{let t=new ESLint,s=await Promise.all(n.map(async o=>await t.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${a$1?o:quote([o])}"`)},h=F;var e=u.settings.eslint??{},y=["react-hooks/exhaustive-deps: off"],r=".eslintrc",A=()=>{let n=[];e?.["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e?.["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[];e?.rules!==void 0&&Array.isArray(e.rules)?t.push([...e.rules,...y].filter(i=>i.trim().length>0).map(i=>`"${i.trim()}"`)):t.push(y.map(i=>`"${i.trim()}"`)),t.length>0&&n.push(`--rule ${t.join(" --rule ")}`);let s=[...e?.["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e?.cache&&n.push("--cache"),n},E=async n=>{let t=await h(n),s=A();if(e?.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${t.join(" ")}`];let i=p(t),o=[];return Object.values(i).forEach(a$1=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach(S=>{if(!l)try{l=a(S,a$1[0]);}catch{}}),l&&o.push(`cross-env NO_LOGS=true eslint ${s.join(" ")} --config ${l} ${a$1.join(" ")}`);}),o},g=E;var x=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml"];global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));!global.hasAnolilabLintStagedMarkdownCli&&!global.hasAnolilabLintStagedMarkdownCli2&&x.push("md");var N={[`*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await g(n)],[`*.{${[x].join(",")}}`]:async n=>[`prettier --write ${b(n)}`,...await g(n)]},K=N;
|
|
9
|
+
|
|
10
|
+
export { u as a, K as b };
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=chunk-KQX2BKNX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/eslint/index.ts","../src/utils/lint-staged-config.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts","../src/groups/eslint/create-eslint-commands.ts"],"names":["hasDependency","hasDevDependency","pkg","config","lint_staged_config_default","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","r","fixType","type","createEslintCommands","filteredFiles","groupedFilesNames","eslintCommands","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"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","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport createEslintCommands from \"./create-eslint-commands\";\n\nconst extensions = [\"cjs\", \"js\", \"mjs\", \"cts\", \"ts\", \"mts\", \"yml\", \"yaml\", \"jsx\", \"tsx\", \"mdx\", \"toml\"];\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli && !global.hasAnolilabLintStagedMarkdownCli2) {\n extensions.push(\"md\");\n}\n\nconst group: Config = {\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n [`*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n `prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: { [key: string]: boolean | undefined } = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): { [key: string]: string[] } => {\n const groups: { [key: string]: string[] } = {};\n\n filePaths.forEach((filePath) => {\n const directoryName = dirname(filePath);\n\n // eslint-disable-next-line security/detect-object-injection\n if (!groups[directoryName]) {\n // eslint-disable-next-line security/detect-object-injection\n groups[directoryName] = [];\n }\n // eslint-disable-next-line security/detect-object-injection\n (groups[directoryName] as string[]).push(filePath);\n });\n\n return groups;\n};\n\nexport default groupFilePathsByDirectoryName;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ESLint } from \"eslint\";\nimport { quote } from \"shell-quote\";\n\nimport isWindows from \"../../utils/is-windows\";\n\nconst removeIgnoredFiles = async (filenames: string[]): Promise<string[]> => {\n const eslint = new ESLint();\n // eslint-disable-next-line compat/compat\n const ignoredFiles = await Promise.all(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n // eslint-disable-next-line security/detect-object-injection\n const filteredFiles = filenames.filter((_, index) => !ignoredFiles[index]);\n\n return filteredFiles.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`);\n};\n\nexport default removeIgnoredFiles;\n","import getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ntype ESLintSettings = {\n settings: {\n eslint?: {\n cache?: boolean;\n config?: string;\n \"fix-type\": string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n };\n };\n};\n\nconst eslintSettings: ESLintSettings[\"settings\"][\"eslint\"] =\n (anolilabLintStagedConfig as unknown as ESLintSettings).settings.eslint ?? ({} as ESLintSettings[\"settings\"][\"eslint\"]);\n\nconst eslintGlobalRulesForFix = [\n // react-hooks/eslint and react in general is very strict about exhaustively\n // declaring the dependencies when using the useEffect, useCallback... hooks.\n //\n // In some specific scenarios declaring the deps seems 'less' wanted or 'less' applicable\n // by the developer, leading to some exceptions in the code. That said it should be avoided.\n //\n // While the 'react-hooks/exhaustive-deps' rule is a good rule of thumb, it's not recommended to\n // automatically fix it from lint-staged as it can potentially break a legit intent.\n //\n // Reminder that a good practice is to always declare the dependencies when using the hooks,\n // and if not applicable, add an eslint disable comment to the useEffect, useCallback... such as:\n //\n // // eslint-disable-next-line react-hooks/exhaustive-deps\n //\n // Another approach can be to use hooks such as https://github.com/kentcdodds/use-deep-compare-effect to quickly bypass\n // shallow rendering limitations.\n //\n // @see https://reactjs.org/docs/hooks-rules.html\n // @see https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments\n \"react-hooks/exhaustive-deps: off\",\n];\n\nconst configFile = \".eslintrc\";\n\nconst createEslintArguments = (): string[] => {\n const eslintArguments: string[] = [];\n\n if (eslintSettings?.[\"max-warnings\"] !== undefined && Number.isNaN(eslintSettings[\"max-warnings\"])) {\n eslintArguments.push(`--max-warnings=${eslintSettings[\"max-warnings\"]}`);\n } else if (eslintSettings?.[\"max-warnings\"] !== false) {\n eslintArguments.push(\"--max-warnings=0\");\n }\n\n const rules = [];\n\n if (eslintSettings?.rules !== undefined && Array.isArray(eslintSettings.rules)) {\n rules.push([...eslintSettings.rules, ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0).map((r) => `\"${r.trim()}\"`));\n } else {\n rules.push(eslintGlobalRulesForFix.map((r) => `\"${r.trim()}\"`));\n }\n\n if (rules.length > 0) {\n eslintArguments.push(`--rule ${rules.join(\" --rule \")}`);\n }\n\n // For lint-staged it's safer to not apply the fix command if it changes the AST\n // @see https://eslint.org/docs/user-guide/command-line-interface#--fix-type\n const fixType = [...(eslintSettings?.[\"fix-type\"] ?? [\"layout\"])].filter((type) => type.trim().length > 0);\n\n if (fixType.length > 0) {\n eslintArguments.push(`--fix-type ${fixType.join(\",\")}`, \"--fix\");\n }\n\n if (eslintSettings?.cache) {\n eslintArguments.push(\"--cache\");\n }\n\n return eslintArguments;\n};\n\nconst createEslintCommands = async (filenames: string[]): Promise<string[]> => {\n const filteredFiles = await removeIgnoredFiles(filenames);\n\n const eslintArguments = createEslintArguments();\n\n if (eslintSettings?.config) {\n eslintArguments.push(`--config ${eslintSettings.config}`);\n\n return [`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} ${filteredFiles.join(\" \")}`];\n }\n\n const groupedFilesNames = groupFilePathsByDirectoryName(filteredFiles);\n const eslintCommands: string[] = [];\n\n Object.values(groupedFilesNames).forEach((filePaths) => {\n let config: string | undefined;\n\n [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`].forEach((configName) => {\n if (config) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-template-curly-in-string\n config = getNearestConfigPath(configName, filePaths[0] as \"/${string}\");\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
4
|
+
|
|
5
|
+
var i={[`*.{${["css","sass","scss","less"].join(",")}}`]:t=>[`prettier --ignore-unknown --write ${chunk26UFUGBI_js.b(t)}`,"stylelint --fix"]},n=i;
|
|
6
|
+
|
|
7
|
+
exports.a = n;
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-NRIST5UV.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b } from './chunk-
|
|
1
|
+
import { b } from './chunk-32WCNCA6.mjs';
|
|
2
2
|
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
3
|
|
|
4
4
|
var a=hasDependency("sort-package-json")||hasDevDependency("sort-package-json"),t={[`*.{${["json","json5","jsonc"].join(",")}}`]:o=>[`prettier --write ${b(o)}`],...a?{"package.json,{packages,apps}/*/package.json":o=>[`sort-package-json ${b(o)}`]}:{}},c=t;
|
|
5
5
|
|
|
6
6
|
export { c as a };
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-OKIQX5HY.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
|
+
|
|
6
|
+
var n=packageJsonUtils.hasDependency("vitest")||packageJsonUtils.hasDevDependency("vitest"),i=packageJsonUtils.hasDependency("jest")||packageJsonUtils.hasDevDependency("jest"),j=packageJsonUtils.hasDependency("ava")||packageJsonUtils.hasDevDependency("ava"),d={...n&&{"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["vitest related --run"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["vitest related --run"]},...i&&{"**/*.spec.{js,ts,tsx}":["jest --findRelatedTests"],"**/*.test.{js,ts,tsx}":["jest --findRelatedTests"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/__mocks__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/__tests__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/test/*.{js,ts,tsx}":["jest --findRelatedTests"]},...j&&{"**/(test|tests|__tests__)/**/*.js":t=>[`ava ${chunk26UFUGBI_js.b(t)}`],"**/*.(spec|test).js":t=>[`ava ${chunk26UFUGBI_js.b(t)}`],"**/test.js":t=>[`ava ${chunk26UFUGBI_js.b(t)}`],"**/test-*.js":t=>[`ava ${chunk26UFUGBI_js.b(t)}`]}},o=d;
|
|
7
|
+
|
|
8
|
+
exports.a = o;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-VAUDCZ4C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/groups/tests.ts"],"names":["hasDependency","hasDevDependency","hasVitest","hasJest","hasAva","group","filenames","concat_files_default","tests_default"],"mappings":"wCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAYF,EAAc,QAAQ,GAAKC,EAAiB,QAAQ,EAChEE,EAAUH,EAAc,MAAM,GAAKC,EAAiB,MAAM,EAC1DG,EAASJ,EAAc,KAAK,GAAKC,EAAiB,KAAK,EAEvDI,EAAgB,CAClB,GAAIH,GAAa,CAAE,
|
|
1
|
+
{"version":3,"sources":["../src/groups/tests.ts"],"names":["hasDependency","hasDevDependency","hasVitest","hasJest","hasAva","group","filenames","concat_files_default","tests_default"],"mappings":"wCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAYF,EAAc,QAAQ,GAAKC,EAAiB,QAAQ,EAChEE,EAAUH,EAAc,MAAM,GAAKC,EAAiB,MAAM,EAC1DG,EAASJ,EAAc,KAAK,GAAKC,EAAiB,KAAK,EAEvDI,EAAgB,CAClB,GAAIH,GAAa,CAAE,sCAAuC,CAAC,sBAAsB,EAAG,oCAAqC,CAAC,sBAAsB,CAAE,EAClJ,GAAIC,GAAW,CACX,wBAAyB,CAAC,yBAAyB,EACnD,wBAAyB,CAAC,yBAAyB,EACnD,sCAAuC,CAAC,yBAAyB,EACjE,6BAA8B,CAAC,yBAAyB,EACxD,oCAAqC,CAAC,yBAAyB,EAC/D,6BAA8B,CAAC,yBAAyB,EACxD,wBAAyB,CAAC,yBAAyB,CACvD,EACA,GAAIC,GAAU,CACV,oCAAsCE,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EAC9F,sBAAwBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EAChF,aAAeA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,EACvE,eAAiBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,CAAC,EAAE,CAC7E,CACJ,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst hasVitest = hasDependency(\"vitest\") || hasDevDependency(\"vitest\");\nconst hasJest = hasDependency(\"jest\") || hasDevDependency(\"jest\");\nconst hasAva = hasDependency(\"ava\") || hasDevDependency(\"ava\");\n\nconst group: Config = {\n ...(hasVitest && { \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"vitest related --run\"], \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"vitest related --run\"] }),\n ...(hasJest && {\n \"**/*.spec.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/*.test.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n \"**/__mocks__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n \"**/__tests__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/test/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n }),\n ...(hasAva && {\n \"**/(test|tests|__tests__)/**/*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/*.(spec|test).js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/test.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/test-*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n }),\n};\n\nexport default group;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAMOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport type AbsolutePath = `/${string}`;\nexport type ConfigFileName = string;\nexport type ConfigPath<A extends AbsolutePath, N extends ConfigFileName> = Join<[A, N], \"/\">;\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
3
|
+
var chunkEFS7QODA_js = require('../../chunk-EFS7QODA.js');
|
|
4
|
+
require('../../chunk-B7BKRXC3.js');
|
|
5
|
+
require('../../chunk-26UFUGBI.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
module.exports =
|
|
9
|
+
module.exports = chunkEFS7QODA_js.b;
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { b as default } from '../../chunk-KQX2BKNX.mjs';
|
|
2
|
+
import '../../chunk-WAVKF2WX.mjs';
|
|
3
|
+
import '../../chunk-32WCNCA6.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
package/dist/groups/json.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunk57F5GRFM_js = require('../chunk-57F5GRFM.js');
|
|
4
|
+
require('../chunk-26UFUGBI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunk57F5GRFM_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=json.js.map
|
package/dist/groups/json.mjs
CHANGED
package/dist/groups/markdown.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkCZNOXHD3_js = require('../chunk-CZNOXHD3.js');
|
|
4
|
+
require('../chunk-26UFUGBI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunkCZNOXHD3_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=markdown.js.map
|
package/dist/groups/markdown.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkNRIST5UV_js = require('../chunk-NRIST5UV.js');
|
|
4
|
+
require('../chunk-26UFUGBI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunkNRIST5UV_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=stylesheets.js.map
|
package/dist/groups/tests.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkVAUDCZ4C_js = require('../chunk-VAUDCZ4C.js');
|
|
4
|
+
require('../chunk-26UFUGBI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunkVAUDCZ4C_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=tests.js.map
|
package/dist/groups/tests.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkFHMGSJ6B_js = require('../chunk-FHMGSJ6B.js');
|
|
4
|
+
require('../chunk-B7BKRXC3.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunkFHMGSJ6B_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=typescript.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkFHMGSJ6B_js = require('./chunk-FHMGSJ6B.js');
|
|
4
|
+
var chunkEFS7QODA_js = require('./chunk-EFS7QODA.js');
|
|
5
|
+
require('./chunk-B7BKRXC3.js');
|
|
6
|
+
var chunk57F5GRFM_js = require('./chunk-57F5GRFM.js');
|
|
7
|
+
var chunkCZNOXHD3_js = require('./chunk-CZNOXHD3.js');
|
|
8
8
|
var chunk6EWZW5LF_js = require('./chunk-6EWZW5LF.js');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
9
|
+
var chunkNRIST5UV_js = require('./chunk-NRIST5UV.js');
|
|
10
|
+
var chunkVAUDCZ4C_js = require('./chunk-VAUDCZ4C.js');
|
|
11
|
+
require('./chunk-26UFUGBI.js');
|
|
12
12
|
var process = require('process');
|
|
13
13
|
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
14
14
|
|
|
15
|
-
var N=[{configName:"eslint",
|
|
15
|
+
var N=[{config:chunkEFS7QODA_js.b,configName:"eslint",dependencies:["prettier","eslint"]},{config:chunk57F5GRFM_js.a,configName:"json",dependencies:["prettier","sort-package-json"]},{config:chunkCZNOXHD3_js.a,configName:"markdown",dependencies:["prettier","markdownlint-cli","markdownlint-cli2"]},{config:chunk6EWZW5LF_js.a,configName:"secretlint",dependencies:["secretlint"]},{config:chunkNRIST5UV_js.a,configName:"stylesheets",dependencies:["stylelint"]},{config:chunkVAUDCZ4C_js.a,configName:"tests",dependencies:["vite","jest","ava"]},{config:chunkFHMGSJ6B_js.a,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};N.forEach(s=>{let{config:o,configName:i,dependencies:l}=s;if(chunkEFS7QODA_js.a.plugin?.[i]!==!1){let t=[];l.forEach(e=>{(packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e))&&t.push(e);}),t.length>0?(g={...g,...o},r.push(i)):(a[i]={},l.forEach(e=>{a[i][e]=packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e);}));}});var k={...g};var L=()=>{},j=s=>process.env.NO_LOGS?L:o=>console.log(`${s}${o}`),O=j(""),n=O;if(!global.hasAnolilabStagedLintConfigLoaded){process.env.DEBUG&&(n(`
|
|
16
16
|
@anolilab/lint-stage-config loaded the following plugins:
|
|
17
|
-
`),r.forEach(
|
|
18
|
-
Your package.json container dependencies for the "${
|
|
19
|
-
To disable this message, add the following to your package.json:`),
|
|
20
|
-
`)),
|
|
17
|
+
`),r.forEach(o=>{n(` ${o}`);}));let s=!1;Object.entries(a).forEach(([o,i])=>{Object.values(i).some(Boolean)&&(s=!0,n(`
|
|
18
|
+
Your package.json container dependencies for the "${o}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(i).forEach(([t,e])=>{e||n(` ${t}`);}));}),s&&(n(`
|
|
19
|
+
To disable this message, add the following to your package.json:`),n(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
|
|
20
|
+
`)),n('To disable all logging, add the following to your eslint command call "NO_LOGS=true eslint ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
|
|
21
21
|
|
|
22
22
|
module.exports = k;
|
|
23
23
|
//# sourceMappingURL=out.js.map
|