@anolilab/lint-staged-config 2.1.7 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE.md +139 -0
- package/README.md +52 -77
- package/dist/bin.mjs +88 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.mts +39 -3
- package/dist/index.d.ts +39 -3
- package/dist/index.mjs +3 -14
- package/package.json +115 -155
- package/dist/chunk-24WLFZUE.mjs +0 -8
- package/dist/chunk-24WLFZUE.mjs.map +0 -1
- package/dist/chunk-ALAT5PPB.js +0 -9
- package/dist/chunk-ALAT5PPB.js.map +0 -1
- package/dist/chunk-AVDVT4B7.mjs +0 -7
- package/dist/chunk-AVDVT4B7.mjs.map +0 -1
- package/dist/chunk-COM4XKFJ.mjs +0 -7
- package/dist/chunk-COM4XKFJ.mjs.map +0 -1
- package/dist/chunk-HGDREIGE.mjs +0 -9
- package/dist/chunk-HGDREIGE.mjs.map +0 -1
- package/dist/chunk-LJGFRIQ4.mjs +0 -7
- package/dist/chunk-LJGFRIQ4.mjs.map +0 -1
- package/dist/chunk-OYUEMN5Q.js +0 -9
- package/dist/chunk-OYUEMN5Q.js.map +0 -1
- package/dist/chunk-P4FK54EG.js +0 -9
- package/dist/chunk-P4FK54EG.js.map +0 -1
- package/dist/chunk-PLWO6XD7.js +0 -11
- package/dist/chunk-PLWO6XD7.js.map +0 -1
- package/dist/chunk-VU6SMFTD.js +0 -15
- package/dist/chunk-VU6SMFTD.js.map +0 -1
- package/dist/groups/eslint/index.d.mts +0 -5
- package/dist/groups/eslint/index.d.ts +0 -5
- package/dist/groups/eslint/index.js +0 -21
- package/dist/groups/eslint/index.js.map +0 -1
- package/dist/groups/eslint/index.mjs +0 -19
- package/dist/groups/eslint/index.mjs.map +0 -1
- package/dist/groups/json.d.mts +0 -5
- package/dist/groups/json.d.ts +0 -5
- package/dist/groups/json.js +0 -11
- package/dist/groups/json.js.map +0 -1
- package/dist/groups/json.mjs +0 -9
- package/dist/groups/json.mjs.map +0 -1
- package/dist/groups/markdown.d.mts +0 -5
- package/dist/groups/markdown.d.ts +0 -5
- package/dist/groups/markdown.js +0 -12
- package/dist/groups/markdown.js.map +0 -1
- package/dist/groups/markdown.mjs +0 -10
- package/dist/groups/markdown.mjs.map +0 -1
- package/dist/groups/secretlint.d.mts +0 -5
- package/dist/groups/secretlint.d.ts +0 -5
- package/dist/groups/secretlint.js +0 -9
- package/dist/groups/secretlint.js.map +0 -1
- package/dist/groups/secretlint.mjs +0 -7
- package/dist/groups/secretlint.mjs.map +0 -1
- package/dist/groups/stylesheets.d.mts +0 -5
- package/dist/groups/stylesheets.d.ts +0 -5
- package/dist/groups/stylesheets.js +0 -12
- package/dist/groups/stylesheets.js.map +0 -1
- package/dist/groups/stylesheets.mjs +0 -10
- package/dist/groups/stylesheets.mjs.map +0 -1
- package/dist/groups/tests.d.mts +0 -5
- package/dist/groups/tests.d.ts +0 -5
- package/dist/groups/tests.js +0 -11
- package/dist/groups/tests.js.map +0 -1
- package/dist/groups/tests.mjs +0 -9
- package/dist/groups/tests.mjs.map +0 -1
- package/dist/groups/typescript.d.mts +0 -5
- package/dist/groups/typescript.d.ts +0 -5
- package/dist/groups/typescript.js +0 -12
- package/dist/groups/typescript.js.map +0 -1
- package/dist/groups/typescript.mjs +0 -10
- package/dist/groups/typescript.mjs.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/postinstall.d.mts +0 -2
- package/dist/postinstall.d.ts +0 -2
- package/dist/postinstall.js +0 -97
- package/dist/postinstall.js.map +0 -1
- package/dist/postinstall.mjs +0 -95
- package/dist/postinstall.mjs.map +0 -1
- package/group/package.json +0 -44
- package/skip.js +0 -7
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { env } from 'process';
|
|
4
|
-
import { createRequire } from 'module';
|
|
5
|
-
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
1
|
+
var E=Object.defineProperty;var d=(t,e)=>E(t,"name",{value:e,configurable:!0});import{hasPackageJsonAnyDependency as a,parsePackageJson as _,findPackageManagerSync as P}from"@visulima/package";import{findUpSync as S,isAccessibleSync as A,readFileSync as T}from"@visulima/fs";import{existsSync as O}from"node:fs";import{dirname as y,join as N}from"node:path";import{ESLint as C}from"eslint";import{quote as j}from"shell-quote";import{platform as R,env as q}from"node:process";var F=Object.defineProperty,$=d((t,e)=>F(t,"name",{value:e,configurable:!0}),"o$1");const G=$(t=>{const e=S("package.json",{cwd:t});return e&&y(e)},"packageDirectorySync"),L=$(t=>{const e=G(t??process.cwd());if(e?.startsWith("/"))return e;throw new Error(`Cannot determine the nearest root of the package for the file: ${t}!`)},"getNearestPackageRootPath"),D=$(t=>{const e=N(...t);if(e.startsWith("/"))return e;throw new TypeError("Joined path did not return an absolute path.")},"joinPaths"),w=$((t,e)=>{const o=L(e),s=D([o,t]);if(A(s))return s;throw new Error(`Cannot locate nearest "${t}" file!`)},"getNearestConfigPath");var J=Object.defineProperty,H=d((t,e)=>J(t,"name",{value:e,configurable:!0}),"i$1");const I=H(t=>{const e={};return t.forEach(o=>{const s=y(o);e[s]||(e[s]=[]),e[s].push(o)}),e},"groupFilePathsByDirectoryName"),v=R==="win32"||/^(msys|cygwin)$/u.test(q.OSTYPE??"");var M=Object.defineProperty,U=d((t,e)=>M(t,"name",{value:e,configurable:!0}),"o");const W=U(async t=>{const e=new C,o=(await Promise.allSettled(t.map(async s=>await e.isPathIgnored(s)))).map(s=>{if(s.status==="fulfilled")return s.value;throw console.error(`
|
|
2
|
+
Unable to determine if file is ignored.
|
|
6
3
|
|
|
7
|
-
var m=createRequire(import.meta.url),u=[{configName:"eslint",dependencies:["eslint"]},{configName:"json",dependencies:["prettier"]},{configName:"markdown",dependencies:["markdownlint-cli","markdownlint-cli2"]},{configName:"secretlint",dependencies:["secretlint"]},{configName:"stylesheets",dependencies:["stylelint"]},{configName:"tests",dependencies:["vite","jest","ava"]},{configName:"typescript",dependencies:["typescript"]}],l={},g=[],a={};u.forEach(s=>{let{configName:n,dependencies:i}=s;if(a$1.plugin?.[n]!==!1){let t=[];if(i.forEach(e=>{(hasDependency(e)||hasDevDependency(e))&&t.push(e);}),t.length>0){let e=m(`./groups/${n}`);l={...l,...e},g.push(n);}else a[n]={},i.forEach(e=>{a[n][e]=hasDependency(e)||hasDevDependency(e);});}});var h={...l};if(!global.hasAnolilabStagedLintConfigLoaded){env.DEBUG&&(a$2(`
|
|
8
|
-
@anolilab/lint-stage-config loaded the following plugins:
|
|
9
|
-
`),g.forEach(n=>{a$2(` ${n}`);}));let s=!1;Object.entries(a).forEach(([n,i])=>{Object.values(i).some(Boolean)&&(s=!0,a$2(`
|
|
10
|
-
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(([e,f])=>{f||a$2(` ${e}`);}));}),s&&(a$2(`
|
|
11
|
-
To disable this message, add the following to your package.json:`),a$2(` "anolilab": { "lint-stage-config": { plugin: { "plugin-name": false } } }
|
|
12
|
-
`)),a$2('To disable all logging, add the following to your lint-staged command call "NO_LOGS=true lint-staged ..."'),global.hasAnolilabStagedLintConfigLoaded=!0;}
|
|
13
4
|
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=out.js.map
|
|
16
|
-
//# sourceMappingURL=index.mjs.map
|
|
5
|
+
${s.reason}`),new Error("Stopping lint-staged because of an error.")});return t.filter((s,n)=>!o[n]).map(s=>`"${v?s:j([s])}"`)},"removeIgnoredFiles");var B=Object.defineProperty,k=d((t,e)=>B(t,"name",{value:e,configurable:!0}),"m");const x=".eslintrc",Y=k((t,e)=>{const o=[];t["max-warnings"]!==void 0&&Number.isNaN(t["max-warnings"])?o.push(`--max-warnings=${t["max-warnings"]}`):t["max-warnings"]!==!1&&o.push("--max-warnings=0");const s=[];a(e,["eslint-plugin-react-hooks"])&&s.push("react-hooks/exhaustive-deps:off"),a(e,["eslint-plugin-eslint-comments"])&&s.push("eslint-comments/no-unused-disable:off");const n=[...t.rules??[],...s].filter(p=>p.trim().length>0);n.length>0&&o.push(n.map(p=>`--rule "${p}"`).join(" "));const l=[...t["fix-type"]??["layout"]].filter(p=>p.trim().length>0);return l.length>0&&o.push(`--fix-type ${l.join(",")}`,"--fix"),t.cache&&o.push("--cache"),o},"createEslintArguments"),z=k(async(t,e,o,s)=>{const n=await W(s),l=Y(o,e);if(o.config)return l.push(`--config ${o.config}`),[`${t} exec eslint ${l.join(" ")} ${n.join(" ")}`];const p=I(n),f=[];return Object.values(p).forEach(i=>{let r;[x,`${x}.js`,`${x}.cjs`,`${x}.json`,`${x}.yaml`,`${x}.yml`].forEach(m=>{if(!r)try{r=w(m,i[0])}catch{}}),r&&f.push(`${t} exec eslint ${l.join(" ")} --config ${r} ${i.join(" ")}`)}),f},"createEslintCommands");var K=Object.defineProperty,Q=d((t,e)=>K(t,"name",{value:e,configurable:!0}),"r");const c=Q(t=>t.map(e=>`"${v?e:j([e])}"`).join(" ").replaceAll("/@","/@"),"concatFiles");var V=Object.defineProperty,h=d((t,e)=>V(t,"name",{value:e,configurable:!0}),"g");const X=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml","json","json5","jsonc"],Z=["cts","ts","mts","tsx","ctsx"],ee=["css","scss","sass","less","styl","stylus","pcss","postcss","sss"],le=h((t={})=>{const e={debug:!1,eslint:{extensions:X},typescript:{exclude:[],extensions:Z},stylesheets:{extensions:ee},...t},o=e.cwd||process.cwd();if(!O(`${o}/package.json`))throw new Error(`No package.json found in the current working directory: ${o}; Please adjust the "cwd" option.`);const s=_(T(`${o}/package.json`)),{packageManager:n}=P(o);e.debug&&console.debug("Package manager found:",n);const l=a(s,["markdownlint-cli"]),p=a(s,["markdownlint-cli2"]),f=a(s,["prettier"]);let i={};if(e.eslint!==!1&&a(s,["eslint"])){if(!Array.isArray(e.eslint.extensions)||e.eslint.extensions.length===0)throw new Error("The `extensions` option is required for the ESLint configuration.");!l&&!p&&e.eslint.extensions.push("md"),i[`**/*.{${e.eslint.extensions.join(",")}}`]=async r=>[...f?[`${n} exec prettier --write ${c(r)}`]:[],...await z(n,s,e.eslint,r)]}if(e.json!==!1&&a(s,["sort-package-json"])&&(i["**/package.json"]=r=>[`${n} exec sort-package-json ${c(r)}`]),e.markdown!==!1&&l&&(i={...i,"**/*.md":h(r=>[...f?[`${n} exec prettier --write ${c(r)}`]:[],...l?[`${n} exec markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${c(r)}`]:[],...p?[`${n} exec markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${c(r)}`]:[]],"**/*.md"),"**/*.mdx":h(r=>[...f?[`${n} exec prettier --write ${c(r)}`]:[]],"**/*.mdx")}),e.secretlint!==!1&&a(s,["secretlint"])&&(i["**/*"]=r=>[`${n} exec secretlint ${c(r)}`]),e.stylesheets!==!1&&a(s,["stylelint"])){if(!Array.isArray(e.stylesheets.extensions)||e.stylesheets.extensions.length===0)throw new Error("The `extensions` option is required for the Stylesheets configuration.");i[`**/*.{${e.stylesheets.extensions.join(",")}}`]=r=>[...f?[`${n} exec prettier --ignore-unknown --write ${c(r)}`]:[],`${n} exec stylelint --fix`]}if(e.typescript!==!1&&a(s,["typescript"])){if(!Array.isArray(e.typescript.extensions)||e.typescript.extensions.length===0)throw new Error("The `extensions` option is required for the TypeScript configuration.");i[`**/*.{${e.typescript.extensions.join(",")}}`]=r=>{const m=new Set;return r.forEach(g=>{if(typeof e.typescript?.exclude=="object"&&Array.isArray(e.typescript.exclude)){let u=!1;if(e.typescript.exclude.forEach(b=>{!u&&g.includes(b)&&(u=!0)}),u){e.debug&&console.info(`Skipping ${g} as it's excluded in the settings.`);return}}try{const u=w("tsconfig.json",g);m.add(`${n} exec tsc --noEmit --project ${u}`)}catch(u){e.debug&&console.error(u)}}),[...m]}}return a(s,["vitest"])&&(i["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=["vitest related --run"],i["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${n} exec vitest related --run`]),a(s,["jest"])&&(i["**/*.spec.{js,ts,tsx}"]=[`${n} exec jest --findRelatedTests`],i["**/*.test.{js,ts,tsx}"]=[`${n} exec jest --findRelatedTests`],i["**/?(*.){test,spec}.?(c|m)[jt]s?(x)"]=[`${n} exec jest --findRelatedTests`],i["**/__mocks__/*.{js,ts,tsx}"]=[`${n} exec jest --findRelatedTests`],i["**/__tests__/**/*.?(c|m)[jt]s?(x)"]=[`${n} exec jest --findRelatedTests`],i["**/__tests__/*.{js,ts,tsx}"]=[`${n} exec jest --findRelatedTests`],i["**/test/*.{js,ts,tsx}"]=[`${n} exec jest --findRelatedTests`]),a(s,["ava"])&&(i["**/(test|tests|__tests__)/**/*.js"]=r=>[`${n} exec ava ${c(r)}`],i["**/*.(spec|test).js"]=r=>[`${n} exec ava ${c(r)}`],i["**/test.js"]=r=>[`${n} exec ava ${c(r)}`],i["**/test-*.js"]=r=>[`${n} exec ava ${c(r)}`]),i},"defineConfig");export{le as defineConfig,X as eslintExtensions,ee as stylesheetsExtensions,Z as typescriptExtensions};
|
package/package.json
CHANGED
|
@@ -1,165 +1,125 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"name": "@anolilab/lint-staged-config",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Shareable Lint-Staged Config for any project.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"anolilab",
|
|
7
|
+
"lint",
|
|
8
|
+
"lint-staged",
|
|
9
|
+
"nano-staged",
|
|
10
|
+
"config",
|
|
11
|
+
"lint-staged-config",
|
|
12
|
+
"nano-staged-config",
|
|
13
|
+
"vitest",
|
|
14
|
+
"ava",
|
|
15
|
+
"jest",
|
|
16
|
+
"eslint",
|
|
17
|
+
"prettier",
|
|
18
|
+
"stylelint",
|
|
19
|
+
"secretlint"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://anolilab.com/nodejs/packages/lint-staged-config",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/anolilab/javascript-style-guide.git",
|
|
25
|
+
"directory": "packages/lint-staged-config"
|
|
26
|
+
},
|
|
27
|
+
"funding": [
|
|
28
|
+
{
|
|
29
|
+
"type": "github",
|
|
30
|
+
"url": "https://github.com/sponsors/prisis"
|
|
17
31
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
{
|
|
33
|
+
"type": "consulting",
|
|
34
|
+
"url": "https://anolilab.com/support"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Daniel Bannert",
|
|
40
|
+
"email": "d.bannert@anolilab.de"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"type": "module",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/index.d.cts",
|
|
48
|
+
"default": "./dist/index.cjs"
|
|
49
|
+
},
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/index.d.mts",
|
|
52
|
+
"default": "./dist/index.mjs"
|
|
53
|
+
}
|
|
32
54
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"import": "./dist/groups/typescript.mjs"
|
|
74
|
-
},
|
|
75
|
-
"./package.json": "./package.json"
|
|
55
|
+
"./package.json": "./package.json"
|
|
56
|
+
},
|
|
57
|
+
"main": "dist/index.cjs",
|
|
58
|
+
"module": "dist/index.mjs",
|
|
59
|
+
"types": "dist/index.d.ts",
|
|
60
|
+
"typesVersions": {
|
|
61
|
+
">=5.0": {
|
|
62
|
+
".": [
|
|
63
|
+
"./dist/index.d.ts"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"bin": {
|
|
68
|
+
"lint-stage-config:install": "./dist/bin.mjs"
|
|
69
|
+
},
|
|
70
|
+
"files": [
|
|
71
|
+
"dist",
|
|
72
|
+
"README.md",
|
|
73
|
+
"CHANGELOG.md",
|
|
74
|
+
"LICENSE.md"
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@visulima/fs": "3.1.2",
|
|
78
|
+
"@visulima/package": "^3.5.4",
|
|
79
|
+
"shell-quote": "^1.8.2"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"eslint": "^8.49.0",
|
|
83
|
+
"husky": "^8.x || ^9.x",
|
|
84
|
+
"jest": "^27.x || ^28.x",
|
|
85
|
+
"lint-staged": "^13.x || ^14.x|| ^15.x || ^16.x",
|
|
86
|
+
"nano-staged": "^0.8",
|
|
87
|
+
"prettier": "^3.x",
|
|
88
|
+
"secretlint": "^7.x || ^8.x",
|
|
89
|
+
"stylelint": "^15.x || ^16.x",
|
|
90
|
+
"vitest": "^1.x || ^2.x || ^3.x"
|
|
91
|
+
},
|
|
92
|
+
"peerDependenciesMeta": {
|
|
93
|
+
"eslint": {
|
|
94
|
+
"optional": true
|
|
76
95
|
},
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"types": "dist/index.d.ts",
|
|
80
|
-
"files": [
|
|
81
|
-
"dist",
|
|
82
|
-
"skip.js",
|
|
83
|
-
"group",
|
|
84
|
-
"README.md",
|
|
85
|
-
"CHANGELOG.md",
|
|
86
|
-
"LICENSE.md"
|
|
87
|
-
],
|
|
88
|
-
"scripts": {
|
|
89
|
-
"build": "cross-env NODE_ENV=development tsup",
|
|
90
|
-
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
91
|
-
"clean": "rimraf node_modules dist",
|
|
92
|
-
"postinstall": "node ./skip.js || node ./dist/postinstall.js",
|
|
93
|
-
"test": "vitest --config ./vitest.config.ts",
|
|
94
|
-
"test:coverage": "vitest --config ./vitest.config.ts --run --coverage"
|
|
96
|
+
"jest": {
|
|
97
|
+
"optional": true
|
|
95
98
|
},
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
"find-up": "5.0.0",
|
|
99
|
-
"shell-quote": "^1.8.1"
|
|
99
|
+
"lint-staged": {
|
|
100
|
+
"optional": true
|
|
100
101
|
},
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
"@total-typescript/ts-reset": "^0.5.1",
|
|
104
|
-
"@types/lint-staged": "^13.3.0",
|
|
105
|
-
"@types/shell-quote": "^1.7.5",
|
|
106
|
-
"@vitest/coverage-v8": "^1.1.0",
|
|
107
|
-
"cross-env": "^7.0.3",
|
|
108
|
-
"husky": "^8.0.3",
|
|
109
|
-
"lint-staged": "^15.2.0",
|
|
110
|
-
"rimraf": "^5.0.5",
|
|
111
|
-
"semantic-release": "^22.0.12",
|
|
112
|
-
"tsup": "^8.0.1",
|
|
113
|
-
"type-fest": "^4.8.3",
|
|
114
|
-
"typescript": "5.3.3",
|
|
115
|
-
"vitest": "^1.1.0"
|
|
102
|
+
"nano-staged": {
|
|
103
|
+
"optional": true
|
|
116
104
|
},
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
"husky": "^8.x",
|
|
120
|
-
"jest": "^29.7.0",
|
|
121
|
-
"lint-staged": "^13.x || ^14.0.0 || ^15.0.0",
|
|
122
|
-
"prettier": "^3.0.3",
|
|
123
|
-
"secretlint": "^7.0.7",
|
|
124
|
-
"stylelint": "^15.11.0",
|
|
125
|
-
"vite": "^4.4.9"
|
|
105
|
+
"prettier": {
|
|
106
|
+
"optional": true
|
|
126
107
|
},
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
"optional": true
|
|
130
|
-
},
|
|
131
|
-
"jest": {
|
|
132
|
-
"optional": true
|
|
133
|
-
},
|
|
134
|
-
"prettier": {
|
|
135
|
-
"optional": true
|
|
136
|
-
},
|
|
137
|
-
"secretlint": {
|
|
138
|
-
"optional": true
|
|
139
|
-
},
|
|
140
|
-
"stylelint": {
|
|
141
|
-
"optional": true
|
|
142
|
-
},
|
|
143
|
-
"vite": {
|
|
144
|
-
"optional": true
|
|
145
|
-
}
|
|
108
|
+
"secretlint": {
|
|
109
|
+
"optional": true
|
|
146
110
|
},
|
|
147
|
-
"
|
|
148
|
-
|
|
111
|
+
"stylelint": {
|
|
112
|
+
"optional": true
|
|
149
113
|
},
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"src/groups/tests.ts",
|
|
163
|
-
"src/groups/typescript.ts"
|
|
164
|
-
]
|
|
165
|
-
}
|
|
114
|
+
"vitest": {
|
|
115
|
+
"optional": true
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"engines": {
|
|
119
|
+
"node": ">=20.18.* <=24.*"
|
|
120
|
+
},
|
|
121
|
+
"publishConfig": {
|
|
122
|
+
"access": "public",
|
|
123
|
+
"provenance": true
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/chunk-24WLFZUE.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { quote } from 'shell-quote';
|
|
2
|
-
import { platform, env } from 'process';
|
|
3
|
-
|
|
4
|
-
var n=platform==="win32"||/^(msys|cygwin)$/u.test(env.OSTYPE??""),t=n;var m=i=>i.map(o=>`"${t?o:quote([o])}"`).join(" ").replaceAll("/@","/@"),f=m;
|
|
5
|
-
|
|
6
|
-
export { t as a, f as b };
|
|
7
|
-
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-24WLFZUE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","platform","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,EAAK,YAAAC,MAAgB,UAG9B,IAAMC,EAAYD,IAAa,SAAW,mBAAmB,KAAKD,EAAI,QAAa,EAAE,EAE9EG,EAAQD,EDaf,IAAME,EAAeC,GACjBA,EACK,IAAKC,GAAa,IAAIH,EAAYG,EAAWP,EAAM,CAACO,CAAQ,CAAC,CAAC,GAAG,EACjE,KAAK,GAAG,EACR,WAAW,KAAM,IAAI,EAEvBC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * The @ type shouldn't be quoted, but it is.\n * If a folder name contains a @, it will be escaped as \\@ (example test/@types), which is wrong.\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string =>\n filenames\n .map((filename) => `\"${isWindows ? filename : quote([filename])}\"`)\n .join(\" \")\n .replaceAll(\"/@\", \"/@\");\n\nexport default concatFiles;\n","import { env, platform } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = platform === \"win32\" || /^(msys|cygwin)$/u.test(env[\"OSTYPE\"] ?? \"\");\n\nexport default isWindows;\n"]}
|
package/dist/chunk-ALAT5PPB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/chunk-AVDVT4B7.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { pkg } from '@anolilab/package-json-utils';
|
|
2
|
-
|
|
3
|
-
!global.anolilabLintStagedPackageJsonConfig&&pkg&&(global.anolilabLintStagedPackageJsonConfig=pkg.anolilab?.["lint-staged-config"]);var o=global.anolilabLintStagedPackageJsonConfig??{},g=o;
|
|
4
|
-
|
|
5
|
-
export { g as a };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-AVDVT4B7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/lint-staged-config.ts"],"names":["pkg","config","lint_staged_config_default"],"mappings":"AAAA,OAAS,OAAAA,MAAW,+BAEhB,CAAC,OAAO,qCAAuCA,IAE/C,OAAO,oCAAsCA,EAAI,WAAc,oBAAoB,GAGvF,IAAMC,EAA8C,OAAO,qCAAuC,CAAC,EAE5FC,EAAQD","sourcesContent":["import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: Record<string, boolean | undefined> = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n"]}
|
package/dist/chunk-COM4XKFJ.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { hasFile } from '@anolilab/package-json-utils';
|
|
2
|
-
|
|
3
|
-
var n=()=>{if(global.anolilabLintStagedPackageManager)return global.anolilabLintStagedPackageManager;if(hasFile("pnpm-lock.yaml"))return global.anolilabLintStagedPackageManager="pnpm","pnpm";if(hasFile("yarn.lock"))return global.anolilabLintStagedPackageManager="yarn","yarn";if(hasFile("package-lock.json"))return global.anolilabLintStagedPackageManager="npm","npm";throw new Error("No package manager found")},g=n;
|
|
4
|
-
|
|
5
|
-
export { g as a };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-COM4XKFJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-package-manager.ts"],"names":["hasFile","getPackageManager","get_package_manager_default"],"mappings":"AAAA,OAAS,WAAAA,MAAe,+BAExB,IAAMC,EAAoB,IAA+B,CACrD,GAAI,OAAO,iCACP,OAAO,OAAO,iCAGlB,GAAID,EAAQ,gBAAgB,EACxB,cAAO,iCAAmC,OAEnC,OAGX,GAAIA,EAAQ,WAAW,EACnB,cAAO,iCAAmC,OAEnC,OAGX,GAAIA,EAAQ,mBAAmB,EAC3B,cAAO,iCAAmC,MAEnC,MAGX,MAAM,IAAI,MAAM,0BAA0B,CAC9C,EAEOE,EAAQD","sourcesContent":["import { hasFile } from \"@anolilab/package-json-utils\";\n\nconst getPackageManager = (): \"npm\" | \"pnpm\" | \"yarn\" => {\n if (global.anolilabLintStagedPackageManager) {\n return global.anolilabLintStagedPackageManager;\n }\n\n if (hasFile(\"pnpm-lock.yaml\")) {\n global.anolilabLintStagedPackageManager = \"pnpm\";\n\n return \"pnpm\";\n }\n\n if (hasFile(\"yarn.lock\")) {\n global.anolilabLintStagedPackageManager = \"yarn\";\n\n return \"yarn\";\n }\n\n if (hasFile(\"package-lock.json\")) {\n global.anolilabLintStagedPackageManager = \"npm\";\n\n return \"npm\";\n }\n\n throw new Error(\"No package manager found\");\n};\n\nexport default getPackageManager;\n"]}
|
package/dist/chunk-HGDREIGE.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import i from 'find-up';
|
|
4
|
-
|
|
5
|
-
var h=e=>{let t=i.sync("package.json",{cwd:e});return t&&dirname(t)},c=e=>{let t=h(e??process.cwd());if(t?.startsWith("/"))return t;throw new Error(`Cannot determine the nearest root of the package for the file: ${e}!`)},f=e=>{let t=join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},p=(e,t)=>{let n=c(t),o=f([n,e]);if(existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},m=p;
|
|
6
|
-
|
|
7
|
-
export { m as a };
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-HGDREIGE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["existsSync","dirname","join","findUp","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAE9B,OAAOC,MAAY,UAKnB,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWH,EAAO,KAAK,eAAgB,CAAE,IAAAE,CAAI,CAAC,EAEpD,OAAOC,GAAYL,EAAQK,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAAST,EAAK,GAAGQ,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIb,EAAWe,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport findUp from \"find-up\";\nimport type { Join } from \"type-fest\";\n\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
package/dist/chunk-LJGFRIQ4.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/chunk-OYUEMN5Q.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
4
|
-
|
|
5
|
-
!global.anolilabLintStagedPackageJsonConfig&&packageJsonUtils.pkg&&(global.anolilabLintStagedPackageJsonConfig=packageJsonUtils.pkg.anolilab?.["lint-staged-config"]);var o=global.anolilabLintStagedPackageJsonConfig??{},g=o;
|
|
6
|
-
|
|
7
|
-
exports.a = g;
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-OYUEMN5Q.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/lint-staged-config.ts"],"names":["pkg","config","lint_staged_config_default"],"mappings":"AAAA,OAAS,OAAAA,MAAW,+BAEhB,CAAC,OAAO,qCAAuCA,IAE/C,OAAO,oCAAsCA,EAAI,WAAc,oBAAoB,GAGvF,IAAMC,EAA8C,OAAO,qCAAuC,CAAC,EAE5FC,EAAQD","sourcesContent":["import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: Record<string, boolean | undefined> = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n"]}
|
package/dist/chunk-P4FK54EG.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
4
|
-
|
|
5
|
-
var n=()=>{if(global.anolilabLintStagedPackageManager)return global.anolilabLintStagedPackageManager;if(packageJsonUtils.hasFile("pnpm-lock.yaml"))return global.anolilabLintStagedPackageManager="pnpm","pnpm";if(packageJsonUtils.hasFile("yarn.lock"))return global.anolilabLintStagedPackageManager="yarn","yarn";if(packageJsonUtils.hasFile("package-lock.json"))return global.anolilabLintStagedPackageManager="npm","npm";throw new Error("No package manager found")},g=n;
|
|
6
|
-
|
|
7
|
-
exports.a = g;
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-P4FK54EG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-package-manager.ts"],"names":["hasFile","getPackageManager","get_package_manager_default"],"mappings":"AAAA,OAAS,WAAAA,MAAe,+BAExB,IAAMC,EAAoB,IAA+B,CACrD,GAAI,OAAO,iCACP,OAAO,OAAO,iCAGlB,GAAID,EAAQ,gBAAgB,EACxB,cAAO,iCAAmC,OAEnC,OAGX,GAAIA,EAAQ,WAAW,EACnB,cAAO,iCAAmC,OAEnC,OAGX,GAAIA,EAAQ,mBAAmB,EAC3B,cAAO,iCAAmC,MAEnC,MAGX,MAAM,IAAI,MAAM,0BAA0B,CAC9C,EAEOE,EAAQD","sourcesContent":["import { hasFile } from \"@anolilab/package-json-utils\";\n\nconst getPackageManager = (): \"npm\" | \"pnpm\" | \"yarn\" => {\n if (global.anolilabLintStagedPackageManager) {\n return global.anolilabLintStagedPackageManager;\n }\n\n if (hasFile(\"pnpm-lock.yaml\")) {\n global.anolilabLintStagedPackageManager = \"pnpm\";\n\n return \"pnpm\";\n }\n\n if (hasFile(\"yarn.lock\")) {\n global.anolilabLintStagedPackageManager = \"yarn\";\n\n return \"yarn\";\n }\n\n if (hasFile(\"package-lock.json\")) {\n global.anolilabLintStagedPackageManager = \"npm\";\n\n return \"npm\";\n }\n\n throw new Error(\"No package manager found\");\n};\n\nexport default getPackageManager;\n"]}
|
package/dist/chunk-PLWO6XD7.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var shellQuote = require('shell-quote');
|
|
4
|
-
var process = require('process');
|
|
5
|
-
|
|
6
|
-
var n=process.platform==="win32"||/^(msys|cygwin)$/u.test(process.env.OSTYPE??""),t=n;var m=i=>i.map(o=>`"${t?o:shellQuote.quote([o])}"`).join(" ").replaceAll("/@","/@"),f=m;
|
|
7
|
-
|
|
8
|
-
exports.a = t;
|
|
9
|
-
exports.b = f;
|
|
10
|
-
//# sourceMappingURL=out.js.map
|
|
11
|
-
//# sourceMappingURL=chunk-PLWO6XD7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","platform","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,EAAK,YAAAC,MAAgB,UAG9B,IAAMC,EAAYD,IAAa,SAAW,mBAAmB,KAAKD,EAAI,QAAa,EAAE,EAE9EG,EAAQD,EDaf,IAAME,EAAeC,GACjBA,EACK,IAAKC,GAAa,IAAIH,EAAYG,EAAWP,EAAM,CAACO,CAAQ,CAAC,CAAC,GAAG,EACjE,KAAK,GAAG,EACR,WAAW,KAAM,IAAI,EAEvBC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * The @ type shouldn't be quoted, but it is.\n * If a folder name contains a @, it will be escaped as \\@ (example test/@types), which is wrong.\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string =>\n filenames\n .map((filename) => `\"${isWindows ? filename : quote([filename])}\"`)\n .join(\" \")\n .replaceAll(\"/@\", \"/@\");\n\nexport default concatFiles;\n","import { env, platform } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = platform === \"win32\" || /^(msys|cygwin)$/u.test(env[\"OSTYPE\"] ?? \"\");\n\nexport default isWindows;\n"]}
|
package/dist/chunk-VU6SMFTD.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var i = require('find-up');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var i__default = /*#__PURE__*/_interopDefault(i);
|
|
10
|
-
|
|
11
|
-
var h=e=>{let t=i__default.default.sync("package.json",{cwd:e});return t&&path.dirname(t)},c=e=>{let t=h(e??process.cwd());if(t?.startsWith("/"))return t;throw new Error(`Cannot determine the nearest root of the package for the file: ${e}!`)},f=e=>{let t=path.join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},p=(e,t)=>{let n=c(t),o=f([n,e]);if(fs.existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},m=p;
|
|
12
|
-
|
|
13
|
-
exports.a = m;
|
|
14
|
-
//# sourceMappingURL=out.js.map
|
|
15
|
-
//# sourceMappingURL=chunk-VU6SMFTD.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["existsSync","dirname","join","findUp","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAE9B,OAAOC,MAAY,UAKnB,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWH,EAAO,KAAK,eAAgB,CAAE,IAAAE,CAAI,CAAC,EAEpD,OAAOC,GAAYL,EAAQK,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAAST,EAAK,GAAGQ,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIb,EAAWe,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport findUp from \"find-up\";\nimport type { Join } from \"type-fest\";\n\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkOYUEMN5Q_js = require('../../chunk-OYUEMN5Q.js');
|
|
4
|
-
var chunkVU6SMFTD_js = require('../../chunk-VU6SMFTD.js');
|
|
5
|
-
var chunkALAT5PPB_js = require('../../chunk-ALAT5PPB.js');
|
|
6
|
-
var chunkPLWO6XD7_js = require('../../chunk-PLWO6XD7.js');
|
|
7
|
-
var chunkP4FK54EG_js = require('../../chunk-P4FK54EG.js');
|
|
8
|
-
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
9
|
-
var path = require('path');
|
|
10
|
-
var eslint = require('eslint');
|
|
11
|
-
var shellQuote = require('shell-quote');
|
|
12
|
-
|
|
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(`
|
|
14
|
-
Unable to determine if file is ignored.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
${e.reason}`),new Error("Stopping lint-staged because of an error.")});return n.filter((e,r)=>!i[r]).map(e=>`"${chunkPLWO6XD7_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 ${chunkPLWO6XD7_js.b(n)}`]:[],...await m(n)]},Y=M;
|
|
18
|
-
|
|
19
|
-
module.exports = Y;
|
|
20
|
-
//# sourceMappingURL=out.js.map
|
|
21
|
-
//# sourceMappingURL=index.js.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","logger_default","group","concat_files_default","eslint_default"],"mappings":"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","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport 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,19 +0,0 @@
|
|
|
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-24WLFZUE.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 default };
|
|
18
|
-
//# sourceMappingURL=out.js.map
|
|
19
|
-
//# sourceMappingURL=index.mjs.map
|