@anolilab/lint-staged-config 1.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 +27 -0
- package/LICENSE.md +21 -0
- package/README.md +169 -0
- package/dist/chunk-4PCPJEEI.js +9 -0
- package/dist/chunk-4PCPJEEI.js.map +1 -0
- package/dist/chunk-4RVIFLAT.mjs +5 -0
- package/dist/chunk-4RVIFLAT.mjs.map +1 -0
- package/dist/chunk-6EWZW5LF.js +7 -0
- package/dist/chunk-6EWZW5LF.js.map +1 -0
- package/dist/chunk-AMNQJNNY.mjs +9 -0
- package/dist/chunk-AMNQJNNY.mjs.map +1 -0
- package/dist/chunk-BGOY7MBY.mjs +8 -0
- package/dist/chunk-BGOY7MBY.mjs.map +1 -0
- package/dist/chunk-CRK67F7X.mjs +8 -0
- package/dist/chunk-CRK67F7X.mjs.map +1 -0
- package/dist/chunk-G7Q3HUT7.js +15 -0
- package/dist/chunk-G7Q3HUT7.js.map +1 -0
- package/dist/chunk-JTIOAOUE.js +10 -0
- package/dist/chunk-JTIOAOUE.js.map +1 -0
- package/dist/chunk-L5GFXHVL.js +15 -0
- package/dist/chunk-L5GFXHVL.js.map +1 -0
- package/dist/chunk-LSR35CMP.js +10 -0
- package/dist/chunk-LSR35CMP.js.map +1 -0
- package/dist/chunk-OTRYI4YE.mjs +8 -0
- package/dist/chunk-OTRYI4YE.mjs.map +1 -0
- package/dist/chunk-PT4S7CCV.mjs +12 -0
- package/dist/chunk-PT4S7CCV.mjs.map +1 -0
- package/dist/chunk-T755FU2I.js +11 -0
- package/dist/chunk-T755FU2I.js.map +1 -0
- package/dist/chunk-UF7UO5PL.js +10 -0
- package/dist/chunk-UF7UO5PL.js.map +1 -0
- package/dist/chunk-UHH5GDWT.mjs +8 -0
- package/dist/chunk-UHH5GDWT.mjs.map +1 -0
- package/dist/chunk-UKLFK6IR.mjs +7 -0
- package/dist/chunk-UKLFK6IR.mjs.map +1 -0
- package/dist/chunk-VW6R74AT.mjs +8 -0
- package/dist/chunk-VW6R74AT.mjs.map +1 -0
- package/dist/chunk-ZRW63OZY.js +10 -0
- package/dist/chunk-ZRW63OZY.js.map +1 -0
- package/dist/groups/eslint/index.d.mts +5 -0
- package/dist/groups/eslint/index.d.ts +5 -0
- package/dist/groups/eslint/index.js +11 -0
- package/dist/groups/eslint/index.js.map +1 -0
- package/dist/groups/eslint/index.mjs +5 -0
- package/dist/groups/eslint/index.mjs.map +1 -0
- package/dist/groups/json.d.mts +5 -0
- package/dist/groups/json.d.ts +5 -0
- package/dist/groups/json.js +10 -0
- package/dist/groups/json.js.map +1 -0
- package/dist/groups/json.mjs +4 -0
- package/dist/groups/json.mjs.map +1 -0
- package/dist/groups/markdown.d.mts +5 -0
- package/dist/groups/markdown.d.ts +5 -0
- package/dist/groups/markdown.js +10 -0
- package/dist/groups/markdown.js.map +1 -0
- package/dist/groups/markdown.mjs +4 -0
- package/dist/groups/markdown.mjs.map +1 -0
- package/dist/groups/secretlint.d.mts +5 -0
- package/dist/groups/secretlint.d.ts +5 -0
- package/dist/groups/secretlint.js +9 -0
- package/dist/groups/secretlint.js.map +1 -0
- package/dist/groups/secretlint.mjs +3 -0
- package/dist/groups/secretlint.mjs.map +1 -0
- package/dist/groups/stylesheets.d.mts +5 -0
- package/dist/groups/stylesheets.d.ts +5 -0
- package/dist/groups/stylesheets.js +10 -0
- package/dist/groups/stylesheets.js.map +1 -0
- package/dist/groups/stylesheets.mjs +4 -0
- package/dist/groups/stylesheets.mjs.map +1 -0
- package/dist/groups/tests.d.mts +5 -0
- package/dist/groups/tests.d.ts +5 -0
- package/dist/groups/tests.js +10 -0
- package/dist/groups/tests.js.map +1 -0
- package/dist/groups/tests.mjs +4 -0
- package/dist/groups/tests.mjs.map +1 -0
- package/dist/groups/typescript.d.mts +5 -0
- package/dist/groups/typescript.d.ts +5 -0
- package/dist/groups/typescript.js +10 -0
- package/dist/groups/typescript.js.map +1 -0
- package/dist/groups/typescript.mjs +4 -0
- package/dist/groups/typescript.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postinstall.d.mts +2 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.js +96 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/postinstall.mjs +94 -0
- package/dist/postinstall.mjs.map +1 -0
- package/group/package.json +44 -0
- package/package.json +145 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## @anolilab/lint-staged-config 1.0.0 (2023-06-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* new package ([345ffc2](https://github.com/anolilab/javascript-style-guide/commit/345ffc28fb3621948179005cc1048ab336abfa44))
|
|
7
|
+
* added the missing code ([b002144](https://github.com/anolilab/javascript-style-guide/commit/b002144febf17ea691c819cd376732d42c20a912))
|
|
8
|
+
* adding readme ([2132069](https://github.com/anolilab/javascript-style-guide/commit/21320699c6858db429adba3fd72ea05d76b24ae3))
|
|
9
|
+
* create groups ([ce14364](https://github.com/anolilab/javascript-style-guide/commit/ce14364b86db8e65d4368b626afb326dc4d11928))
|
|
10
|
+
* Improve linting configs and update husky setup ([5a9b73d](https://github.com/anolilab/javascript-style-guide/commit/5a9b73d6999de9f2fe49ce24106e1ed6a364213d))
|
|
11
|
+
* Updated prepare-commit-msg script for Commitizen support ([c7a56f8](https://github.com/anolilab/javascript-style-guide/commit/c7a56f8860d8d5685749898f5994412d447c5356))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* added missing jest and ava check for tests ([9399760](https://github.com/anolilab/javascript-style-guide/commit/9399760cbda39979692f670245c1c2bbd2a0dddf))
|
|
17
|
+
* fixed exports ([5783e95](https://github.com/anolilab/javascript-style-guide/commit/5783e9524d392e90d7e1f0f37d48b5575aac3af8))
|
|
18
|
+
* fixed postinstall script ([87ad9df](https://github.com/anolilab/javascript-style-guide/commit/87ad9df6173103ff7914ce3d27562f393b13267b))
|
|
19
|
+
* refactored eslint config ([c503593](https://github.com/anolilab/javascript-style-guide/commit/c503593e27c1bea125673c53bb31765abe2151ac))
|
|
20
|
+
* Remove pre-push hook from postinstall script ([d6ed1a9](https://github.com/anolilab/javascript-style-guide/commit/d6ed1a948acaef84a9a7ac5935df0882bbaada91))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Miscellaneous Chores
|
|
24
|
+
|
|
25
|
+
* lock update ([e6e045c](https://github.com/anolilab/javascript-style-guide/commit/e6e045c5e94e535a975a6f8bd3fa8fefb82e994d))
|
|
26
|
+
* update readme ([6f7aae7](https://github.com/anolilab/javascript-style-guide/commit/6f7aae7e281b616f523c091927f0972782ca36d9))
|
|
27
|
+
* updated license date ([f4acb44](https://github.com/anolilab/javascript-style-guide/commit/f4acb44f016851fbcce1e776e7a0765c7657e659))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Anolilab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1>Shareable Lint-Staged Config</h1>
|
|
4
|
+
|
|
5
|
+
Package that contains shareable configuration for [lint-staged](https://github.com/okonet/lint-staged) — a popular tool for running linters on staged Git files.
|
|
6
|
+
|
|
7
|
+
And optionally for [husky](https://github.com/typicode/husky) — a popular choice for configuring git hooks.
|
|
8
|
+
|
|
9
|
+
[![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<div align="center">
|
|
16
|
+
<p>
|
|
17
|
+
<sup>
|
|
18
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
19
|
+
</sup>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Simplify your project setup with our comprehensive collection of preconfigured configuration files.
|
|
26
|
+
Designed for effortless integration, these ready-to-use files can be seamlessly imported into your projects.
|
|
27
|
+
These functions streamline the utilization of [lint-staged](https://github.com/okonet/lint-staged) alongside popular tools such as [ESLint](https://eslint.org), [Prettier](https://prettier.io), [StyleLint](https://stylelint.io) and [SecretLint](https://github.com/secretlint/secretlint).
|
|
28
|
+
|
|
29
|
+
Say goodbye to complex configurations and enjoy a smoother development experience with our all-inclusive package.
|
|
30
|
+
|
|
31
|
+
## Purpose
|
|
32
|
+
|
|
33
|
+
- Enhance your development workflow with hassle-free and readily shareable lint-staged configuration files.
|
|
34
|
+
- These files empower developers to maintain a uniform coding style and detect prevalent errors even before they are added to the source control system.
|
|
35
|
+
- Additionally, our inclusive helper module offers convenient utility functions that seamlessly integrate lint-staged with popular linting and formatting tools.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --dev-save @anolilab/lint-staged-config lint-staged
|
|
41
|
+
|
|
42
|
+
Optional:
|
|
43
|
+
|
|
44
|
+
npm install --dev-save husky is-ci
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
yarn add -D @anolilab/lint-staged-config lint-staged
|
|
49
|
+
|
|
50
|
+
Optional:
|
|
51
|
+
|
|
52
|
+
yarn add -D husky is-ci
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm add -D @anolilab/lint-staged-config lint-staged
|
|
57
|
+
|
|
58
|
+
Optional:
|
|
59
|
+
|
|
60
|
+
pnpm add -D husky is-ci
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
If you don’t have a `.lintstagedrc.js`, we will create the file for you after installing `@anolilab/lint-staged-config`.
|
|
66
|
+
|
|
67
|
+
If you already have a `.lintstagedrc.js`, then you can extend the `.lintstagedrc.js`, with `@anolilab/lint-staged-config`.
|
|
68
|
+
|
|
69
|
+
> Note: If the script detects an existing `.lintstagedrc.js` file, it will not overwrite it.
|
|
70
|
+
|
|
71
|
+
> Note: It can happen that the postinstall script don't run, then you have to add the `.lintstagedrc.js` manually.
|
|
72
|
+
|
|
73
|
+
The content of the `.lintstagedrc.js` should look like this:
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
const config = require("@anolilab/lint-staged-config");
|
|
77
|
+
|
|
78
|
+
module.exports = {
|
|
79
|
+
...config,
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
The default configuration, automatically adds the following linting and formatting tools, if the needed dependencies are installed.
|
|
86
|
+
|
|
87
|
+
- [ESLint](https://eslint.org)
|
|
88
|
+
- [Prettier](https://prettier.io)
|
|
89
|
+
- [StyleLint](https://stylelint.io)
|
|
90
|
+
- [SecretLint]()
|
|
91
|
+
- [CommitLint](https://commitlint.js.org)
|
|
92
|
+
- [Vitest](https://vitest.dev) or [Jest](https://jestjs.io) or [AVA](https://github.com/avajs/ava)
|
|
93
|
+
- [TypeScript](https://www.typescriptlang.org)
|
|
94
|
+
|
|
95
|
+
All this tools configuration are exported at `@anolilab/lint-staged-config/group/...` and
|
|
96
|
+
can be used to extend your configuration, without including the auto config.
|
|
97
|
+
|
|
98
|
+
## Husky
|
|
99
|
+
|
|
100
|
+
If you want to use [husky](https://github.com/typicode/husky) to run the lint-staged script, you can use the following configuration.
|
|
101
|
+
|
|
102
|
+
Adding the following script to your root `package.json` file makes it easier to run the husky command:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm pkg set scripts.prepare="is-ci || husky install || exit 0"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
For `npm` users, replace `pnpm` with `npm` in the above command.
|
|
109
|
+
|
|
110
|
+
This script will install husky only if it is not running in a CI environment.
|
|
111
|
+
|
|
112
|
+
After that you can find a `.husky` folder in your root directory, with a `pre-commit` (if not please create it) file.
|
|
113
|
+
|
|
114
|
+
The file content can look like this:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
#!/bin/sh
|
|
118
|
+
|
|
119
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
120
|
+
|
|
121
|
+
# The hook should exit with non-zero status after issuing
|
|
122
|
+
# an appropriate message if it wants to stop the commit.
|
|
123
|
+
|
|
124
|
+
echo --------------------------------------------
|
|
125
|
+
echo Starting Git hook: pre-commit
|
|
126
|
+
|
|
127
|
+
pnpx lint-staged --verbose --concurrent false
|
|
128
|
+
|
|
129
|
+
echo Finished Git hook: pre-commit
|
|
130
|
+
echo --------------------------------------------
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Our package includes a `postinstall` script to automatically add the `pre-commit`, `common.sh`, `prepare-commit-msg hooks to your `.husky` folder.
|
|
135
|
+
|
|
136
|
+
> Note: It can be that the postinstall script don't run, then you have to add the hooks manually.
|
|
137
|
+
|
|
138
|
+
If `commitzen` is installed, the `prepare-commit-msg` hook with predefined content will be added to your `.husky` folder.
|
|
139
|
+
|
|
140
|
+
## Supported Node.js Versions
|
|
141
|
+
|
|
142
|
+
Libraries in this ecosystem make the best effort to track
|
|
143
|
+
[Node.js’ release schedule](https://nodejs.org/en/about/releases/). Here’s [a
|
|
144
|
+
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
145
|
+
|
|
146
|
+
Contributing
|
|
147
|
+
------------
|
|
148
|
+
|
|
149
|
+
If you would like to help take a look at the [list of issues](https://github.com/anolilab/javascript-style-guide/issues) and check our [Contributing](.github/CONTRIBUTING.md) guild.
|
|
150
|
+
|
|
151
|
+
> **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
|
|
152
|
+
|
|
153
|
+
Credits
|
|
154
|
+
-------------
|
|
155
|
+
|
|
156
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
157
|
+
- [All Contributors](https://github.com/anolilab/javascript-style-guide/graphs/contributors)
|
|
158
|
+
|
|
159
|
+
License
|
|
160
|
+
-------------
|
|
161
|
+
|
|
162
|
+
The anolilab javascript-style-guide is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT)
|
|
163
|
+
|
|
164
|
+
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
165
|
+
[typescript-url]: "typescript"
|
|
166
|
+
[license-image]: https://img.shields.io/npm/l/@anolilab/lint-staged-config?color=blueviolet&style=for-the-badge
|
|
167
|
+
[license-url]: LICENSE.md "license"
|
|
168
|
+
[npm-image]: https://img.shields.io/npm/v/@anolilab/lint-staged-config/latest.svg?style=for-the-badge&logo=npm
|
|
169
|
+
[npm-url]: https://www.npmjs.com/package/@anolilab/lint-staged-config/v/latest "npm"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkT755FU2I_js = require('./chunk-T755FU2I.js');
|
|
4
|
+
|
|
5
|
+
var i={[`*.{${["css","sass","scss","less"].join(",")}}`]:t=>[`prettier --ignore-unknown --write ${chunkT755FU2I_js.b(t)}`,"stylelint --fix"]},n=i;
|
|
6
|
+
|
|
7
|
+
exports.a = n;
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-4PCPJEEI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["group","filenames","concat_files_default","stylesheets_default"],"mappings":"wCAIA,IAAMA,EAAgB,CAClB,CAAC,MAAM,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAC3E,qCAAqCC,EAAYD,CAAS,IAC1D,iBACJ,CACJ,EAEOE,EAAQH","sourcesContent":["import type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst group: Config = {\n [`*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n `prettier --ignore-unknown --write ${concatFiles(filenames)}`,\n \"stylelint --fix\",\n ],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/secretlint.ts"],"names":["group","secretlint_default"],"mappings":"AAEA,IAAMA,EAAgB,CAClB,IAAK,CAAC,YAAY,CACtB,EAEOC,EAAQD","sourcesContent":["import type { Config } from \"lint-staged\";\n\nconst group: Config = {\n \"*\": [\"secretlint\"],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/secretlint.ts"],"names":["group","secretlint_default"],"mappings":"AAEA,IAAMA,EAAgB,CAClB,IAAK,CAAC,YAAY,CACtB,EAEOC,EAAQD","sourcesContent":["import type { Config } from \"lint-staged\";\n\nconst group: Config = {\n \"*\": [\"secretlint\"],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import r from 'find-up';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
|
|
5
|
+
var h=e=>{let t=r.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}!`)},p=e=>{let t=join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},f=(e,t)=>{let n=c(t),o=p([n,e]);if(existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},d=f;
|
|
6
|
+
|
|
7
|
+
export { d as a };
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-AMNQJNNY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,IAAM,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAErE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,UAAiB,CAC/D,EAMOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport type AbsolutePath = `/${string}`;\nexport type ConfigFileName = string;\nexport type ConfigPath<A extends AbsolutePath, N extends ConfigFileName> = Join<[A, N], \"/\">;\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b } from './chunk-OTRYI4YE.mjs';
|
|
2
|
+
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
|
+
|
|
4
|
+
var n=hasDependency("vitest")||hasDevDependency("vitest"),i=hasDependency("jest")||hasDevDependency("jest"),j=hasDependency("ava")||hasDevDependency("ava"),d={...n&&{"**/__tests__/**/*.?(c|m)[jt]s?(x)":["vitest related --run"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["vitest related --run"]},...i&&{"**/*.spec.{js,ts,tsx}":["jest --findRelatedTests"],"**/*.test.{js,ts,tsx}":["jest --findRelatedTests"],"**/test/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__mocks__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["jest --findRelatedTests"]},...j&&{"**/test.js":t=>[`ava ${b(t)}`],"**/test-*.js":t=>[`ava ${b(t)}`],"**/*.(spec|test).js":t=>[`ava ${b(t)}`],"**/(test|tests|__tests__)/**/*.js":t=>[`ava ${b(t)}`]}},o=d;
|
|
5
|
+
|
|
6
|
+
export { o as a };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-BGOY7MBY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/tests.ts"],"names":["hasDependency","hasDevDependency","hasVitest","hasJest","hasAva","group","filenames","concat_files_default","tests_default"],"mappings":"yCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAYF,EAAc,QAAQ,GAAKC,EAAiB,QAAQ,EAChEE,EAAUH,EAAc,MAAM,GAAKC,EAAiB,MAAM,EAC1DG,EAASJ,EAAc,KAAK,GAAKC,EAAiB,KAAK,EAEvDI,EAAgB,CAClB,GAAIH,GAAa,CAAE,oCAAqC,CAAC,sBAAsB,EAAG,sCAAuC,CAAC,sBAAsB,CAAE,EAClJ,GAAIC,GAAW,CACX,wBAAyB,CAAC,yBAAyB,EACnD,wBAAyB,CAAC,yBAAyB,EACnD,wBAAyB,CAAC,yBAAyB,EACnD,6BAA8B,CAAC,yBAAyB,EACxD,6BAA8B,CAAC,yBAAyB,EACxD,oCAAqC,CAAC,yBAAyB,EAC/D,sCAAuC,CAAC,yBAAyB,CACrE,EACA,GAAIC,GAAU,CACV,aAAeE,GAAwB,CAAC,OAAOC,EAAYD,CAAS,GAAG,EACvE,eAAiBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,GAAG,EACzE,sBAAwBA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,GAAG,EAChF,oCAAsCA,GAAwB,CAAC,OAAOC,EAAYD,CAAS,GAAG,CAClG,CACJ,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst hasVitest = hasDependency(\"vitest\") || hasDevDependency(\"vitest\");\nconst hasJest = hasDependency(\"jest\") || hasDevDependency(\"jest\");\nconst hasAva = hasDependency(\"ava\") || hasDevDependency(\"ava\");\n\nconst group: Config = {\n ...(hasVitest && { \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"vitest related --run\"], \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"vitest related --run\"] }),\n ...(hasJest && {\n \"**/*.spec.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/*.test.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/test/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/__mocks__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/__tests__/*.{js,ts,tsx}\": [\"jest --findRelatedTests\"],\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\": [\"jest --findRelatedTests\"],\n }),\n ...(hasAva && {\n \"**/test.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/test-*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/*.(spec|test).js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n \"**/(test|tests|__tests__)/**/*.js\": (filenames: string[]) => [`ava ${concatFiles(filenames)}`],\n }),\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b } from './chunk-OTRYI4YE.mjs';
|
|
2
|
+
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
|
+
|
|
4
|
+
var a=hasDependency("sort-package-json")||hasDevDependency("sort-package-json"),t={[`*.{${["json","json5","jsonc"].join(",")}}`]:o=>[`prettier --write ${b(o)}`],...a?{"package.json,{packages,apps}/*/package.json":o=>[`sort-package-json ${b(o)}`]}:{}},c=t;
|
|
5
|
+
|
|
6
|
+
export { c as a };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-CRK67F7X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/json.ts"],"names":["hasDependency","hasDevDependency","hasSortPackageJson","group","filenames","concat_files_default","json_default"],"mappings":"yCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAqBF,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,EAE/FE,EAAgB,CAClB,CAAC,MAAM,CAAC,OAAQ,QAAS,OAAO,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAAC,oBAAoBC,EAAYD,CAAS,GAAG,EACvH,GAAIF,EAAqB,CAAE,8CAAgDE,GAAwB,CAAC,qBAAqBC,EAAYD,CAAS,GAAG,CAAE,EAAI,CAAC,CAC5J,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst hasSortPackageJson = hasDependency(\"sort-package-json\") || hasDevDependency(\"sort-package-json\");\n\nconst group: Config = {\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: (filenames: string[]) => [`prettier --write ${concatFiles(filenames)}`],\n ...(hasSortPackageJson ? { \"package.json,{packages,apps}/*/package.json\": (filenames: string[]) => [`sort-package-json ${concatFiles(filenames)}`] } : {}),\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL5GFXHVL_js = require('./chunk-L5GFXHVL.js');
|
|
4
|
+
var chunkT755FU2I_js = require('./chunk-T755FU2I.js');
|
|
5
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var eslint = require('eslint');
|
|
8
|
+
var shellQuote = require('shell-quote');
|
|
9
|
+
|
|
10
|
+
!global.anolilabLintStagedPackageJsonConfig&&packageJsonUtils.pkg&&(global.anolilabLintStagedPackageJsonConfig=packageJsonUtils.pkg?.anolilab?.["lint-staged-config"]);var $=global.anolilabLintStagedPackageJsonConfig??{},u=$;var k=n=>{let t={};return n.forEach(s=>{let i=path.dirname(s);t[i]||(t[i]=[]),t[i].push(s);}),t},p=k;var F=async n=>{let t=new eslint.ESLint,s=await Promise.all(n.map(o=>t.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${chunkT755FU2I_js.a?o:shellQuote.quote([o])}"`)},h=F;var e=u?.settings?.eslint??{},y=["react-hooks/exhaustive-deps: off"],r=".eslintrc",A=()=>{let n=[];e?.["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e?.["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[];e?.rules!==void 0&&Array.isArray(e.rules)?t.push([...e.rules,...y].filter(i=>i.trim().length>0).map(i=>`"${i.trim()}"`)):t.push(y.map(i=>`"${i.trim()}"`)),t.length>0&&n.push(`--rule ${t.join(" --rule ")}`);let s=[...e?.["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e?.cache&&n.push("--cache"),n},E=async n=>{let t=await h(n),s=A();if(e?.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${t.join(" ")}`];let i=p(t),o=[];return Object.values(i).forEach(a=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach(S=>{if(!l)try{l=chunkL5GFXHVL_js.a(S,a[0]);}catch{}}),l&&o.push(`cross-env NO_LOGS=true eslint ${s.join(" ")} --config ${l} ${a.join(" ")}`);}),o},g=E;var x=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml"];global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));!global.hasAnolilabLintStagedMarkdownCli&&!global.hasAnolilabLintStagedMarkdownCli2&&x.push("md");var N={[`*.{${[x].join(",")}}`]:async n=>[`prettier --write ${chunkT755FU2I_js.b(n)}`,...await g(n)],[`*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await g(n)]},K=N;
|
|
11
|
+
|
|
12
|
+
exports.a = u;
|
|
13
|
+
exports.b = K;
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-G7Q3HUT7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/eslint/index.ts","../src/utils/lint-staged-config.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts","../src/groups/eslint/create-eslint-commands.ts"],"names":["hasDependency","hasDevDependency","pkg","config","lint_staged_config_default","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","r","fixType","type","createEslintCommands","filteredFiles","groupedFilesNames","eslintCommands","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"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","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport createEslintCommands from \"./create-eslint-commands\";\n\nconst extensions = [\"cjs\", \"js\", \"mjs\", \"cts\", \"ts\", \"mts\", \"yml\", \"yaml\", \"jsx\", \"tsx\", \"mdx\", \"toml\"];\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli && !global.hasAnolilabLintStagedMarkdownCli2) {\n extensions.push(\"md\");\n}\n\nconst group: Config = {\n [`*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n `prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n};\n\nexport default group;\n","import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg?.[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: { [key: string]: boolean | undefined } = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): { [key: string]: string[] } => {\n const groups: { [key: string]: string[] } = {};\n\n filePaths.forEach((filePath) => {\n const directoryName = dirname(filePath);\n\n if (!groups[directoryName]) {\n groups[directoryName] = [];\n }\n\n (groups[directoryName] as string[]).push(filePath);\n });\n\n return groups;\n};\n\nexport default groupFilePathsByDirectoryName;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ESLint } from \"eslint\";\nimport { quote } from \"shell-quote\";\n\nimport isWindows from \"../../utils/is-windows\";\n\nconst removeIgnoredFiles = async (filenames: string[]): Promise<string[]> => {\n const eslint = new ESLint();\n // eslint-disable-next-line compat/compat\n const ignoredFiles = await Promise.all(filenames.map((filename) => eslint.isPathIgnored(filename)));\n const filteredFiles = filenames.filter((_, index) => !ignoredFiles[index]);\n\n return filteredFiles.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`);\n};\n\nexport default removeIgnoredFiles;\n","import getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ntype ESLintSettings = {\n settings: {\n eslint?: {\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n \"fix-type\": string[];\n cache?: boolean;\n config?: string;\n };\n };\n};\n\nconst eslintSettings: ESLintSettings[\"settings\"][\"eslint\"] = (anolilabLintStagedConfig as unknown as ESLintSettings)?.[\"settings\"]?.[\"eslint\"] ?? ({} as ESLintSettings[\"settings\"][\"eslint\"]);\n\nconst eslintGlobalRulesForFix = [\n // react-hooks/eslint and react in general is very strict about exhaustively\n // declaring the dependencies when using the useEffect, useCallback... hooks.\n //\n // In some specific scenarios declaring the deps seems 'less' wanted or 'less' applicable\n // by the developer, leading to some exceptions in the code. That said it should be avoided.\n //\n // While the 'react-hooks/exhaustive-deps' rule is a good rule of thumb, it's not recommended to\n // automatically fix it from lint-staged as it can potentially break a legit intent.\n //\n // Reminder that a good practice is to always declare the dependencies when using the hooks,\n // and if not applicable, add an eslint disable comment to the useEffect, useCallback... such as:\n //\n // // eslint-disable-next-line react-hooks/exhaustive-deps\n //\n // Another approach can be to use hooks such as https://github.com/kentcdodds/use-deep-compare-effect to quickly bypass\n // shallow rendering limitations.\n //\n // @see https://reactjs.org/docs/hooks-rules.html\n // @see https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments\n \"react-hooks/exhaustive-deps: off\",\n];\n\nconst configFile = \".eslintrc\";\n\nconst createEslintArguments = (): string[] => {\n const eslintArguments: string[] = [];\n\n if (eslintSettings?.[\"max-warnings\"] !== undefined && Number.isNaN(eslintSettings[\"max-warnings\"])) {\n eslintArguments.push(`--max-warnings=${eslintSettings[\"max-warnings\"]}`);\n } else if (eslintSettings?.[\"max-warnings\"] !== false) {\n eslintArguments.push(\"--max-warnings=0\");\n }\n\n const rules = [];\n\n if (eslintSettings?.[\"rules\"] !== undefined && Array.isArray(eslintSettings[\"rules\"])) {\n rules.push([...eslintSettings[\"rules\"], ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0).map((r) => `\"${r.trim()}\"`));\n } else {\n rules.push(eslintGlobalRulesForFix.map((r) => `\"${r.trim()}\"`));\n }\n\n if (rules.length > 0) {\n eslintArguments.push(`--rule ${rules.join(\" --rule \")}`);\n }\n\n // For lint-staged it's safer to not apply the fix command if it changes the AST\n // @see https://eslint.org/docs/user-guide/command-line-interface#--fix-type\n const fixType = [...(eslintSettings?.[\"fix-type\"] ?? [\"layout\"])].filter((type) => type.trim().length > 0);\n\n if (fixType.length > 0) {\n eslintArguments.push(`--fix-type ${fixType.join(\",\")}`, \"--fix\");\n }\n\n if (eslintSettings?.[\"cache\"]) {\n eslintArguments.push(\"--cache\");\n }\n\n return eslintArguments;\n};\n\nconst createEslintCommands = async (filenames: string[]): Promise<string[]> => {\n const filteredFiles = await removeIgnoredFiles(filenames);\n\n const eslintArguments = createEslintArguments();\n\n if (eslintSettings?.[\"config\"]) {\n eslintArguments.push(`--config ${eslintSettings[\"config\"]}`);\n\n return [`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} ${filteredFiles.join(\" \")}`];\n }\n\n const groupedFilesNames = groupFilePathsByDirectoryName(filteredFiles);\n const eslintCommands: string[] = [];\n\n Object.values(groupedFilesNames).forEach((filePaths) => {\n let config: string | undefined;\n\n [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`].forEach((configName) => {\n if (config) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-template-curly-in-string\n config = getNearestConfigPath(configName, filePaths[0] as \"/${string}\");\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkT755FU2I_js = require('./chunk-T755FU2I.js');
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
|
+
|
|
6
|
+
global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));var a={"**/*.md":i=>[`prettier --write ${chunkT755FU2I_js.b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${chunkT755FU2I_js.b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${chunkT755FU2I_js.b(i)}`]:[]],"**/*.mdx":i=>[`prettier --write ${chunkT755FU2I_js.b(i)}`]},r=a;
|
|
7
|
+
|
|
8
|
+
exports.a = r;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-JTIOAOUE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","group","filenames","concat_files_default","markdown_default"],"mappings":"wCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAK3C,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,oBAAoBC,EAAYD,CAAS,IACzC,GAAI,OAAO,iCACL,CAAC,+EAA+EC,EAAYD,CAAS,GAAG,EACxG,CAAC,EACP,GAAI,OAAO,kCAAoC,CAAC,oEAAoEC,EAAYD,CAAS,GAAG,EAAI,CAAC,CACrJ,EACA,WAAaA,GAAc,CAAC,oBAAoBC,EAAYD,CAAS,GAAG,CAC5E,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\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 `prettier --write ${concatFiles(filenames)}`,\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2 ? [`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`] : []),\n ],\n \"**/*.mdx\": (filenames) => [`prettier --write ${concatFiles(filenames)}`],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var r = require('find-up');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var r__default = /*#__PURE__*/_interopDefault(r);
|
|
10
|
+
|
|
11
|
+
var h=e=>{let t=r__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}!`)},p=e=>{let t=path.join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},f=(e,t)=>{let n=c(t),o=p([n,e]);if(fs.existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},d=f;
|
|
12
|
+
|
|
13
|
+
exports.a = d;
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-L5GFXHVL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAG9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,IAAM,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAkEC,EAAaR,IAA8B,CACtI,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAErE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,UAAiB,CAC/D,EAMOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport type AbsolutePath = `/${string}`;\nexport type ConfigFileName = string;\nexport type ConfigPath<A extends AbsolutePath, N extends ConfigFileName> = Join<[A, N], \"/\">;\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL5GFXHVL_js = require('./chunk-L5GFXHVL.js');
|
|
4
|
+
var process = require('process');
|
|
5
|
+
|
|
6
|
+
var i={[`*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=chunkL5GFXHVL_js.a("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){process.env.DEBUG&&console.error(t);}}),[...o]}},f=i;
|
|
7
|
+
|
|
8
|
+
exports.a = f;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-LSR35CMP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"wCACA,OAAS,OAAAA,MAAW,UAIpB,IAAMC,EAAgB,CAClB,CAAC,MAAM,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAChE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,GAAc,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import type { Config } from \"lint-staged\";\nimport { env } from \"node:process\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\");\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error: any) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { quote } from 'shell-quote';
|
|
2
|
+
import { env } from 'process';
|
|
3
|
+
|
|
4
|
+
var i=process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(env.OSTYPE??"")),s=i;var p=t=>t.map(o=>`"${s?o:quote([o])}"`).join(" "),a=p;
|
|
5
|
+
|
|
6
|
+
export { s as a, a as b };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-OTRYI4YE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,MAAW,UAGpB,IAAMC,EAAY,UAAY,QAAQ,WAAa,SAAW,kBAAkB,KAAKD,EAAI,QAAa,EAAE,GAEjGE,EAAQD,EDUf,IAAME,EAAeC,GAAgCA,EAAU,IAAKC,GAAa,IAAIH,EAAYG,EAAWN,EAAM,CAACM,CAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,EAEnIC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string => filenames.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`).join(\" \");\n\nexport default concatFiles;\n","import { env } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = process && (process.platform === \"win32\" || /^(msys|cygwin)$/.test(env[\"OSTYPE\"] ?? \"\"));\n\nexport default isWindows;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a } from './chunk-AMNQJNNY.mjs';
|
|
2
|
+
import { b, a as a$1 } from './chunk-OTRYI4YE.mjs';
|
|
3
|
+
import { pkg, hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
import { ESLint } from 'eslint';
|
|
6
|
+
import { quote } from 'shell-quote';
|
|
7
|
+
|
|
8
|
+
!global.anolilabLintStagedPackageJsonConfig&&pkg&&(global.anolilabLintStagedPackageJsonConfig=pkg?.anolilab?.["lint-staged-config"]);var $=global.anolilabLintStagedPackageJsonConfig??{},u=$;var k=n=>{let t={};return n.forEach(s=>{let i=dirname(s);t[i]||(t[i]=[]),t[i].push(s);}),t},p=k;var F=async n=>{let t=new ESLint,s=await Promise.all(n.map(o=>t.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${a$1?o:quote([o])}"`)},h=F;var e=u?.settings?.eslint??{},y=["react-hooks/exhaustive-deps: off"],r=".eslintrc",A=()=>{let n=[];e?.["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e?.["max-warnings"]!==!1&&n.push("--max-warnings=0");let t=[];e?.rules!==void 0&&Array.isArray(e.rules)?t.push([...e.rules,...y].filter(i=>i.trim().length>0).map(i=>`"${i.trim()}"`)):t.push(y.map(i=>`"${i.trim()}"`)),t.length>0&&n.push(`--rule ${t.join(" --rule ")}`);let s=[...e?.["fix-type"]??["layout"]].filter(i=>i.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e?.cache&&n.push("--cache"),n},E=async n=>{let t=await h(n),s=A();if(e?.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${t.join(" ")}`];let i=p(t),o=[];return Object.values(i).forEach(a$1=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach(S=>{if(!l)try{l=a(S,a$1[0]);}catch{}}),l&&o.push(`cross-env NO_LOGS=true eslint ${s.join(" ")} --config ${l} ${a$1.join(" ")}`);}),o},g=E;var x=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml"];global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));!global.hasAnolilabLintStagedMarkdownCli&&!global.hasAnolilabLintStagedMarkdownCli2&&x.push("md");var N={[`*.{${[x].join(",")}}`]:async n=>[`prettier --write ${b(n)}`,...await g(n)],[`*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await g(n)]},K=N;
|
|
9
|
+
|
|
10
|
+
export { u as a, K as b };
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=chunk-PT4S7CCV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/eslint/index.ts","../src/utils/lint-staged-config.ts","../src/groups/eslint/group-file-paths-by-directory-name.ts","../src/groups/eslint/remove-ignored-files.ts","../src/groups/eslint/create-eslint-commands.ts"],"names":["hasDependency","hasDevDependency","pkg","config","lint_staged_config_default","dirname","groupFilePathsByDirectoryName","filePaths","groups","filePath","directoryName","group_file_paths_by_directory_name_default","ESLint","quote","removeIgnoredFiles","filenames","eslint","ignoredFiles","filename","_","index","is_windows_default","remove_ignored_files_default","eslintSettings","eslintGlobalRulesForFix","configFile","createEslintArguments","eslintArguments","rules","rule","r","fixType","type","createEslintCommands","filteredFiles","groupedFilesNames","eslintCommands","configName","get_nearest_config_path_default","create_eslint_commands_default","extensions","group","concat_files_default","eslint_default"],"mappings":"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","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../../utils/concat-files\";\nimport createEslintCommands from \"./create-eslint-commands\";\n\nconst extensions = [\"cjs\", \"js\", \"mjs\", \"cts\", \"ts\", \"mts\", \"yml\", \"yaml\", \"jsx\", \"tsx\", \"mdx\", \"toml\"];\n\nif (!global.hasAnolilabLintStagedMarkdownCli) {\n global.hasAnolilabLintStagedMarkdownCli = hasDependency(\"markdownlint-cli\") || hasDevDependency(\"markdownlint-cli\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli2) {\n global.hasAnolilabLintStagedMarkdownCli2 = hasDependency(\"markdownlint-cli2\") || hasDevDependency(\"markdownlint-cli2\");\n}\n\nif (!global.hasAnolilabLintStagedMarkdownCli && !global.hasAnolilabLintStagedMarkdownCli2) {\n extensions.push(\"md\");\n}\n\nconst group: Config = {\n [`*.{${[extensions].join(\",\")}}`]: async (filenames: string[]) => [\n `prettier --write ${concatFiles(filenames)}`,\n ...(await createEslintCommands(filenames)),\n ],\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: async (filenames: string[]) => [...(await createEslintCommands(filenames))],\n};\n\nexport default group;\n","import { pkg } from \"@anolilab/package-json-utils\";\n\nif (!global.anolilabLintStagedPackageJsonConfig && pkg) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n global.anolilabLintStagedPackageJsonConfig = pkg?.[\"anolilab\"]?.[\"lint-staged-config\"];\n}\n\nconst config: { [key: string]: boolean | undefined } = global.anolilabLintStagedPackageJsonConfig ?? {};\n\nexport default config;\n","import { dirname } from \"node:path\";\n\nconst groupFilePathsByDirectoryName = (filePaths: string[]): { [key: string]: string[] } => {\n const groups: { [key: string]: string[] } = {};\n\n filePaths.forEach((filePath) => {\n const directoryName = dirname(filePath);\n\n if (!groups[directoryName]) {\n groups[directoryName] = [];\n }\n\n (groups[directoryName] as string[]).push(filePath);\n });\n\n return groups;\n};\n\nexport default groupFilePathsByDirectoryName;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ESLint } from \"eslint\";\nimport { quote } from \"shell-quote\";\n\nimport isWindows from \"../../utils/is-windows\";\n\nconst removeIgnoredFiles = async (filenames: string[]): Promise<string[]> => {\n const eslint = new ESLint();\n // eslint-disable-next-line compat/compat\n const ignoredFiles = await Promise.all(filenames.map((filename) => eslint.isPathIgnored(filename)));\n const filteredFiles = filenames.filter((_, index) => !ignoredFiles[index]);\n\n return filteredFiles.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`);\n};\n\nexport default removeIgnoredFiles;\n","import getNearestConfigPath from \"../../utils/get-nearest-config-path\";\nimport anolilabLintStagedConfig from \"../../utils/lint-staged-config\";\nimport groupFilePathsByDirectoryName from \"./group-file-paths-by-directory-name\";\nimport removeIgnoredFiles from \"./remove-ignored-files\";\n\ntype ESLintSettings = {\n settings: {\n eslint?: {\n \"max-warnings\"?: number | string | false;\n rules?: string[];\n \"fix-type\": string[];\n cache?: boolean;\n config?: string;\n };\n };\n};\n\nconst eslintSettings: ESLintSettings[\"settings\"][\"eslint\"] = (anolilabLintStagedConfig as unknown as ESLintSettings)?.[\"settings\"]?.[\"eslint\"] ?? ({} as ESLintSettings[\"settings\"][\"eslint\"]);\n\nconst eslintGlobalRulesForFix = [\n // react-hooks/eslint and react in general is very strict about exhaustively\n // declaring the dependencies when using the useEffect, useCallback... hooks.\n //\n // In some specific scenarios declaring the deps seems 'less' wanted or 'less' applicable\n // by the developer, leading to some exceptions in the code. That said it should be avoided.\n //\n // While the 'react-hooks/exhaustive-deps' rule is a good rule of thumb, it's not recommended to\n // automatically fix it from lint-staged as it can potentially break a legit intent.\n //\n // Reminder that a good practice is to always declare the dependencies when using the hooks,\n // and if not applicable, add an eslint disable comment to the useEffect, useCallback... such as:\n //\n // // eslint-disable-next-line react-hooks/exhaustive-deps\n //\n // Another approach can be to use hooks such as https://github.com/kentcdodds/use-deep-compare-effect to quickly bypass\n // shallow rendering limitations.\n //\n // @see https://reactjs.org/docs/hooks-rules.html\n // @see https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments\n \"react-hooks/exhaustive-deps: off\",\n];\n\nconst configFile = \".eslintrc\";\n\nconst createEslintArguments = (): string[] => {\n const eslintArguments: string[] = [];\n\n if (eslintSettings?.[\"max-warnings\"] !== undefined && Number.isNaN(eslintSettings[\"max-warnings\"])) {\n eslintArguments.push(`--max-warnings=${eslintSettings[\"max-warnings\"]}`);\n } else if (eslintSettings?.[\"max-warnings\"] !== false) {\n eslintArguments.push(\"--max-warnings=0\");\n }\n\n const rules = [];\n\n if (eslintSettings?.[\"rules\"] !== undefined && Array.isArray(eslintSettings[\"rules\"])) {\n rules.push([...eslintSettings[\"rules\"], ...eslintGlobalRulesForFix].filter((rule) => rule.trim().length > 0).map((r) => `\"${r.trim()}\"`));\n } else {\n rules.push(eslintGlobalRulesForFix.map((r) => `\"${r.trim()}\"`));\n }\n\n if (rules.length > 0) {\n eslintArguments.push(`--rule ${rules.join(\" --rule \")}`);\n }\n\n // For lint-staged it's safer to not apply the fix command if it changes the AST\n // @see https://eslint.org/docs/user-guide/command-line-interface#--fix-type\n const fixType = [...(eslintSettings?.[\"fix-type\"] ?? [\"layout\"])].filter((type) => type.trim().length > 0);\n\n if (fixType.length > 0) {\n eslintArguments.push(`--fix-type ${fixType.join(\",\")}`, \"--fix\");\n }\n\n if (eslintSettings?.[\"cache\"]) {\n eslintArguments.push(\"--cache\");\n }\n\n return eslintArguments;\n};\n\nconst createEslintCommands = async (filenames: string[]): Promise<string[]> => {\n const filteredFiles = await removeIgnoredFiles(filenames);\n\n const eslintArguments = createEslintArguments();\n\n if (eslintSettings?.[\"config\"]) {\n eslintArguments.push(`--config ${eslintSettings[\"config\"]}`);\n\n return [`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} ${filteredFiles.join(\" \")}`];\n }\n\n const groupedFilesNames = groupFilePathsByDirectoryName(filteredFiles);\n const eslintCommands: string[] = [];\n\n Object.values(groupedFilesNames).forEach((filePaths) => {\n let config: string | undefined;\n\n [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`].forEach((configName) => {\n if (config) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-template-curly-in-string\n config = getNearestConfigPath(configName, filePaths[0] as \"/${string}\");\n } catch {\n // Ignore\n }\n });\n\n if (config) {\n eslintCommands.push(`cross-env NO_LOGS=true eslint ${eslintArguments.join(\" \")} --config ${config} ${filePaths.join(\" \")}`);\n }\n });\n\n return eslintCommands;\n};\n\nexport default createEslintCommands;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var shellQuote = require('shell-quote');
|
|
4
|
+
var process$1 = require('process');
|
|
5
|
+
|
|
6
|
+
var i=process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(process$1.env.OSTYPE??"")),s=i;var p=t=>t.map(o=>`"${s?o:shellQuote.quote([o])}"`).join(" "),a=p;
|
|
7
|
+
|
|
8
|
+
exports.a = s;
|
|
9
|
+
exports.b = a;
|
|
10
|
+
//# sourceMappingURL=out.js.map
|
|
11
|
+
//# sourceMappingURL=chunk-T755FU2I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/concat-files.ts","../src/utils/is-windows.ts"],"names":["quote","env","isWindows","is_windows_default","concatFiles","filenames","filename","concat_files_default"],"mappings":"AAAA,OAAS,SAAAA,MAAa,cCAtB,OAAS,OAAAC,MAAW,UAGpB,IAAMC,EAAY,UAAY,QAAQ,WAAa,SAAW,kBAAkB,KAAKD,EAAI,QAAa,EAAE,GAEjGE,EAAQD,EDUf,IAAME,EAAeC,GAAgCA,EAAU,IAAKC,GAAa,IAAIH,EAAYG,EAAWN,EAAM,CAACM,CAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,EAEnIC,EAAQH","sourcesContent":["import { quote } from \"shell-quote\";\n\nimport isWindows from \"./is-windows\";\n\n/**\n * Concatenate and escape a list of filenames that can be passed as args to prettier cli\n *\n * Prettier and Stylelint have an issue with special characters in filenames,\n * such as the ones uses for Next.js dynamic routes (ie: [id].tsx...)\n *\n * @link https://github.com/okonet/lint-staged/issues/676\n *\n * @param {string[]} filenames\n * @returns {string} Return concatenated and escaped filenames\n */\nconst concatFiles = (filenames: string[]): string => filenames.map((filename) => `\"${isWindows ? filename : quote([filename])}\"`).join(\" \");\n\nexport default concatFiles;\n","import { env } from \"node:process\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst isWindows = process && (process.platform === \"win32\" || /^(msys|cygwin)$/.test(env[\"OSTYPE\"] ?? \"\"));\n\nexport default isWindows;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkT755FU2I_js = require('./chunk-T755FU2I.js');
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
|
+
|
|
6
|
+
var a=packageJsonUtils.hasDependency("sort-package-json")||packageJsonUtils.hasDevDependency("sort-package-json"),t={[`*.{${["json","json5","jsonc"].join(",")}}`]:o=>[`prettier --write ${chunkT755FU2I_js.b(o)}`],...a?{"package.json,{packages,apps}/*/package.json":o=>[`sort-package-json ${chunkT755FU2I_js.b(o)}`]}:{}},c=t;
|
|
7
|
+
|
|
8
|
+
exports.a = c;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-UF7UO5PL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/json.ts"],"names":["hasDependency","hasDevDependency","hasSortPackageJson","group","filenames","concat_files_default","json_default"],"mappings":"wCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAKhD,IAAMC,EAAqBF,EAAc,mBAAmB,GAAKC,EAAiB,mBAAmB,EAE/FE,EAAgB,CAClB,CAAC,MAAM,CAAC,OAAQ,QAAS,OAAO,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAAC,oBAAoBC,EAAYD,CAAS,GAAG,EACvH,GAAIF,EAAqB,CAAE,8CAAgDE,GAAwB,CAAC,qBAAqBC,EAAYD,CAAS,GAAG,CAAE,EAAI,CAAC,CAC5J,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst hasSortPackageJson = hasDependency(\"sort-package-json\") || hasDevDependency(\"sort-package-json\");\n\nconst group: Config = {\n [`*.{${[\"json\", \"json5\", \"jsonc\"].join(\",\")}}`]: (filenames: string[]) => [`prettier --write ${concatFiles(filenames)}`],\n ...(hasSortPackageJson ? { \"package.json,{packages,apps}/*/package.json\": (filenames: string[]) => [`sort-package-json ${concatFiles(filenames)}`] } : {}),\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { a } from './chunk-AMNQJNNY.mjs';
|
|
2
|
+
import { env } from 'process';
|
|
3
|
+
|
|
4
|
+
var i={[`*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=a("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){env.DEBUG&&console.error(t);}}),[...o]}},f=i;
|
|
5
|
+
|
|
6
|
+
export { f as a };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-UHH5GDWT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"yCACA,OAAS,OAAAA,MAAW,UAIpB,IAAMC,EAAgB,CAClB,CAAC,MAAM,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAChE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,GAAc,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import type { Config } from \"lint-staged\";\nimport { env } from \"node:process\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\");\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error: any) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b } from './chunk-OTRYI4YE.mjs';
|
|
2
|
+
|
|
3
|
+
var i={[`*.{${["css","sass","scss","less"].join(",")}}`]:t=>[`prettier --ignore-unknown --write ${b(t)}`,"stylelint --fix"]},n=i;
|
|
4
|
+
|
|
5
|
+
export { n as a };
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-UKLFK6IR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/stylesheets.ts"],"names":["group","filenames","concat_files_default","stylesheets_default"],"mappings":"yCAIA,IAAMA,EAAgB,CAClB,CAAC,MAAM,CAAC,MAAO,OAAQ,OAAQ,MAAM,EAAE,KAAK,GAAG,IAAI,EAAIC,GAAwB,CAC3E,qCAAqCC,EAAYD,CAAS,IAC1D,iBACJ,CACJ,EAEOE,EAAQH","sourcesContent":["import type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\nconst group: Config = {\n [`*.{${[\"css\", \"sass\", \"scss\", \"less\"].join(\",\")}}`]: (filenames: string[]) => [\n `prettier --ignore-unknown --write ${concatFiles(filenames)}`,\n \"stylelint --fix\",\n ],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b } from './chunk-OTRYI4YE.mjs';
|
|
2
|
+
import { hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
3
|
+
|
|
4
|
+
global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=hasDependency("markdownlint-cli")||hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=hasDependency("markdownlint-cli2")||hasDevDependency("markdownlint-cli2"));var a={"**/*.md":i=>[`prettier --write ${b(i)}`,...global.hasAnolilabLintStagedMarkdownCli?[`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${b(i)}`]:[],...global.hasAnolilabLintStagedMarkdownCli2?[`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${b(i)}`]:[]],"**/*.mdx":i=>[`prettier --write ${b(i)}`]},r=a;
|
|
5
|
+
|
|
6
|
+
export { r as a };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-VW6R74AT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/markdown.ts"],"names":["hasDependency","hasDevDependency","group","filenames","concat_files_default","markdown_default"],"mappings":"yCAAA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAK3C,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,oBAAoBC,EAAYD,CAAS,IACzC,GAAI,OAAO,iCACL,CAAC,+EAA+EC,EAAYD,CAAS,GAAG,EACxG,CAAC,EACP,GAAI,OAAO,kCAAoC,CAAC,oEAAoEC,EAAYD,CAAS,GAAG,EAAI,CAAC,CACrJ,EACA,WAAaA,GAAc,CAAC,oBAAoBC,EAAYD,CAAS,GAAG,CAC5E,EAEOE,EAAQH","sourcesContent":["import { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\nimport type { Config } from \"lint-staged\";\n\nimport concatFiles from \"../utils/concat-files\";\n\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 `prettier --write ${concatFiles(filenames)}`,\n ...(global.hasAnolilabLintStagedMarkdownCli\n ? [`markdownlint --fix --ignore '**/node_modules/**' --ignore '**/CHANGELOG.md' ${concatFiles(filenames)}`]\n : []),\n ...(global.hasAnolilabLintStagedMarkdownCli2 ? [`markdownlint-cli2 --fix '!**/node_modules/**' '!**/CHANGELOG.md' ${concatFiles(filenames)}`] : []),\n ],\n \"**/*.mdx\": (filenames) => [`prettier --write ${concatFiles(filenames)}`],\n};\n\nexport default group;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkT755FU2I_js = require('./chunk-T755FU2I.js');
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
|
+
|
|
6
|
+
var n=packageJsonUtils.hasDependency("vitest")||packageJsonUtils.hasDevDependency("vitest"),i=packageJsonUtils.hasDependency("jest")||packageJsonUtils.hasDevDependency("jest"),j=packageJsonUtils.hasDependency("ava")||packageJsonUtils.hasDevDependency("ava"),d={...n&&{"**/__tests__/**/*.?(c|m)[jt]s?(x)":["vitest related --run"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["vitest related --run"]},...i&&{"**/*.spec.{js,ts,tsx}":["jest --findRelatedTests"],"**/*.test.{js,ts,tsx}":["jest --findRelatedTests"],"**/test/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__mocks__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/*.{js,ts,tsx}":["jest --findRelatedTests"],"**/__tests__/**/*.?(c|m)[jt]s?(x)":["jest --findRelatedTests"],"**/?(*.){test,spec}.?(c|m)[jt]s?(x)":["jest --findRelatedTests"]},...j&&{"**/test.js":t=>[`ava ${chunkT755FU2I_js.b(t)}`],"**/test-*.js":t=>[`ava ${chunkT755FU2I_js.b(t)}`],"**/*.(spec|test).js":t=>[`ava ${chunkT755FU2I_js.b(t)}`],"**/(test|tests|__tests__)/**/*.js":t=>[`ava ${chunkT755FU2I_js.b(t)}`]}},o=d;
|
|
7
|
+
|
|
8
|
+
exports.a = o;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-ZRW63OZY.js.map
|