@anolilab/lint-staged-config 2.1.2 → 2.1.3

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/chunk-ALAT5PPB.js +9 -0
  3. package/dist/chunk-ALAT5PPB.js.map +1 -0
  4. package/dist/chunk-D3D2GYNE.js +12 -0
  5. package/dist/chunk-D3D2GYNE.js.map +1 -0
  6. package/dist/chunk-EJ5WBPGD.js +12 -0
  7. package/dist/chunk-EJ5WBPGD.js.map +1 -0
  8. package/dist/chunk-EM7AZLVF.mjs +10 -0
  9. package/dist/chunk-EM7AZLVF.mjs.map +1 -0
  10. package/dist/chunk-GZMUS57R.mjs +19 -0
  11. package/dist/chunk-GZMUS57R.mjs.map +1 -0
  12. package/dist/chunk-LJGFRIQ4.mjs +7 -0
  13. package/dist/chunk-LJGFRIQ4.mjs.map +1 -0
  14. package/dist/chunk-MCRCUVTY.mjs +10 -0
  15. package/dist/chunk-MCRCUVTY.mjs.map +1 -0
  16. package/dist/{chunk-OHF7NDU3.js → chunk-WCBUC3W3.js} +5 -4
  17. package/dist/chunk-WCBUC3W3.js.map +1 -0
  18. package/dist/groups/eslint/index.js +3 -2
  19. package/dist/groups/eslint/index.mjs +2 -1
  20. package/dist/groups/markdown.js +3 -2
  21. package/dist/groups/markdown.mjs +2 -1
  22. package/dist/groups/stylesheets.js +3 -2
  23. package/dist/groups/stylesheets.mjs +2 -1
  24. package/dist/index.js +9 -8
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +13 -12
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-4PAU4XRY.js +0 -11
  30. package/dist/chunk-4PAU4XRY.js.map +0 -1
  31. package/dist/chunk-5J6LVG23.js +0 -10
  32. package/dist/chunk-5J6LVG23.js.map +0 -1
  33. package/dist/chunk-GTUWYYHD.mjs +0 -18
  34. package/dist/chunk-GTUWYYHD.mjs.map +0 -1
  35. package/dist/chunk-OHF7NDU3.js.map +0 -1
  36. package/dist/chunk-Q3OATPM3.mjs +0 -9
  37. package/dist/chunk-Q3OATPM3.mjs.map +0 -1
  38. package/dist/chunk-S6JLN2LC.mjs +0 -8
  39. package/dist/chunk-S6JLN2LC.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## @anolilab/lint-staged-config [2.1.3](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@2.1.2...@anolilab/lint-staged-config@2.1.3) (2023-11-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added checks for prettier, for the eslint, stylelint and markdown lint group ([db409b7](https://github.com/anolilab/javascript-style-guide/commit/db409b77b1db051b7b1bcc36ad6d956e8ddd42b1))
7
+
1
8
  ## @anolilab/lint-staged-config [2.1.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@2.1.1...@anolilab/lint-staged-config@2.1.2) (2023-10-31)
2
9
 
3
10
 
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var process = require('process');
4
+
5
+ var s=()=>{},t=o=>process.env.NO_LOGS?s:n=>console.log(`${o}${n}`),c=t(""),i=c;
6
+
7
+ exports.a = i;
8
+ //# sourceMappingURL=out.js.map
9
+ //# sourceMappingURL=chunk-ALAT5PPB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/logger.ts"],"names":["env","noop","consolePrefix","prefix","message","consoleLog","logger_default"],"mappings":"AAAA,OAAS,OAAAA,MAAW,UAEpB,IAAMC,EAAO,IAAG,GAEVC,EAAiBC,GAAoBH,EAAI,QAAaC,EAAQG,GAAoB,QAAQ,IAAI,GAAGD,CAAM,GAAGC,CAAO,EAAE,EAEnHC,EAAaH,EAAc,EAAE,EAE5BI,EAAQD","sourcesContent":["import { env } from \"node:process\";\n\nconst noop = () => undefined;\n\nconst consolePrefix = (prefix: string) => (env[\"NO_LOGS\"] ? noop : (message: string) => console.log(`${prefix}${message}`));\n\nconst consoleLog = consolePrefix(\"\");\n\nexport default consoleLog;\n"]}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkALAT5PPB_js = require('./chunk-ALAT5PPB.js');
4
+ var chunkKP7AH4EU_js = require('./chunk-KP7AH4EU.js');
5
+ var chunkP4FK54EG_js = require('./chunk-P4FK54EG.js');
6
+ var packageJsonUtils = require('@anolilab/package-json-utils');
7
+
8
+ 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.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=packageJsonUtils.hasDependency("prettier")||packageJsonUtils.hasDevDependency("prettier"),chunkALAT5PPB_js.a("Prettier was found inside your package.json. It will be used to format your markdown files."));var n={"**/*.md":i=>[...global.hasAnolilabLintStagedPrettier?[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli?[`${chunkP4FK54EG_js.a()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${chunkKP7AH4EU_js.b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`${chunkP4FK54EG_js.a()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${chunkKP7AH4EU_js.b(i)}`]:[]],"**/*.mdx":i=>[...global.hasAnolilabLintStagedPrettier?[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(i)}`]:[]]},s=n;
9
+
10
+ exports.a = s;
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=chunk-D3D2GYNE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","logger_default","group","filenames","get_package_manager_default","concat_files_default","markdown_default"],"mappings":"wHAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAO3C,OAAO,mCACR,OAAO,iCAAmCD,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAGjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGpH,OAAO,gCACR,OAAO,8BAAgCD,EAAc,UAAU,GAAKC,EAAiB,UAAU,EAE/FC,EAAW,6FAA6F,GAG5G,IAAMC,EAAgB,CAClB,UAAYC,GAAwB,CAChC,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,EACzH,GAAI,OAAO,iCACL,CAAC,GAAGC,EAAkB,CAAC,qFAAqFC,EAAYF,CAAS,CAAC,EAAE,EACpI,CAAC,EACP,GAAI,OAAO,kCACL,CAAC,GAAGC,EAAkB,CAAC,0EAA0EC,EAAYF,CAAS,CAAC,EAAE,EACzH,CAAC,CACX,EACA,WAAaA,GAAc,CAAC,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,CAAE,CAC3J,EAEOG,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\nimport consoleLog from \"../utils/logger\";\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.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your markdown files.\");\n}\n\nconst group: Config = {\n \"**/*.md\": (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : []),\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`${getPackageManager()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2\n ? [`${getPackageManager()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ],\n \"**/*.mdx\": (filenames) => [...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : [])],\n};\n\nexport default group;\n"]}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkALAT5PPB_js = require('./chunk-ALAT5PPB.js');
4
+ var chunkKP7AH4EU_js = require('./chunk-KP7AH4EU.js');
5
+ var chunkP4FK54EG_js = require('./chunk-P4FK54EG.js');
6
+ var packageJsonUtils = require('@anolilab/package-json-utils');
7
+
8
+ global.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=packageJsonUtils.hasDependency("prettier")||packageJsonUtils.hasDevDependency("prettier"),chunkALAT5PPB_js.a("Prettier was found inside your package.json. It will be used to format your files, before stylelint is executed."));var s={[`**/*.{${["css","sass","scss","less"].join(",")}}`]:o=>[...global.hasAnolilabLintStagedPrettier?[`${chunkP4FK54EG_js.a()} exec prettier --ignore-unknown --write ${chunkKP7AH4EU_js.b(o)}`]:[],`${chunkP4FK54EG_js.a()} exec stylelint --fix`]},p=s;
9
+
10
+ exports.a = p;
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=chunk-EJ5WBPGD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["hasDependency","hasDevDependency","logger_default","group","filenames","get_package_manager_default","concat_files_default","stylesheets_default"],"mappings":"wHAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAO3C,OAAO,gCACR,OAAO,8BAAgCD,EAAc,UAAU,GAAKC,EAAiB,UAAU,EAE/FC,EAAW,kHAAkH,GAGjI,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CAC9E,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,2CAA2CC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,EAC1I,GAAGC,EAAkB,CAAC,uBAC1B,CACJ,EAEOE,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\nimport consoleLog from \"../utils/logger\";\n\nif (!global.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your files, before stylelint is executed.\");\n}\n\nconst group: Config = {\n [`**/*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --ignore-unknown --write ${concatFiles(filenames)}`] : []),\n `${getPackageManager()} exec stylelint --fix`,\n ],\n};\n\nexport default group;\n"]}
@@ -0,0 +1,10 @@
1
+ import { a } from './chunk-LJGFRIQ4.mjs';
2
+ import { b } from './chunk-PP4XAK3E.mjs';
3
+ import { a as a$1 } from './chunk-COM4XKFJ.mjs';
4
+ import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
5
+
6
+ global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));global.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=hasDependency("prettier")||hasDevDependency("prettier"),a("Prettier was found inside your package.json. It will be used to format your markdown files."));var n={"**/*.md":i=>[...global.hasAnolilabLintStagedPrettier?[`${a$1()} exec prettier --write ${b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli?[`${a$1()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`${a$1()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${b(i)}`]:[]],"**/*.mdx":i=>[...global.hasAnolilabLintStagedPrettier?[`${a$1()} exec prettier --write ${b(i)}`]:[]]},s=n;
7
+
8
+ export { s as a };
9
+ //# sourceMappingURL=out.js.map
10
+ //# sourceMappingURL=chunk-EM7AZLVF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","logger_default","group","filenames","get_package_manager_default","concat_files_default","markdown_default"],"mappings":"2HAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAO3C,OAAO,mCACR,OAAO,iCAAmCD,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAGjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGpH,OAAO,gCACR,OAAO,8BAAgCD,EAAc,UAAU,GAAKC,EAAiB,UAAU,EAE/FC,EAAW,6FAA6F,GAG5G,IAAMC,EAAgB,CAClB,UAAYC,GAAwB,CAChC,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,EACzH,GAAI,OAAO,iCACL,CAAC,GAAGC,EAAkB,CAAC,qFAAqFC,EAAYF,CAAS,CAAC,EAAE,EACpI,CAAC,EACP,GAAI,OAAO,kCACL,CAAC,GAAGC,EAAkB,CAAC,0EAA0EC,EAAYF,CAAS,CAAC,EAAE,EACzH,CAAC,CACX,EACA,WAAaA,GAAc,CAAC,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,CAAE,CAC3J,EAEOG,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\nimport consoleLog from \"../utils/logger\";\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.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your markdown files.\");\n}\n\nconst group: Config = {\n \"**/*.md\": (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : []),\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`${getPackageManager()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2\n ? [`${getPackageManager()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ],\n \"**/*.mdx\": (filenames) => [...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : [])],\n};\n\nexport default group;\n"]}
@@ -0,0 +1,19 @@
1
+ import { a as a$1 } from './chunk-AVDVT4B7.mjs';
2
+ import { a as a$4 } from './chunk-HGDREIGE.mjs';
3
+ import { a as a$2 } from './chunk-LJGFRIQ4.mjs';
4
+ import { b, a as a$5 } from './chunk-PP4XAK3E.mjs';
5
+ import { a as a$3 } from './chunk-COM4XKFJ.mjs';
6
+ import { hasDependency, hasDevDependency, isPackageAvailable } from '@anolilab/package-json-utils';
7
+ import { dirname } from 'path';
8
+ import { ESLint } from 'eslint';
9
+ import { quote } from 'shell-quote';
10
+
11
+ var E=n=>{let t={};return n.forEach(o=>{let i=dirname(o);t[i]||(t[i]=[]),t[i].push(o);}),t},y=E;var L=async n=>{let t=new ESLint,i=(await Promise.allSettled(n.map(async e=>await t.isPathIgnored(e)))).map(e=>{if(e.status==="fulfilled")return e.value;throw console.error(`
12
+ Unable to determine if file is ignored.
13
+
14
+
15
+ ${e.reason}`),new Error("Stopping lint-staged because of an error.")});return n.filter((e,r)=>!i[r]).map(e=>`"${a$5?e:quote([e])}"`)},x=L;var s={};a$1?.eslint?s=a$1.eslint:a$1?.settings?.eslint&&(s=a$1.settings.eslint);var c=[];(hasDependency("eslint-plugin-react-hooks")||hasDevDependency("eslint-plugin-react-hooks"))&&c.push("react-hooks/exhaustive-deps:off");(hasDependency("eslint-plugin-eslint-comments")||hasDevDependency("eslint-plugin-eslint-comments")||isPackageAvailable("eslint-plugin-eslint-comments"))&&c.push("eslint-comments/no-unused-disable:off");var a=".eslintrc",v=()=>{let n=[];s["max-warnings"]!==void 0&&Number.isNaN(s["max-warnings"])?n.push(`--max-warnings=${s["max-warnings"]}`):s["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[...s.rules??[],...c].filter(i=>i.trim().length>0);t.length>0&&n.push(t.map(i=>`--rule "${i}"`).join(" "));let o=[...s["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return o.length>0&&n.push(`--fix-type ${o.join(",")}`,"--fix"),s.cache&&n.push("--cache"),n},D=async n=>{let t=await x(n),o=v();if(s.config)return o.push(`--config ${s.config}`),[`${a$3()} exec eslint ${o.join(" ")} ${t.join(" ")}`];let i=y(t),f=[];return Object.values(i).forEach(e=>{let r;[a,`${a}.js`,`${a}.cjs`,`${a}.json`,`${a}.yaml`,`${a}.yml`].forEach(S=>{if(!r)try{r=a$4(S,e[0]);}catch{}}),r&&f.push(`${a$3()} exec eslint ${o.join(" ")} --config ${r} ${e.join(" ")}`);}),f},m=D;var j=["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&&j.push("md");global.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=hasDependency("prettier")||hasDevDependency("prettier"),a$2("Prettier was found inside your package.json. It will be used to format your files, before eslint is executed."));var M={[`**/*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await m(n)],[`**/*.{${[j].join(",")}}`]:async n=>[...global.hasAnolilabLintStagedPrettier?[`${a$3()} exec prettier --write ${b(n)}`]:[],...await m(n)]},Y=M;
16
+
17
+ export { Y as a };
18
+ //# sourceMappingURL=out.js.map
19
+ //# sourceMappingURL=chunk-GZMUS57R.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/eslint/index.ts","../src/groups/eslint/create-eslint-commands.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts"],"names":["hasDependency","hasDevDependency","isPackageAvailable","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","promise","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","lint_staged_config_default","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","fixType","type","createEslintCommands","filteredFiles","get_package_manager_default","groupedFilesNames","eslintCommands","config","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","logger_default","group","concat_files_default","eslint_default"],"mappings":"oNAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BCAhD,OAAS,iBAAAD,EAAe,oBAAAC,EAAkB,sBAAAC,MAA0B,+BCApE,OAAS,WAAAC,MAAe,OAExB,IAAMC,EAAiCC,GAAkD,CACrF,IAAMC,EAAmC,CAAC,EAE1C,OAAAD,EAAU,QAASE,GAAa,CAC5B,IAAMC,EAAgBL,EAAQI,CAAQ,EAGjCD,EAAOE,CAAa,IAErBF,EAAOE,CAAa,EAAI,CAAC,GAG5BF,EAAOE,CAAa,EAAe,KAAKD,CAAQ,CACrD,CAAC,EAEMD,CACX,EAEOG,EAAQL,ECpBf,OAAS,UAAAM,MAAc,SACvB,OAAS,SAAAC,MAAa,cAItB,IAAMC,EAAqB,MAAOC,GAA2C,CACzE,IAAMC,EAAS,IAAIJ,EAGbK,GADW,MAAM,QAAQ,WAAWF,EAAU,IAAI,MAAOG,GAAa,MAAMF,EAAO,cAAcE,CAAQ,CAAC,CAAC,GACnF,IAAKC,GAAY,CAC3C,GAAIA,EAAQ,SAAW,YACnB,OAAOA,EAAQ,MAGnB,cAAQ,MAAM;AAAA;AAAA;AAAA;AAAA,EAAk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CzC,EAAc,UAAU,GAAKC,EAAiB,UAAU,EAE/FyC,EAAW,+GAA+G,GAG9H,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,OAAQ,QAAS,OAAO,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO9B,GAAwB,CAAC,GAAI,MAAM2B,EAAqB3B,CAAS,CAAE,EAC9H,CAAC,SAAS,CAAC4B,CAAU,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO5B,GAAwB,CACjE,GAAI,OAAO,8BAAgC,CAAC,GAAGqB,EAAkB,CAAC,0BAA0BU,EAAY/B,CAAS,CAAC,EAAE,EAAI,CAAC,EACzH,GAAI,MAAM2B,EAAqB3B,CAAS,CAC5C,CACJ,EAEOgC,EAAQF","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport consoleLog from \"../../utils/logger\";\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\nif (!global.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your files, before eslint is executed.\");\n}\n\nconst group: Config = {\n [`**/*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n [`**/*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : []),\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { hasDependency, hasDevDependency, isPackageAvailable } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ninterface EslintConfig {\n cache?: boolean;\n config?: string;\n \"fix-type\"?: string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n}\n\ninterface StagedConfig {\n eslint?: EslintConfig;\n settings?: {\n eslint?: EslintConfig;\n };\n}\n\nlet eslintSettings: EslintConfig = {} as EslintConfig;\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nif ((anolilabLintStagedConfig as StagedConfig)?.eslint) {\n eslintSettings = (anolilabLintStagedConfig as StagedConfig).eslint as EslintConfig;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n} else if ((anolilabLintStagedConfig as StagedConfig)?.settings?.eslint) {\n eslintSettings = (\n (anolilabLintStagedConfig as StagedConfig).settings as {\n eslint?: EslintConfig;\n }\n ).eslint as EslintConfig;\n}\n\nconst eslintGlobalRulesForFix: string[] = [];\n\nif (hasDependency(\"eslint-plugin-react-hooks\") || hasDevDependency(\"eslint-plugin-react-hooks\")) {\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 eslintGlobalRulesForFix.push(\"react-hooks/exhaustive-deps:off\");\n}\n\nif (\n hasDependency(\"eslint-plugin-eslint-comments\") ||\n hasDevDependency(\"eslint-plugin-eslint-comments\") ||\n isPackageAvailable(\"eslint-plugin-eslint-comments\")\n) {\n eslintGlobalRulesForFix.push(\"eslint-comments/no-unused-disable: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 = [...(eslintSettings.rules ?? []), ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0);\n\n if (rules.length > 0) {\n eslintArguments.push(rules.map((rule) => `--rule \"${rule}\"`).join(\" \"));\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 [`${getPackageManager()} exec 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}\") as string;\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`${getPackageManager()} exec eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): Record<string, string[]> => {\n const groups: Record<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","import { 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 promises = await Promise.allSettled(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n const ignoredFiles = promises.map((promise) => {\n if (promise.status === \"fulfilled\") {\n return promise.value;\n }\n\n console.error(`\\nUnable to determine if file is ignored.\\n\\n\\n${promise.reason}`);\n\n throw new Error(\"Stopping lint-staged because of an error.\");\n });\n\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"]}
@@ -0,0 +1,7 @@
1
+ import { env } from 'process';
2
+
3
+ var s=()=>{},t=o=>env.NO_LOGS?s:n=>console.log(`${o}${n}`),c=t(""),i=c;
4
+
5
+ export { i as a };
6
+ //# sourceMappingURL=out.js.map
7
+ //# sourceMappingURL=chunk-LJGFRIQ4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/logger.ts"],"names":["env","noop","consolePrefix","prefix","message","consoleLog","logger_default"],"mappings":"AAAA,OAAS,OAAAA,MAAW,UAEpB,IAAMC,EAAO,IAAG,GAEVC,EAAiBC,GAAoBH,EAAI,QAAaC,EAAQG,GAAoB,QAAQ,IAAI,GAAGD,CAAM,GAAGC,CAAO,EAAE,EAEnHC,EAAaH,EAAc,EAAE,EAE5BI,EAAQD","sourcesContent":["import { env } from \"node:process\";\n\nconst noop = () => undefined;\n\nconst consolePrefix = (prefix: string) => (env[\"NO_LOGS\"] ? noop : (message: string) => console.log(`${prefix}${message}`));\n\nconst consoleLog = consolePrefix(\"\");\n\nexport default consoleLog;\n"]}
@@ -0,0 +1,10 @@
1
+ import { a } from './chunk-LJGFRIQ4.mjs';
2
+ import { b } from './chunk-PP4XAK3E.mjs';
3
+ import { a as a$1 } from './chunk-COM4XKFJ.mjs';
4
+ import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
5
+
6
+ global.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=hasDependency("prettier")||hasDevDependency("prettier"),a("Prettier was found inside your package.json. It will be used to format your files, before stylelint is executed."));var s={[`**/*.{${["css","sass","scss","less"].join(",")}}`]:o=>[...global.hasAnolilabLintStagedPrettier?[`${a$1()} exec prettier --ignore-unknown --write ${b(o)}`]:[],`${a$1()} exec stylelint --fix`]},p=s;
7
+
8
+ export { p as a };
9
+ //# sourceMappingURL=out.js.map
10
+ //# sourceMappingURL=chunk-MCRCUVTY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["hasDependency","hasDevDependency","logger_default","group","filenames","get_package_manager_default","concat_files_default","stylesheets_default"],"mappings":"2HAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAO3C,OAAO,gCACR,OAAO,8BAAgCD,EAAc,UAAU,GAAKC,EAAiB,UAAU,EAE/FC,EAAW,kHAAkH,GAGjI,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CAC9E,GAAI,OAAO,8BAAgC,CAAC,GAAGC,EAAkB,CAAC,2CAA2CC,EAAYF,CAAS,CAAC,EAAE,EAAI,CAAC,EAC1I,GAAGC,EAAkB,CAAC,uBAC1B,CACJ,EAEOE,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\nimport consoleLog from \"../utils/logger\";\n\nif (!global.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your files, before stylelint is executed.\");\n}\n\nconst group: Config = {\n [`**/*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --ignore-unknown --write ${concatFiles(filenames)}`] : []),\n `${getPackageManager()} exec stylelint --fix`,\n ],\n};\n\nexport default group;\n"]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  var chunkOYUEMN5Q_js = require('./chunk-OYUEMN5Q.js');
4
4
  var chunkVU6SMFTD_js = require('./chunk-VU6SMFTD.js');
5
+ var chunkALAT5PPB_js = require('./chunk-ALAT5PPB.js');
5
6
  var chunkKP7AH4EU_js = require('./chunk-KP7AH4EU.js');
6
7
  var chunkP4FK54EG_js = require('./chunk-P4FK54EG.js');
7
8
  var packageJsonUtils = require('@anolilab/package-json-utils');
@@ -9,12 +10,12 @@ var path = require('path');
9
10
  var eslint = require('eslint');
10
11
  var shellQuote = require('shell-quote');
11
12
 
12
- var E=n=>{let t={};return n.forEach(o=>{let i=path.dirname(o);t[i]||(t[i]=[]),t[i].push(o);}),t},h=E;var A=async n=>{let t=new eslint.ESLint,i=(await Promise.allSettled(n.map(async e=>await t.isPathIgnored(e)))).map(e=>{if(e.status==="fulfilled")return e.value;throw console.error(`
13
+ var E=n=>{let t={};return n.forEach(o=>{let i=path.dirname(o);t[i]||(t[i]=[]),t[i].push(o);}),t},y=E;var L=async n=>{let t=new eslint.ESLint,i=(await Promise.allSettled(n.map(async e=>await t.isPathIgnored(e)))).map(e=>{if(e.status==="fulfilled")return e.value;throw console.error(`
13
14
  Unable to determine if file is ignored.
14
15
 
15
16
 
16
- ${e.reason}`),new Error("Stopping lint-staged because of an error.")});return n.filter((e,r)=>!i[r]).map(e=>`"${chunkKP7AH4EU_js.a?e:shellQuote.quote([e])}"`)},w=A;var s={};chunkOYUEMN5Q_js.a?.eslint?s=chunkOYUEMN5Q_js.a.eslint:chunkOYUEMN5Q_js.a?.settings?.eslint&&(s=chunkOYUEMN5Q_js.a.settings.eslint);var f=[];(packageJsonUtils.hasDependency("eslint-plugin-react-hooks")||packageJsonUtils.hasDevDependency("eslint-plugin-react-hooks"))&&f.push("react-hooks/exhaustive-deps:off");(packageJsonUtils.hasDependency("eslint-plugin-eslint-comments")||packageJsonUtils.hasDevDependency("eslint-plugin-eslint-comments")||packageJsonUtils.isPackageAvailable("eslint-plugin-eslint-comments"))&&f.push("eslint-comments/no-unused-disable:off");var a=".eslintrc",D=()=>{let n=[];s["max-warnings"]!==void 0&&Number.isNaN(s["max-warnings"])?n.push(`--max-warnings=${s["max-warnings"]}`):s["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[...s.rules??[],...f].filter(i=>i.trim().length>0);t.length>0&&n.push(t.map(i=>`--rule "${i}"`).join(" "));let o=[...s["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return o.length>0&&n.push(`--fix-type ${o.join(",")}`,"--fix"),s.cache&&n.push("--cache"),n},L=async n=>{let t=await w(n),o=D();if(s.config)return o.push(`--config ${s.config}`),[`${chunkP4FK54EG_js.a()} exec eslint ${o.join(" ")} ${t.join(" ")}`];let i=h(t),c=[];return Object.values(i).forEach(e=>{let r;[a,`${a}.js`,`${a}.cjs`,`${a}.json`,`${a}.yaml`,`${a}.yml`].forEach(j=>{if(!r)try{r=chunkVU6SMFTD_js.a(j,e[0]);}catch{}}),r&&c.push(`${chunkP4FK54EG_js.a()} exec eslint ${o.join(" ")} --config ${r} ${e.join(" ")}`);}),c},m=L;var b=["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&&b.push("md");var M={[`**/*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await m(n)],[`**/*.{${[b].join(",")}}`]:async n=>[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(n)}`,...await m(n)]},V=M;
17
+ ${e.reason}`),new Error("Stopping lint-staged because of an error.")});return n.filter((e,r)=>!i[r]).map(e=>`"${chunkKP7AH4EU_js.a?e:shellQuote.quote([e])}"`)},x=L;var s={};chunkOYUEMN5Q_js.a?.eslint?s=chunkOYUEMN5Q_js.a.eslint:chunkOYUEMN5Q_js.a?.settings?.eslint&&(s=chunkOYUEMN5Q_js.a.settings.eslint);var c=[];(packageJsonUtils.hasDependency("eslint-plugin-react-hooks")||packageJsonUtils.hasDevDependency("eslint-plugin-react-hooks"))&&c.push("react-hooks/exhaustive-deps:off");(packageJsonUtils.hasDependency("eslint-plugin-eslint-comments")||packageJsonUtils.hasDevDependency("eslint-plugin-eslint-comments")||packageJsonUtils.isPackageAvailable("eslint-plugin-eslint-comments"))&&c.push("eslint-comments/no-unused-disable:off");var a=".eslintrc",v=()=>{let n=[];s["max-warnings"]!==void 0&&Number.isNaN(s["max-warnings"])?n.push(`--max-warnings=${s["max-warnings"]}`):s["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[...s.rules??[],...c].filter(i=>i.trim().length>0);t.length>0&&n.push(t.map(i=>`--rule "${i}"`).join(" "));let o=[...s["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return o.length>0&&n.push(`--fix-type ${o.join(",")}`,"--fix"),s.cache&&n.push("--cache"),n},D=async n=>{let t=await x(n),o=v();if(s.config)return o.push(`--config ${s.config}`),[`${chunkP4FK54EG_js.a()} exec eslint ${o.join(" ")} ${t.join(" ")}`];let i=y(t),f=[];return Object.values(i).forEach(e=>{let r;[a,`${a}.js`,`${a}.cjs`,`${a}.json`,`${a}.yaml`,`${a}.yml`].forEach(S=>{if(!r)try{r=chunkVU6SMFTD_js.a(S,e[0]);}catch{}}),r&&f.push(`${chunkP4FK54EG_js.a()} exec eslint ${o.join(" ")} --config ${r} ${e.join(" ")}`);}),f},m=D;var j=["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&&j.push("md");global.hasAnolilabLintStagedPrettier||(global.hasAnolilabLintStagedPrettier=packageJsonUtils.hasDependency("prettier")||packageJsonUtils.hasDevDependency("prettier"),chunkALAT5PPB_js.a("Prettier was found inside your package.json. It will be used to format your files, before eslint is executed."));var M={[`**/*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await m(n)],[`**/*.{${[j].join(",")}}`]:async n=>[...global.hasAnolilabLintStagedPrettier?[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(n)}`]:[],...await m(n)]},Y=M;
17
18
 
18
- exports.a = V;
19
+ exports.a = Y;
19
20
  //# sourceMappingURL=out.js.map
20
- //# sourceMappingURL=chunk-OHF7NDU3.js.map
21
+ //# sourceMappingURL=chunk-WCBUC3W3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/groups/eslint/index.ts","../src/groups/eslint/create-eslint-commands.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts"],"names":["hasDependency","hasDevDependency","isPackageAvailable","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","promise","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","lint_staged_config_default","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","fixType","type","createEslintCommands","filteredFiles","get_package_manager_default","groupedFilesNames","eslintCommands","config","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","logger_default","group","concat_files_default","eslint_default"],"mappings":"+MAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BCAhD,OAAS,iBAAAD,EAAe,oBAAAC,EAAkB,sBAAAC,MAA0B,+BCApE,OAAS,WAAAC,MAAe,OAExB,IAAMC,EAAiCC,GAAkD,CACrF,IAAMC,EAAmC,CAAC,EAE1C,OAAAD,EAAU,QAASE,GAAa,CAC5B,IAAMC,EAAgBL,EAAQI,CAAQ,EAGjCD,EAAOE,CAAa,IAErBF,EAAOE,CAAa,EAAI,CAAC,GAG5BF,EAAOE,CAAa,EAAe,KAAKD,CAAQ,CACrD,CAAC,EAEMD,CACX,EAEOG,EAAQL,ECpBf,OAAS,UAAAM,MAAc,SACvB,OAAS,SAAAC,MAAa,cAItB,IAAMC,EAAqB,MAAOC,GAA2C,CACzE,IAAMC,EAAS,IAAIJ,EAGbK,GADW,MAAM,QAAQ,WAAWF,EAAU,IAAI,MAAOG,GAAa,MAAMF,EAAO,cAAcE,CAAQ,CAAC,CAAC,GACnF,IAAKC,GAAY,CAC3C,GAAIA,EAAQ,SAAW,YACnB,OAAOA,EAAQ,MAGnB,cAAQ,MAAM;AAAA;AAAA;AAAA;AAAA,EAAkDA,EAAQ,MAAM,EAAE,EAE1E,IAAI,MAAM,2CAA2C,CAC/D,CAAC,EAKD,OAFsBJ,EAAU,OAAO,CAACK,EAAGC,IAAU,CAACJ,EAAaI,CAAK,CAAC,EAEpD,IAAKH,GAAa,IAAII,EAAYJ,EAAWL,EAAM,CAACK,CAAQ,CAAC,CAAC,GAAG,CAC1F,EAEOK,EAAQT,EFFf,IAAIU,EAA+B,CAAC,EAG/BC,GAA2C,OAC5CD,EAAkBC,EAA0C,OAEpDA,GAA2C,UAAU,SAC7DD,EACKC,EAA0C,SAG7C,QAGN,IAAMC,EAAoC,CAAC,GAEvCxB,EAAc,2BAA2B,GAAKC,EAAiB,2BAA2B,IAoB1FuB,EA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S,CAC5C,CACJ,EAEOgC,EAAQF","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport consoleLog from \"../../utils/logger\";\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\nif (!global.hasAnolilabLintStagedPrettier) {\n global.hasAnolilabLintStagedPrettier = hasDependency(\"prettier\") || hasDevDependency(\"prettier\");\n\n consoleLog(\"Prettier was found inside your package.json. It will be used to format your files, before eslint is executed.\");\n}\n\nconst group: Config = {\n [`**/*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n [`**/*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n ...(global.hasAnolilabLintStagedPrettier ? [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`] : []),\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { hasDependency, hasDevDependency, isPackageAvailable } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ninterface EslintConfig {\n cache?: boolean;\n config?: string;\n \"fix-type\"?: string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n}\n\ninterface StagedConfig {\n eslint?: EslintConfig;\n settings?: {\n eslint?: EslintConfig;\n };\n}\n\nlet eslintSettings: EslintConfig = {} as EslintConfig;\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nif ((anolilabLintStagedConfig as StagedConfig)?.eslint) {\n eslintSettings = (anolilabLintStagedConfig as StagedConfig).eslint as EslintConfig;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n} else if ((anolilabLintStagedConfig as StagedConfig)?.settings?.eslint) {\n eslintSettings = (\n (anolilabLintStagedConfig as StagedConfig).settings as {\n eslint?: EslintConfig;\n }\n ).eslint as EslintConfig;\n}\n\nconst eslintGlobalRulesForFix: string[] = [];\n\nif (hasDependency(\"eslint-plugin-react-hooks\") || hasDevDependency(\"eslint-plugin-react-hooks\")) {\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 eslintGlobalRulesForFix.push(\"react-hooks/exhaustive-deps:off\");\n}\n\nif (\n hasDependency(\"eslint-plugin-eslint-comments\") ||\n hasDevDependency(\"eslint-plugin-eslint-comments\") ||\n isPackageAvailable(\"eslint-plugin-eslint-comments\")\n) {\n eslintGlobalRulesForFix.push(\"eslint-comments/no-unused-disable: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 = [...(eslintSettings.rules ?? []), ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0);\n\n if (rules.length > 0) {\n eslintArguments.push(rules.map((rule) => `--rule \"${rule}\"`).join(\" \"));\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 [`${getPackageManager()} exec 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}\") as string;\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`${getPackageManager()} exec eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): Record<string, string[]> => {\n const groups: Record<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","import { 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 promises = await Promise.allSettled(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n const ignoredFiles = promises.map((promise) => {\n if (promise.status === \"fulfilled\") {\n return promise.value;\n }\n\n console.error(`\\nUnable to determine if file is ignored.\\n\\n\\n${promise.reason}`);\n\n throw new Error(\"Stopping lint-staged because of an error.\");\n });\n\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"]}
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkOHF7NDU3_js = require('../../chunk-OHF7NDU3.js');
3
+ var chunkWCBUC3W3_js = require('../../chunk-WCBUC3W3.js');
4
4
  require('../../chunk-OYUEMN5Q.js');
5
5
  require('../../chunk-VU6SMFTD.js');
6
+ require('../../chunk-ALAT5PPB.js');
6
7
  require('../../chunk-KP7AH4EU.js');
7
8
  require('../../chunk-P4FK54EG.js');
8
9
 
9
10
 
10
11
 
11
- module.exports = chunkOHF7NDU3_js.a;
12
+ module.exports = chunkWCBUC3W3_js.a;
12
13
  //# sourceMappingURL=out.js.map
13
14
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
- export { a as default } from '../../chunk-GTUWYYHD.mjs';
1
+ export { a as default } from '../../chunk-GZMUS57R.mjs';
2
2
  import '../../chunk-AVDVT4B7.mjs';
3
3
  import '../../chunk-HGDREIGE.mjs';
4
+ import '../../chunk-LJGFRIQ4.mjs';
4
5
  import '../../chunk-PP4XAK3E.mjs';
5
6
  import '../../chunk-COM4XKFJ.mjs';
6
7
  //# sourceMappingURL=out.js.map
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk4PAU4XRY_js = require('../chunk-4PAU4XRY.js');
3
+ var chunkD3D2GYNE_js = require('../chunk-D3D2GYNE.js');
4
+ require('../chunk-ALAT5PPB.js');
4
5
  require('../chunk-KP7AH4EU.js');
5
6
  require('../chunk-P4FK54EG.js');
6
7
 
7
8
 
8
9
 
9
- module.exports = chunk4PAU4XRY_js.a;
10
+ module.exports = chunkD3D2GYNE_js.a;
10
11
  //# sourceMappingURL=out.js.map
11
12
  //# sourceMappingURL=markdown.js.map
@@ -1,4 +1,5 @@
1
- export { a as default } from '../chunk-Q3OATPM3.mjs';
1
+ export { a as default } from '../chunk-EM7AZLVF.mjs';
2
+ import '../chunk-LJGFRIQ4.mjs';
2
3
  import '../chunk-PP4XAK3E.mjs';
3
4
  import '../chunk-COM4XKFJ.mjs';
4
5
  //# sourceMappingURL=out.js.map
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk5J6LVG23_js = require('../chunk-5J6LVG23.js');
3
+ var chunkEJ5WBPGD_js = require('../chunk-EJ5WBPGD.js');
4
+ require('../chunk-ALAT5PPB.js');
4
5
  require('../chunk-KP7AH4EU.js');
5
6
  require('../chunk-P4FK54EG.js');
6
7
 
7
8
 
8
9
 
9
- module.exports = chunk5J6LVG23_js.a;
10
+ module.exports = chunkEJ5WBPGD_js.a;
10
11
  //# sourceMappingURL=out.js.map
11
12
  //# sourceMappingURL=stylesheets.js.map
@@ -1,4 +1,5 @@
1
- export { a as default } from '../chunk-S6JLN2LC.mjs';
1
+ export { a as default } from '../chunk-MCRCUVTY.mjs';
2
+ import '../chunk-LJGFRIQ4.mjs';
2
3
  import '../chunk-PP4XAK3E.mjs';
3
4
  import '../chunk-COM4XKFJ.mjs';
4
5
  //# sourceMappingURL=out.js.map
package/dist/index.js CHANGED
@@ -1,25 +1,26 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkDVFT7GIT_js = require('./chunk-DVFT7GIT.js');
4
- var chunkOHF7NDU3_js = require('./chunk-OHF7NDU3.js');
4
+ var chunkWCBUC3W3_js = require('./chunk-WCBUC3W3.js');
5
5
  var chunkOYUEMN5Q_js = require('./chunk-OYUEMN5Q.js');
6
6
  require('./chunk-VU6SMFTD.js');
7
7
  var chunkTNK6LFGX_js = require('./chunk-TNK6LFGX.js');
8
- var chunk4PAU4XRY_js = require('./chunk-4PAU4XRY.js');
8
+ var chunkD3D2GYNE_js = require('./chunk-D3D2GYNE.js');
9
9
  var chunk6IRNLWX6_js = require('./chunk-6IRNLWX6.js');
10
- var chunk5J6LVG23_js = require('./chunk-5J6LVG23.js');
10
+ var chunkEJ5WBPGD_js = require('./chunk-EJ5WBPGD.js');
11
+ var chunkALAT5PPB_js = require('./chunk-ALAT5PPB.js');
11
12
  var chunkAUGHUNNL_js = require('./chunk-AUGHUNNL.js');
12
13
  require('./chunk-KP7AH4EU.js');
13
14
  require('./chunk-P4FK54EG.js');
14
15
  var process = require('process');
15
16
  var packageJsonUtils = require('@anolilab/package-json-utils');
16
17
 
17
- var y=[{config:chunkOHF7NDU3_js.a,configName:"eslint",dependencies:["prettier","eslint"]},{config:chunkTNK6LFGX_js.a,configName:"json",dependencies:["prettier","sort-package-json"]},{config:chunk4PAU4XRY_js.a,configName:"markdown",dependencies:["prettier","markdownlint-cli","markdownlint-cli2"]},{config:chunk6IRNLWX6_js.a,configName:"secretlint",dependencies:["secretlint"]},{config:chunk5J6LVG23_js.a,configName:"stylesheets",dependencies:["stylelint"]},{config:chunkAUGHUNNL_js.a,configName:"tests",dependencies:["vite","jest","ava"]},{config:chunkDVFT7GIT_js.a,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};y.forEach(t=>{let{config:n,configName:i,dependencies:l}=t;if(chunkOYUEMN5Q_js.a.plugin?.[i]!==!1){let s=[];l.forEach(e=>{(packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e))&&s.push(e);}),s.length>0?(g={...g,...n},r.push(i)):(a[i]={},l.forEach(e=>{a[i][e]=packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e);}));}});var w={...g};var j=()=>{},k=t=>process.env.NO_LOGS?j:n=>console.log(`${t}${n}`),O=k(""),o=O;if(!global.hasAnolilabStagedLintConfigLoaded){process.env.DEBUG&&(o(`
18
+ var y=[{config:chunkWCBUC3W3_js.a,configName:"eslint",dependencies:["eslint"]},{config:chunkTNK6LFGX_js.a,configName:"json",dependencies:["prettier"]},{config:chunkD3D2GYNE_js.a,configName:"markdown",dependencies:["markdownlint-cli","markdownlint-cli2"]},{config:chunk6IRNLWX6_js.a,configName:"secretlint",dependencies:["secretlint"]},{config:chunkEJ5WBPGD_js.a,configName:"stylesheets",dependencies:["stylelint"]},{config:chunkAUGHUNNL_js.a,configName:"tests",dependencies:["vite","jest","ava"]},{config:chunkDVFT7GIT_js.a,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};y.forEach(s=>{let{config:i,configName:o,dependencies:l}=s;if(chunkOYUEMN5Q_js.a.plugin?.[o]!==!1){let t=[];l.forEach(e=>{(packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e))&&t.push(e);}),t.length>0?(g={...g,...i},r.push(o)):(a[o]={},l.forEach(e=>{a[o][e]=packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e);}));}});var w={...g};if(!global.hasAnolilabStagedLintConfigLoaded){process.env.DEBUG&&(chunkALAT5PPB_js.a(`
18
19
  @anolilab/lint-stage-config loaded the following plugins:
19
- `),r.forEach(n=>{o(` ${n}`);}));let t=!1;Object.entries(a).forEach(([n,i])=>{Object.values(i).some(Boolean)&&(t=!0,o(`
20
- Your package.json container dependencies for the "${n}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(i).forEach(([s,e])=>{e||o(` ${s}`);}));}),t&&(o(`
21
- To disable this message, add the following to your package.json:`),o(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
22
- `)),o('To disable all logging, add the following to your lint-staged command call "NO_LOGS=true lint-staged ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
20
+ `),r.forEach(i=>{chunkALAT5PPB_js.a(` ${i}`);}));let s=!1;Object.entries(a).forEach(([i,o])=>{Object.values(o).some(Boolean)&&(s=!0,chunkALAT5PPB_js.a(`
21
+ Your package.json container dependencies for the "${i}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(o).forEach(([t,e])=>{e||chunkALAT5PPB_js.a(` ${t}`);}));}),s&&(chunkALAT5PPB_js.a(`
22
+ To disable this message, add the following to your package.json:`),chunkALAT5PPB_js.a(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
23
+ `)),chunkALAT5PPB_js.a('To disable all logging, add the following to your lint-staged command call "NO_LOGS=true lint-staged ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
23
24
 
24
25
  module.exports = w;
25
26
  //# sourceMappingURL=out.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/utils/logger.ts"],"names":["env","hasDependency","hasDevDependency","groups","eslint_default","json_default","markdown_default","secretlint_default","stylesheets_default","tests_default","typescript_default","loadedPlugins","loadedPluginsNames","possiblePlugins","plugin","config","configName","dependencies","lint_staged_config_default","foundDependencies","dependency","loaded","noop","consolePrefix","prefix","message","consoleLog","logger_default","pluginName","hasLogged","installed"],"mappings":"oZAAA,OAAS,OAAAA,MAAW,UCApB,OAAS,iBAAAC,EAAe,oBAAAC,MAAwB,+BAkBhD,IAAMC,EAAiB,CACnB,CACI,OAAQC,EACR,WAAY,SACZ,aAAc,CAAC,WAAY,QAAQ,CACvC,EACA,CACI,OAAQC,EACR,WAAY,OACZ,aAAc,CAAC,WAAY,mBAAmB,CAClD,EACA,CACI,OAAQC,EACR,WAAY,WACZ,aAAc,CAAC,WAAY,mBAAoB,mBAAmB,CACtE,EACA,CACI,OAAQC,EACR,WAAY,aACZ,aAAc,CAAC,YAAY,CAC/B,EACA,CACI,OAAQC,EACR,WAAY,cACZ,aAAc,CAAC,WAAW,CAC9B,EACA,CACI,OAAQC,EACR,WAAY,QACZ,aAAc,CAAC,OAAQ,OAAQ,KAAK,CACxC,EACA,CACI,OAAQC,EACR,WAAY,aACZ,aAAc,CAAC,YAAY,CAC/B,CACJ,EAEIC,EAAwB,CAAC,EACvBC,EAA+B,CAAC,EAEhCC,EAA2D,CAAC,EAElEV,EAAO,QAASW,GAAW,CACvB,GAAM,CAAE,OAAAC,EAAQ,WAAAC,EAAY,aAAAC,CAAa,EAAIH,EAG7C,GAAKI,EAA0F,SAAYF,CAAU,IAAM,GAAO,CAC9H,IAAMG,EAAoB,CAAC,EAE3BF,EAAa,QAASG,GAAe,EAC7BnB,EAAcmB,CAAU,GAAKlB,EAAiBkB,CAAU,IACxDD,EAAkB,KAAKC,CAAU,CAEzC,CAAC,EAEGD,EAAkB,OAAS,GAC3BR,EAAgB,CAAE,GAAGA,EAAe,GAAGI,CAAO,EAC9CH,EAAmB,KAAKI,CAAU,IAGlCH,EAAgBG,CAAU,EAAI,CAAC,EAE/BC,EAAa,QAASG,GAAe,CAEhCP,EAAgBG,CAAU,EAA8BI,CAAU,EAAInB,EAAcmB,CAAU,GAAKlB,EAAiBkB,CAAU,CACnI,CAAC,EAET,CACJ,CAAC,EAED,IAAMC,EAAiB,CAAE,GAAGV,CAAc,ECzF1C,OAAS,OAAAX,MAAW,UAEpB,IAAMsB,EAAO,IAAG,GAEVC,EAAiBC,GAAoBxB,EAAI,QAAasB,EAAQG,GAAoB,QAAQ,IAAI,GAAGD,CAAM,GAAGC,CAAO,EAAE,EAEnHC,EAAaH,EAAc,EAAE,EAE5BI,EAAQD,EFFf,GAAI,CAAC,OAAO,kCAAmC,CACvC1B,EAAI,QACJ2B,EAAW;AAAA;AAAA,CAA+D,EAE1Ef,EAAmB,QAASgB,GAAe,CACvCD,EAAW,OAAOC,CAAU,EAAE,CAClC,CAAC,GAGL,IAAIC,EAAY,GAEhB,OAAO,QAAQhB,CAAe,EAAE,QAAQ,CAAC,CAACC,EAAQG,CAAY,IAAM,CACvC,OAAO,OAAOA,CAAY,EAAE,KAAK,OAAO,IAG7DY,EAAY,GACZF,EACI;AAAA,oDAAuDb,CAAM,yGACjE,EAEA,OAAO,QAAQG,CAAY,EAAE,QAAQ,CAAC,CAACG,EAAYU,CAAS,IAAM,CACzDA,GACDH,EAAW,OAAOP,CAAU,EAAE,CAEtC,CAAC,EAET,CAAC,EAGGS,IACAF,EAAW;AAAA,iEAAoE,EAC/EA,EAAW;AAAA,CAAiF,GAGhGA,EAAW,2GAA2G,EAEtH,OAAO,kCAAoC,EAC/C","sourcesContent":["import { env } from \"node:process\";\n\nimport { loadedPluginsNames, possiblePlugins } from \"./config\";\nimport consoleLog from \"./utils/logger\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabStagedLintConfigLoaded) {\n if (env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/lint-stage-config loaded the following plugins:\\n\");\n\n loadedPluginsNames.forEach((pluginName) => {\n consoleLog(` ${pluginName}`);\n });\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePlugins).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"lint-stage-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your lint-staged command call \"NO_LOGS=true lint-staged ...\"');\n\n global.hasAnolilabStagedLintConfigLoaded = true;\n}\n\nexport { loadedPlugins as default } from \"./config\";\n","import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport eslintConfig from \"./groups/eslint\";\nimport jsonConfig from \"./groups/json\";\nimport markdownConfig from \"./groups/markdown\";\nimport secretlintConfig from \"./groups/secretlint\";\nimport stylesheetsConfig from \"./groups/stylesheets\";\nimport testsConfig from \"./groups/tests\";\nimport typescriptConfig from \"./groups/typescript\";\nimport anolilabLintStagedConfig from \"./utils/lint-staged-config\";\n\ntype Groups = {\n config: Config;\n configName: string;\n dependencies: string[];\n}[];\n\nconst groups: Groups = [\n {\n config: eslintConfig,\n configName: \"eslint\",\n dependencies: [\"prettier\", \"eslint\"],\n },\n {\n config: jsonConfig,\n configName: \"json\",\n dependencies: [\"prettier\", \"sort-package-json\"],\n },\n {\n config: markdownConfig,\n configName: \"markdown\",\n dependencies: [\"prettier\", \"markdownlint-cli\", \"markdownlint-cli2\"],\n },\n {\n config: secretlintConfig,\n configName: \"secretlint\",\n dependencies: [\"secretlint\"],\n },\n {\n config: stylesheetsConfig,\n configName: \"stylesheets\",\n dependencies: [\"stylelint\"],\n },\n {\n config: testsConfig,\n configName: \"tests\",\n dependencies: [\"vite\", \"jest\", \"ava\"],\n },\n {\n config: typescriptConfig,\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n },\n];\n\nlet loadedPlugins: Config = {};\nconst loadedPluginsNames: string[] = [];\n\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\ngroups.forEach((plugin) => {\n const { config, configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabLintStagedConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n if (foundDependencies.length > 0) {\n loadedPlugins = { ...loadedPlugins, ...config };\n loadedPluginsNames.push(configName);\n } else {\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n});\n\nconst loaded: Config = { ...loadedPlugins };\n\nexport { loaded as loadedPlugins, loadedPluginsNames, possiblePlugins };\n","import { env } from \"node:process\";\n\nconst noop = () => undefined;\n\nconst consolePrefix = (prefix: string) => (env[\"NO_LOGS\"] ? noop : (message: string) => console.log(`${prefix}${message}`));\n\nconst consoleLog = consolePrefix(\"\");\n\nexport default consoleLog;\n"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts"],"names":["env","hasDependency","hasDevDependency","groups","eslint_default","json_default","markdown_default","secretlint_default","stylesheets_default","tests_default","typescript_default","loadedPlugins","loadedPluginsNames","possiblePlugins","plugin","config","configName","dependencies","lint_staged_config_default","foundDependencies","dependency","loaded","logger_default","pluginName","hasLogged","installed"],"mappings":"4bAAA,OAAS,OAAAA,MAAW,U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AAA,CAA+D,EAE1EV,EAAmB,QAASW,GAAe,CACvCD,EAAW,OAAOC,CAAU,EAAE,CAClC,CAAC,GAGL,IAAIC,EAAY,GAEhB,OAAO,QAAQX,CAAe,EAAE,QAAQ,CAAC,CAACC,EAAQG,CAAY,IAAM,CACvC,OAAO,OAAOA,CAAY,EAAE,KAAK,OAAO,IAG7DO,EAAY,GACZF,EACI;AAAA,oDAAuDR,CAAM,yGACjE,EAEA,OAAO,QAAQG,CAAY,EAAE,QAAQ,CAAC,CAACG,EAAYK,CAAS,IAAM,CACzDA,GACDH,EAAW,OAAOF,CAAU,EAAE,CAEtC,CAAC,EAET,CAAC,EAGGI,IACAF,EAAW;AAAA,iEAAoE,EAC/EA,EAAW;AAAA,CAAiF,GAGhGA,EAAW,2GAA2G,EAEtH,OAAO,kCAAoC,EAC/C","sourcesContent":["import { env } from \"node:process\";\n\nimport { loadedPluginsNames, possiblePlugins } from \"./config\";\nimport consoleLog from \"./utils/logger\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabStagedLintConfigLoaded) {\n if (env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/lint-stage-config loaded the following plugins:\\n\");\n\n loadedPluginsNames.forEach((pluginName) => {\n consoleLog(` ${pluginName}`);\n });\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePlugins).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"lint-stage-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your lint-staged command call \"NO_LOGS=true lint-staged ...\"');\n\n global.hasAnolilabStagedLintConfigLoaded = true;\n}\n\nexport { loadedPlugins as default } from \"./config\";\n","import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport eslintConfig from \"./groups/eslint\";\nimport jsonConfig from \"./groups/json\";\nimport markdownConfig from \"./groups/markdown\";\nimport secretlintConfig from \"./groups/secretlint\";\nimport stylesheetsConfig from \"./groups/stylesheets\";\nimport testsConfig from \"./groups/tests\";\nimport typescriptConfig from \"./groups/typescript\";\nimport anolilabLintStagedConfig from \"./utils/lint-staged-config\";\n\ntype Groups = {\n config: Config;\n configName: string;\n dependencies: string[];\n}[];\n\nconst groups: Groups = [\n {\n config: eslintConfig,\n configName: \"eslint\",\n dependencies: [\"eslint\"],\n },\n {\n config: jsonConfig,\n configName: \"json\",\n dependencies: [\"prettier\"],\n },\n {\n config: markdownConfig,\n configName: \"markdown\",\n dependencies: [\"markdownlint-cli\", \"markdownlint-cli2\"],\n },\n {\n config: secretlintConfig,\n configName: \"secretlint\",\n dependencies: [\"secretlint\"],\n },\n {\n config: stylesheetsConfig,\n configName: \"stylesheets\",\n dependencies: [\"stylelint\"],\n },\n {\n config: testsConfig,\n configName: \"tests\",\n dependencies: [\"vite\", \"jest\", \"ava\"],\n },\n {\n config: typescriptConfig,\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n },\n];\n\nlet loadedPlugins: Config = {};\nconst loadedPluginsNames: string[] = [];\n\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\ngroups.forEach((plugin) => {\n const { config, configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabLintStagedConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n if (foundDependencies.length > 0) {\n loadedPlugins = { ...loadedPlugins, ...config };\n loadedPluginsNames.push(configName);\n } else {\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n});\n\nconst loaded: Config = { ...loadedPlugins };\n\nexport { loaded as loadedPlugins, loadedPluginsNames, possiblePlugins };\n"]}
package/dist/index.mjs CHANGED
@@ -1,23 +1,24 @@
1
- import { a as a$8 } from './chunk-H67RQHXB.mjs';
2
- import { a as a$2 } from './chunk-GTUWYYHD.mjs';
1
+ import { a as a$9 } from './chunk-H67RQHXB.mjs';
2
+ import { a as a$3 } from './chunk-GZMUS57R.mjs';
3
3
  import { a as a$1 } from './chunk-AVDVT4B7.mjs';
4
4
  import './chunk-HGDREIGE.mjs';
5
- import { a as a$3 } from './chunk-SPRVGS3T.mjs';
6
- import { a as a$4 } from './chunk-Q3OATPM3.mjs';
7
- import { a as a$5 } from './chunk-ESC4EHDT.mjs';
8
- import { a as a$6 } from './chunk-S6JLN2LC.mjs';
9
- import { a as a$7 } from './chunk-7NPAYSRP.mjs';
5
+ import { a as a$4 } from './chunk-SPRVGS3T.mjs';
6
+ import { a as a$5 } from './chunk-EM7AZLVF.mjs';
7
+ import { a as a$6 } from './chunk-ESC4EHDT.mjs';
8
+ import { a as a$7 } from './chunk-MCRCUVTY.mjs';
9
+ import { a as a$2 } from './chunk-LJGFRIQ4.mjs';
10
+ import { a as a$8 } from './chunk-7NPAYSRP.mjs';
10
11
  import './chunk-PP4XAK3E.mjs';
11
12
  import './chunk-COM4XKFJ.mjs';
12
13
  import { env } from 'process';
13
14
  import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
14
15
 
15
- var y=[{config:a$2,configName:"eslint",dependencies:["prettier","eslint"]},{config:a$3,configName:"json",dependencies:["prettier","sort-package-json"]},{config:a$4,configName:"markdown",dependencies:["prettier","markdownlint-cli","markdownlint-cli2"]},{config:a$5,configName:"secretlint",dependencies:["secretlint"]},{config:a$6,configName:"stylesheets",dependencies:["stylelint"]},{config:a$7,configName:"tests",dependencies:["vite","jest","ava"]},{config:a$8,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};y.forEach(t=>{let{config:n,configName:i,dependencies:l}=t;if(a$1.plugin?.[i]!==!1){let s=[];l.forEach(e=>{(hasDependency(e)||hasDevDependency(e))&&s.push(e);}),s.length>0?(g={...g,...n},r.push(i)):(a[i]={},l.forEach(e=>{a[i][e]=hasDependency(e)||hasDevDependency(e);}));}});var w={...g};var j=()=>{},k=t=>env.NO_LOGS?j:n=>console.log(`${t}${n}`),O=k(""),o=O;if(!global.hasAnolilabStagedLintConfigLoaded){env.DEBUG&&(o(`
16
+ var y=[{config:a$3,configName:"eslint",dependencies:["eslint"]},{config:a$4,configName:"json",dependencies:["prettier"]},{config:a$5,configName:"markdown",dependencies:["markdownlint-cli","markdownlint-cli2"]},{config:a$6,configName:"secretlint",dependencies:["secretlint"]},{config:a$7,configName:"stylesheets",dependencies:["stylelint"]},{config:a$8,configName:"tests",dependencies:["vite","jest","ava"]},{config:a$9,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};y.forEach(s=>{let{config:i,configName:o,dependencies:l}=s;if(a$1.plugin?.[o]!==!1){let t=[];l.forEach(e=>{(hasDependency(e)||hasDevDependency(e))&&t.push(e);}),t.length>0?(g={...g,...i},r.push(o)):(a[o]={},l.forEach(e=>{a[o][e]=hasDependency(e)||hasDevDependency(e);}));}});var w={...g};if(!global.hasAnolilabStagedLintConfigLoaded){env.DEBUG&&(a$2(`
16
17
  @anolilab/lint-stage-config loaded the following plugins:
17
- `),r.forEach(n=>{o(` ${n}`);}));let t=!1;Object.entries(a).forEach(([n,i])=>{Object.values(i).some(Boolean)&&(t=!0,o(`
18
- Your package.json container dependencies for the "${n}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(i).forEach(([s,e])=>{e||o(` ${s}`);}));}),t&&(o(`
19
- To disable this message, add the following to your package.json:`),o(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
20
- `)),o('To disable all logging, add the following to your lint-staged command call "NO_LOGS=true lint-staged ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
18
+ `),r.forEach(i=>{a$2(` ${i}`);}));let s=!1;Object.entries(a).forEach(([i,o])=>{Object.values(o).some(Boolean)&&(s=!0,a$2(`
19
+ Your package.json container dependencies for the "${i}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(o).forEach(([t,e])=>{e||a$2(` ${t}`);}));}),s&&(a$2(`
20
+ To disable this message, add the following to your package.json:`),a$2(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
21
+ `)),a$2('To disable all logging, add the following to your lint-staged command call "NO_LOGS=true lint-staged ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
21
22
 
22
23
  export { w as default };
23
24
  //# sourceMappingURL=out.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/utils/logger.ts"],"names":["env","hasDependency","hasDevDependency","groups","eslint_default","json_default","markdown_default","secretlint_default","stylesheets_default","tests_default","typescript_default","loadedPlugins","loadedPluginsNames","possiblePlugins","plugin","config","configName","dependencies","lint_staged_config_default","foundDependencies","dependency","loaded","noop","consolePrefix","prefix","message","consoleLog","logger_default","pluginName","hasLogged","installed"],"mappings":"+ZAAA,OAAS,OAAAA,MAAW,UCApB,OAAS,iBAAAC,EAAe,oBAAAC,MAAwB,+BAkBhD,IAAMC,EAAiB,CACnB,CACI,OAAQC,EACR,WAAY,SACZ,aAAc,CAAC,WAAY,QAAQ,CACvC,EACA,CACI,OAAQC,EACR,WAAY,OACZ,aAAc,CAAC,WAAY,mBAAmB,CAClD,EACA,CACI,OAAQC,EACR,WAAY,WACZ,aAAc,CAAC,WAAY,mB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AAe,CACvCD,EAAW,OAAOC,CAAU,EAAE,CAClC,CAAC,GAGL,IAAIC,EAAY,GAEhB,OAAO,QAAQhB,CAAe,EAAE,QAAQ,CAAC,CAACC,EAAQG,CAAY,IAAM,CACvC,OAAO,OAAOA,CAAY,EAAE,KAAK,OAAO,IAG7DY,EAAY,GACZF,EACI;AAAA,oDAAuDb,CAAM,yGACjE,EAEA,OAAO,QAAQG,CAAY,EAAE,QAAQ,CAAC,CAACG,EAAYU,CAAS,IAAM,CACzDA,GACDH,EAAW,OAAOP,CAAU,EAAE,CAEtC,CAAC,EAET,CAAC,EAGGS,IACAF,EAAW;AAAA,iEAAoE,EAC/EA,EAAW;AAAA,CAAiF,GAGhGA,EAAW,2GAA2G,EAEtH,OAAO,kCAAoC,EAC/C","sourcesContent":["import { env } from \"node:process\";\n\nimport { loadedPluginsNames, possiblePlugins } from \"./config\";\nimport consoleLog from \"./utils/logger\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabStagedLintConfigLoaded) {\n if (env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/lint-stage-config loaded the following plugins:\\n\");\n\n loadedPluginsNames.forEach((pluginName) => {\n consoleLog(` ${pluginName}`);\n });\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePlugins).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"lint-stage-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your lint-staged command call \"NO_LOGS=true lint-staged ...\"');\n\n global.hasAnolilabStagedLintConfigLoaded = true;\n}\n\nexport { loadedPlugins as default } from \"./config\";\n","import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport eslintConfig from \"./groups/eslint\";\nimport jsonConfig from \"./groups/json\";\nimport markdownConfig from \"./groups/markdown\";\nimport secretlintConfig from \"./groups/secretlint\";\nimport stylesheetsConfig from \"./groups/stylesheets\";\nimport testsConfig from \"./groups/tests\";\nimport typescriptConfig from \"./groups/typescript\";\nimport anolilabLintStagedConfig from \"./utils/lint-staged-config\";\n\ntype Groups = {\n config: Config;\n configName: string;\n dependencies: string[];\n}[];\n\nconst groups: Groups = [\n {\n config: eslintConfig,\n configName: \"eslint\",\n dependencies: [\"prettier\", \"eslint\"],\n },\n {\n config: jsonConfig,\n configName: \"json\",\n dependencies: [\"prettier\", \"sort-package-json\"],\n },\n {\n config: markdownConfig,\n configName: \"markdown\",\n dependencies: [\"prettier\", \"markdownlint-cli\", \"markdownlint-cli2\"],\n },\n {\n config: secretlintConfig,\n configName: \"secretlint\",\n dependencies: [\"secretlint\"],\n },\n {\n config: stylesheetsConfig,\n configName: \"stylesheets\",\n dependencies: [\"stylelint\"],\n },\n {\n config: testsConfig,\n configName: \"tests\",\n dependencies: [\"vite\", \"jest\", \"ava\"],\n },\n {\n config: typescriptConfig,\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n },\n];\n\nlet loadedPlugins: Config = {};\nconst loadedPluginsNames: string[] = [];\n\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\ngroups.forEach((plugin) => {\n const { config, configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabLintStagedConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n if (foundDependencies.length > 0) {\n loadedPlugins = { ...loadedPlugins, ...config };\n loadedPluginsNames.push(configName);\n } else {\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n});\n\nconst loaded: Config = { ...loadedPlugins };\n\nexport { loaded as loadedPlugins, loadedPluginsNames, possiblePlugins };\n","import { env } from \"node:process\";\n\nconst noop = () => undefined;\n\nconst consolePrefix = (prefix: string) => (env[\"NO_LOGS\"] ? noop : (message: string) => console.log(`${prefix}${message}`));\n\nconst consoleLog = consolePrefix(\"\");\n\nexport default consoleLog;\n"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts"],"names":["env","hasDependency","hasDevDependency","groups","eslint_default","json_default","markdown_default","secretlint_default","stylesheets_default","tests_default","typescript_default","loadedPlugins","loadedPluginsNames","possiblePlugins","plugin","config","configName","dependencies","lint_staged_config_default","foundDependencies","dependency","loaded","logger_default","pluginName","hasLogged","installed"],"mappings":"wcAAA,OAAS,OAAAA,MAAW,UCApB,OAAS,iBAAAC,EAAe,oBAAAC,MAAwB,+BAkBhD,IAAMC,EAAiB,CACnB,CACI,OAAQC,EACR,WAAY,SACZ,aAAc,CAAC,QAAQ,CAC3B,EACA,CACI,OAAQC,EACR,WAAY,OACZ,aAAc,CAAC,UAAU,CAC7B,EACA,CACI,OAAQC,EACR,WAAY,WACZ,aAAc,CAAC,mBAAoB,mBAAmB,CAC1D,EACA,CACI,OAAQC,EACR,WAAY,aACZ,aAAc,CAAC,YAAY,CAC/B,EACA,CACI,OAAQC,EACR,WAAY,cACZ,aAAc,CAAC,WAAW,CAC9B,EACA,CACI,OAAQC,EACR,WAAY,QACZ,aAAc,CAAC,OAAQ,OAAQ,KAAK,CACxC,EACA,CACI,OAAQC,EACR,WAAY,aACZ,aA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GAA2G,EAEtH,OAAO,kCAAoC,EAC/C","sourcesContent":["import { env } from \"node:process\";\n\nimport { loadedPluginsNames, possiblePlugins } from \"./config\";\nimport consoleLog from \"./utils/logger\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabStagedLintConfigLoaded) {\n if (env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/lint-stage-config loaded the following plugins:\\n\");\n\n loadedPluginsNames.forEach((pluginName) => {\n consoleLog(` ${pluginName}`);\n });\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePlugins).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"lint-stage-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your lint-staged command call \"NO_LOGS=true lint-staged ...\"');\n\n global.hasAnolilabStagedLintConfigLoaded = true;\n}\n\nexport { loadedPlugins as default } from \"./config\";\n","import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport eslintConfig from \"./groups/eslint\";\nimport jsonConfig from \"./groups/json\";\nimport markdownConfig from \"./groups/markdown\";\nimport secretlintConfig from \"./groups/secretlint\";\nimport stylesheetsConfig from \"./groups/stylesheets\";\nimport testsConfig from \"./groups/tests\";\nimport typescriptConfig from \"./groups/typescript\";\nimport anolilabLintStagedConfig from \"./utils/lint-staged-config\";\n\ntype Groups = {\n config: Config;\n configName: string;\n dependencies: string[];\n}[];\n\nconst groups: Groups = [\n {\n config: eslintConfig,\n configName: \"eslint\",\n dependencies: [\"eslint\"],\n },\n {\n config: jsonConfig,\n configName: \"json\",\n dependencies: [\"prettier\"],\n },\n {\n config: markdownConfig,\n configName: \"markdown\",\n dependencies: [\"markdownlint-cli\", \"markdownlint-cli2\"],\n },\n {\n config: secretlintConfig,\n configName: \"secretlint\",\n dependencies: [\"secretlint\"],\n },\n {\n config: stylesheetsConfig,\n configName: \"stylesheets\",\n dependencies: [\"stylelint\"],\n },\n {\n config: testsConfig,\n configName: \"tests\",\n dependencies: [\"vite\", \"jest\", \"ava\"],\n },\n {\n config: typescriptConfig,\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n },\n];\n\nlet loadedPlugins: Config = {};\nconst loadedPluginsNames: string[] = [];\n\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\ngroups.forEach((plugin) => {\n const { config, configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabLintStagedConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n if (foundDependencies.length > 0) {\n loadedPlugins = { ...loadedPlugins, ...config };\n loadedPluginsNames.push(configName);\n } else {\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n});\n\nconst loaded: Config = { ...loadedPlugins };\n\nexport { loaded as loadedPlugins, loadedPluginsNames, possiblePlugins };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/lint-staged-config",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Shareable Lint-Staged Config for any project.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkKP7AH4EU_js = require('./chunk-KP7AH4EU.js');
4
- var chunkP4FK54EG_js = require('./chunk-P4FK54EG.js');
5
- var packageJsonUtils = require('@anolilab/package-json-utils');
6
-
7
- 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 e={"**/*.md":i=>[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`${chunkP4FK54EG_js.a()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${chunkKP7AH4EU_js.b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`${chunkP4FK54EG_js.a()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${chunkKP7AH4EU_js.b(i)}`]:[]],"**/*.mdx":i=>[`${chunkP4FK54EG_js.a()} exec prettier --write ${chunkKP7AH4EU_js.b(i)}`]},g=e;
8
-
9
- exports.a = g;
10
- //# sourceMappingURL=out.js.map
11
- //# sourceMappingURL=chunk-4PAU4XRY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","group","filenames","get_package_manager_default","concat_files_default","markdown_default"],"mappings":"gFAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAM3C,OAAO,mCACR,OAAO,iCAAmCD,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAEjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGzH,IAAMC,EAAgB,CAClB,UAAYC,GAAwB,CAChC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,GACtE,GAAI,OAAO,iCACL,CAAC,GAAGC,EAAkB,CAAC,qFAAqFC,EAAYF,CAAS,CAAC,EAAE,EACpI,CAAC,EACP,GAAI,OAAO,kCACL,CAAC,GAAGC,EAAkB,CAAC,0EAA0EC,EAAYF,CAAS,CAAC,EAAE,EACzH,CAAC,CACX,EACA,WAAaA,GAAc,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,CACxG,EAEOG,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nconst group: Config = {\n \"**/*.md\": (filenames: string[]) => [\n `${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`,\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`${getPackageManager()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2\n ? [`${getPackageManager()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ],\n \"**/*.mdx\": (filenames) => [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`],\n};\n\nexport default group;\n"]}
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkKP7AH4EU_js = require('./chunk-KP7AH4EU.js');
4
- var chunkP4FK54EG_js = require('./chunk-P4FK54EG.js');
5
-
6
- var s={[`**/*.{${["css","sass","scss","less"].join(",")}}`]:o=>[`${chunkP4FK54EG_js.a()} exec prettier --ignore-unknown --write ${chunkKP7AH4EU_js.b(o)}`,`${chunkP4FK54EG_js.a()} exec stylelint --fix`]},n=s;
7
-
8
- exports.a = n;
9
- //# sourceMappingURL=out.js.map
10
- //# sourceMappingURL=chunk-5J6LVG23.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["group","filenames","get_package_manager_default","concat_files_default","stylesheets_default"],"mappings":"gFAKA,IAAMA,EAAgB,CAClB,CAAC,SAAS,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CAC9E,GAAGC,EAAkB,CAAC,2CAA2CC,EAAYF,CAAS,CAAC,GACvF,GAAGC,EAAkB,CAAC,uBAC1B,CACJ,EAEOE,EAAQJ","sourcesContent":["import type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\n\nconst group: Config = {\n [`**/*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n `${getPackageManager()} exec prettier --ignore-unknown --write ${concatFiles(filenames)}`,\n `${getPackageManager()} exec stylelint --fix`,\n ],\n};\n\nexport default group;\n"]}
@@ -1,18 +0,0 @@
1
- import { a as a$1 } from './chunk-AVDVT4B7.mjs';
2
- import { a as a$3 } from './chunk-HGDREIGE.mjs';
3
- import { b as b$1, a as a$4 } from './chunk-PP4XAK3E.mjs';
4
- import { a as a$2 } from './chunk-COM4XKFJ.mjs';
5
- import { hasDependency, hasDevDependency, isPackageAvailable } from '@anolilab/package-json-utils';
6
- import { dirname } from 'path';
7
- import { ESLint } from 'eslint';
8
- import { quote } from 'shell-quote';
9
-
10
- var E=n=>{let t={};return n.forEach(o=>{let i=dirname(o);t[i]||(t[i]=[]),t[i].push(o);}),t},h=E;var A=async n=>{let t=new ESLint,i=(await Promise.allSettled(n.map(async e=>await t.isPathIgnored(e)))).map(e=>{if(e.status==="fulfilled")return e.value;throw console.error(`
11
- Unable to determine if file is ignored.
12
-
13
-
14
- ${e.reason}`),new Error("Stopping lint-staged because of an error.")});return n.filter((e,r)=>!i[r]).map(e=>`"${a$4?e:quote([e])}"`)},w=A;var s={};a$1?.eslint?s=a$1.eslint:a$1?.settings?.eslint&&(s=a$1.settings.eslint);var f=[];(hasDependency("eslint-plugin-react-hooks")||hasDevDependency("eslint-plugin-react-hooks"))&&f.push("react-hooks/exhaustive-deps:off");(hasDependency("eslint-plugin-eslint-comments")||hasDevDependency("eslint-plugin-eslint-comments")||isPackageAvailable("eslint-plugin-eslint-comments"))&&f.push("eslint-comments/no-unused-disable:off");var a=".eslintrc",D=()=>{let n=[];s["max-warnings"]!==void 0&&Number.isNaN(s["max-warnings"])?n.push(`--max-warnings=${s["max-warnings"]}`):s["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[...s.rules??[],...f].filter(i=>i.trim().length>0);t.length>0&&n.push(t.map(i=>`--rule "${i}"`).join(" "));let o=[...s["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return o.length>0&&n.push(`--fix-type ${o.join(",")}`,"--fix"),s.cache&&n.push("--cache"),n},L=async n=>{let t=await w(n),o=D();if(s.config)return o.push(`--config ${s.config}`),[`${a$2()} exec eslint ${o.join(" ")} ${t.join(" ")}`];let i=h(t),c=[];return Object.values(i).forEach(e=>{let r;[a,`${a}.js`,`${a}.cjs`,`${a}.json`,`${a}.yaml`,`${a}.yml`].forEach(j=>{if(!r)try{r=a$3(j,e[0]);}catch{}}),r&&c.push(`${a$2()} exec eslint ${o.join(" ")} --config ${r} ${e.join(" ")}`);}),c},m=L;var b=["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&&b.push("md");var M={[`**/*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await m(n)],[`**/*.{${[b].join(",")}}`]:async n=>[`${a$2()} exec prettier --write ${b$1(n)}`,...await m(n)]},V=M;
15
-
16
- export { V as a };
17
- //# sourceMappingURL=out.js.map
18
- //# sourceMappingURL=chunk-GTUWYYHD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/eslint/index.ts","../src/groups/eslint/create-eslint-commands.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts"],"names":["hasDependency","hasDevDependency","isPackageAvailable","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","promise","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","lint_staged_config_default","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","fixType","type","createEslintCommands","filteredFiles","get_package_manager_default","groupedFilesNames","eslintCommands","config","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"2KAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BCAhD,OAAS,iBAAAD,EAAe,oBAAAC,EAAkB,sBAAAC,MAA0B,+BCApE,OAAS,WAAAC,MAAe,OAExB,IAAMC,EAAiCC,GAAkD,CACrF,IAAMC,EAAmC,CAAC,EAE1C,OAAAD,EAAU,QAASE,GAAa,CAC5B,IAAMC,EAAgBL,EAAQI,CAAQ,EAGjCD,EAAOE,CAAa,IAEr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,aAAaU,CAAM,IAAIhC,EAAU,KAAK,GAAG,CAAC,EAAE,CAEvI,CAAC,EAEM+B,CACX,EAEOI,EAAQR,EDrIf,IAAMS,EAAa,CAAC,MAAO,KAAM,MAAO,MAAO,KAAM,MAAO,MAAO,OAAQ,MAAO,MAAO,MAAO,MAAM,EAEjG,OAAO,mCACR,OAAO,iCAAmCzC,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAGjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGrH,CAAC,OAAO,kCAAoC,CAAC,OAAO,mCACpDwC,EAAW,KAAK,IAAI,EAGxB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,OAAQ,QAAS,OAAO,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO7B,GAAwB,CAAC,GAAI,MAAM2B,EAAqB3B,CAAS,CAAE,EAC9H,CAAC,SAAS,CAAC4B,CAAU,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO5B,GAAwB,CACjE,GAAGqB,EAAkB,CAAC,0BAA0BS,EAAY9B,CAAS,CAAC,GACtE,GAAI,MAAM2B,EAAqB3B,CAAS,CAC5C,CACJ,EAEO+B,EAAQF","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport getPackageManager from \"../../utils/get-package-manager\";\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 `${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { hasDependency, hasDevDependency, isPackageAvailable } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ninterface EslintConfig {\n cache?: boolean;\n config?: string;\n \"fix-type\"?: string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n}\n\ninterface StagedConfig {\n eslint?: EslintConfig;\n settings?: {\n eslint?: EslintConfig;\n };\n}\n\nlet eslintSettings: EslintConfig = {} as EslintConfig;\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nif ((anolilabLintStagedConfig as StagedConfig)?.eslint) {\n eslintSettings = (anolilabLintStagedConfig as StagedConfig).eslint as EslintConfig;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n} else if ((anolilabLintStagedConfig as StagedConfig)?.settings?.eslint) {\n eslintSettings = (\n (anolilabLintStagedConfig as StagedConfig).settings as {\n eslint?: EslintConfig;\n }\n ).eslint as EslintConfig;\n}\n\nconst eslintGlobalRulesForFix: string[] = [];\n\nif (hasDependency(\"eslint-plugin-react-hooks\") || hasDevDependency(\"eslint-plugin-react-hooks\")) {\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 eslintGlobalRulesForFix.push(\"react-hooks/exhaustive-deps:off\");\n}\n\nif (\n hasDependency(\"eslint-plugin-eslint-comments\") ||\n hasDevDependency(\"eslint-plugin-eslint-comments\") ||\n isPackageAvailable(\"eslint-plugin-eslint-comments\")\n) {\n eslintGlobalRulesForFix.push(\"eslint-comments/no-unused-disable: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 = [...(eslintSettings.rules ?? []), ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0);\n\n if (rules.length > 0) {\n eslintArguments.push(rules.map((rule) => `--rule \"${rule}\"`).join(\" \"));\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 [`${getPackageManager()} exec 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}\") as string;\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`${getPackageManager()} exec eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): Record<string, string[]> => {\n const groups: Record<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","import { 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 promises = await Promise.allSettled(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n const ignoredFiles = promises.map((promise) => {\n if (promise.status === \"fulfilled\") {\n return promise.value;\n }\n\n console.error(`\\nUnable to determine if file is ignored.\\n\\n\\n${promise.reason}`);\n\n throw new Error(\"Stopping lint-staged because of an error.\");\n });\n\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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/eslint/index.ts","../src/groups/eslint/create-eslint-commands.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts"],"names":["hasDependency","hasDevDependency","isPackageAvailable","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","promise","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","lint_staged_config_default","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","fixType","type","createEslintCommands","filteredFiles","get_package_manager_default","groupedFilesNames","eslintCommands","config","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"uKAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BCAhD,OAAS,iBAAAD,EAAe,oBAAAC,EAAkB,sBAAAC,MAA0B,+BCApE,OAAS,WAAAC,MAAe,OAExB,IAAMC,EAAiCC,GAAkD,CACrF,IAAMC,EAAmC,CAAC,EAE1C,OAAAD,EAAU,QAASE,GAAa,CAC5B,IAAMC,EAAgBL,EAAQI,CAAQ,EAGjCD,EAAOE,CAAa,IAErBF,EAAOE,CAAa,EAAI,CAAC,GAG5BF,EAAOE,CAAa,EAAe,KAAK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AAC,EAEM+B,CACX,EAEOI,EAAQR,EDrIf,IAAMS,EAAa,CAAC,MAAO,KAAM,MAAO,MAAO,KAAM,MAAO,MAAO,OAAQ,MAAO,MAAO,MAAO,MAAM,EAEjG,OAAO,mCACR,OAAO,iCAAmCzC,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAGjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGrH,CAAC,OAAO,kCAAoC,CAAC,OAAO,mCACpDwC,EAAW,KAAK,IAAI,EAGxB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,OAAQ,QAAS,OAAO,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO7B,GAAwB,CAAC,GAAI,MAAM2B,EAAqB3B,CAAS,CAAE,EAC9H,CAAC,SAAS,CAAC4B,CAAU,EAAE,KAAK,GAAG,CAAC,GAAG,EAAG,MAAO5B,GAAwB,CACjE,GAAGqB,EAAkB,CAAC,0BAA0BS,EAAY9B,CAAS,CAAC,GACtE,GAAI,MAAM2B,EAAqB3B,CAAS,CAC5C,CACJ,EAEO+B,EAAQF","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport getPackageManager from \"../../utils/get-package-manager\";\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 `${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n};\n\nexport default group;\n","import { hasDependency, hasDevDependency, isPackageAvailable } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport getPackageManager from \"../../utils/get-package-manager\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ninterface EslintConfig {\n cache?: boolean;\n config?: string;\n \"fix-type\"?: string[];\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n}\n\ninterface StagedConfig {\n eslint?: EslintConfig;\n settings?: {\n eslint?: EslintConfig;\n };\n}\n\nlet eslintSettings: EslintConfig = {} as EslintConfig;\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nif ((anolilabLintStagedConfig as StagedConfig)?.eslint) {\n eslintSettings = (anolilabLintStagedConfig as StagedConfig).eslint as EslintConfig;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n} else if ((anolilabLintStagedConfig as StagedConfig)?.settings?.eslint) {\n eslintSettings = (\n (anolilabLintStagedConfig as StagedConfig).settings as {\n eslint?: EslintConfig;\n }\n ).eslint as EslintConfig;\n}\n\nconst eslintGlobalRulesForFix: string[] = [];\n\nif (hasDependency(\"eslint-plugin-react-hooks\") || hasDevDependency(\"eslint-plugin-react-hooks\")) {\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 eslintGlobalRulesForFix.push(\"react-hooks/exhaustive-deps:off\");\n}\n\nif (\n hasDependency(\"eslint-plugin-eslint-comments\") ||\n hasDevDependency(\"eslint-plugin-eslint-comments\") ||\n isPackageAvailable(\"eslint-plugin-eslint-comments\")\n) {\n eslintGlobalRulesForFix.push(\"eslint-comments/no-unused-disable: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 = [...(eslintSettings.rules ?? []), ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0);\n\n if (rules.length > 0) {\n eslintArguments.push(rules.map((rule) => `--rule \"${rule}\"`).join(\" \"));\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 [`${getPackageManager()} exec 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}\") as string;\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`${getPackageManager()} exec eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): Record<string, string[]> => {\n const groups: Record<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","import { 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 promises = await Promise.allSettled(filenames.map(async (filename) => await eslint.isPathIgnored(filename)));\n const ignoredFiles = promises.map((promise) => {\n if (promise.status === \"fulfilled\") {\n return promise.value;\n }\n\n console.error(`\\nUnable to determine if file is ignored.\\n\\n\\n${promise.reason}`);\n\n throw new Error(\"Stopping lint-staged because of an error.\");\n });\n\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"]}
@@ -1,9 +0,0 @@
1
- import { b } from './chunk-PP4XAK3E.mjs';
2
- import { a } from './chunk-COM4XKFJ.mjs';
3
- import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
4
-
5
- global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));var e={"**/*.md":i=>[`${a()} exec prettier --write ${b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`${a()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`${a()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${b(i)}`]:[]],"**/*.mdx":i=>[`${a()} exec prettier --write ${b(i)}`]},g=e;
6
-
7
- export { g as a };
8
- //# sourceMappingURL=out.js.map
9
- //# sourceMappingURL=chunk-Q3OATPM3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","group","filenames","get_package_manager_default","concat_files_default","markdown_default"],"mappings":"kFAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAM3C,OAAO,mCACR,OAAO,iCAAmCD,EAAc,kBAAkB,GAAKC,EAAiB,kBAAkB,GAEjH,OAAO,oCACR,OAAO,kCAAoCD,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,GAGzH,IAAMC,EAAgB,CAClB,UAAYC,GAAwB,CAChC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,GACtE,GAAI,OAAO,iCACL,CAAC,GAAGC,EAAkB,CAAC,qFAAqFC,EAAYF,CAAS,CAAC,EAAE,EACpI,CAAC,EACP,GAAI,OAAO,kCACL,CAAC,GAAGC,EAAkB,CAAC,0EAA0EC,EAAYF,CAAS,CAAC,EAAE,EACzH,CAAC,CACX,EACA,WAAaA,GAAc,CAAC,GAAGC,EAAkB,CAAC,0BAA0BC,EAAYF,CAAS,CAAC,EAAE,CACxG,EAEOG,EAAQJ","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nconst group: Config = {\n \"**/*.md\": (filenames: string[]) => [\n `${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`,\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`${getPackageManager()} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2\n ? [`${getPackageManager()} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ],\n \"**/*.mdx\": (filenames) => [`${getPackageManager()} exec prettier --write ${concatFiles(filenames)}`],\n};\n\nexport default group;\n"]}
@@ -1,8 +0,0 @@
1
- import { b } from './chunk-PP4XAK3E.mjs';
2
- import { a } from './chunk-COM4XKFJ.mjs';
3
-
4
- var s={[`**/*.{${["css","sass","scss","less"].join(",")}}`]:o=>[`${a()} exec prettier --ignore-unknown --write ${b(o)}`,`${a()} exec stylelint --fix`]},n=s;
5
-
6
- export { n as a };
7
- //# sourceMappingURL=out.js.map
8
- //# sourceMappingURL=chunk-S6JLN2LC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["group","filenames","get_package_manager_default","concat_files_default","stylesheets_default"],"mappings":"kFAKA,IAAMA,EAAgB,CAClB,CAAC,SAAS,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CAC9E,GAAGC,EAAkB,CAAC,2CAA2CC,EAAYF,CAAS,CAAC,GACvF,GAAGC,EAAkB,CAAC,uBAC1B,CACJ,EAEOE,EAAQJ","sourcesContent":["import type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\nimport getPackageManager from \"../utils/get-package-manager\";\n\nconst group: Config = {\n [`**/*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n `${getPackageManager()} exec prettier --ignore-unknown --write ${concatFiles(filenames)}`,\n `${getPackageManager()} exec stylelint --fix`,\n ],\n};\n\nexport default group;\n"]}