@chanyuxi/eslint-waltz 0.1.1 → 1.1.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/LICENSE +19 -0
- package/README.md +19 -6
- package/dist/cli.js +8 -8
- package/dist/index.d.ts +5392 -492
- package/dist/index.js +244 -183
- package/package.json +47 -35
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026-present Chanyuxi
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
-
👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, and
|
|
3
|
+
👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and Perfectionist.
|
|
4
4
|
|
|
5
5
|
Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
6
6
|
|
|
@@ -9,13 +9,17 @@ Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
|
9
9
|
The following configuration modules are available:
|
|
10
10
|
|
|
11
11
|
- ✅ Javascript
|
|
12
|
-
- ✅ Typescript
|
|
13
|
-
- ✅ Stylistic
|
|
12
|
+
- ✅ Typescript
|
|
13
|
+
- ✅ Stylistic
|
|
14
|
+
- ✅ Perfectionist
|
|
14
15
|
- ✅ Json
|
|
15
16
|
- ✅ Import
|
|
16
17
|
- ✅ React
|
|
18
|
+
- ✅ Tailwind CSS
|
|
17
19
|
- JSONC and imports are enabled by default and can be disabled with `json: false` and `imports: false`.
|
|
18
|
-
- TypeScript, React, and gitignore support are opt-in.
|
|
20
|
+
- TypeScript, React, Tailwind CSS, and gitignore support are opt-in.
|
|
21
|
+
|
|
22
|
+
The `stylistic` configuration is always enabled. Perfectionist is enabled by default with JSX prop sorting.
|
|
19
23
|
|
|
20
24
|
# Usage
|
|
21
25
|
|
|
@@ -24,10 +28,14 @@ The following configuration modules are available:
|
|
|
24
28
|
Install the core package and its core ESLint peers:
|
|
25
29
|
|
|
26
30
|
```bash
|
|
27
|
-
pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc eslint-plugin-import jsonc-eslint-parser globals
|
|
31
|
+
pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc eslint-plugin-import-x eslint-plugin-perfectionist jsonc-eslint-parser globals
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
Install the peer packages for any optional modules you enable, such as `typescript-eslint` or the React ESLint plugins.
|
|
34
|
+
Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-tailwindcss`, `tailwindcss`, or the React ESLint plugins.
|
|
35
|
+
|
|
36
|
+
Perfectionist's `sort-jsx-props` rule is enabled by default for JSX props. Use `perfectionist: { preset: 'recommended-alphabetical' }` to enable its full recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
|
|
37
|
+
|
|
38
|
+
Tailwind CSS support targets `eslint-plugin-tailwindcss` 4.x and Tailwind CSS 4.x. Node.js `>=20.19.0` is required when the Tailwind CSS module is enabled.
|
|
31
39
|
|
|
32
40
|
#### Configuration
|
|
33
41
|
|
|
@@ -41,6 +49,11 @@ export default waltz({
|
|
|
41
49
|
json: true,
|
|
42
50
|
ts: true,
|
|
43
51
|
react: true,
|
|
52
|
+
tailwindcss: {
|
|
53
|
+
settings: {
|
|
54
|
+
tailwindcss: { cssConfigPath: './src/styles.css' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
44
57
|
js: { globals: ['browser'] },
|
|
45
58
|
})
|
|
46
59
|
```
|
package/dist/cli.js
CHANGED
|
@@ -1490,9 +1490,9 @@ async function syncVSCodeSettings(cwd = process.cwd()) {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
const eol = source.includes('\r\n') ? '\r\n' : '\n';
|
|
1492
1492
|
const formattingOptions = {
|
|
1493
|
+
eol,
|
|
1493
1494
|
insertSpaces: true,
|
|
1494
1495
|
tabSize: 2,
|
|
1495
|
-
eol,
|
|
1496
1496
|
};
|
|
1497
1497
|
for (const setting of managedSettings) {
|
|
1498
1498
|
source = applyEdits(source, modify(source, setting.path, setting.value, { formattingOptions }));
|
|
@@ -1508,13 +1508,6 @@ async function syncVSCodeSettings(cwd = process.cwd()) {
|
|
|
1508
1508
|
return { changed, filePath };
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
|
-
function printHelp() {
|
|
1512
|
-
console.log(`Usage: eslint-waltz <command>
|
|
1513
|
-
|
|
1514
|
-
Commands:
|
|
1515
|
-
sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
|
|
1516
|
-
`);
|
|
1517
|
-
}
|
|
1518
1511
|
async function main() {
|
|
1519
1512
|
const [command] = process$1.argv.slice(2);
|
|
1520
1513
|
if (command === '--help' || command === '-h') {
|
|
@@ -1531,6 +1524,13 @@ async function main() {
|
|
|
1531
1524
|
? `Updated ${result.filePath}`
|
|
1532
1525
|
: `${result.filePath} is already synchronized`);
|
|
1533
1526
|
}
|
|
1527
|
+
function printHelp() {
|
|
1528
|
+
console.log(`Usage: eslint-waltz <command>
|
|
1529
|
+
|
|
1530
|
+
Commands:
|
|
1531
|
+
sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
|
|
1532
|
+
`);
|
|
1533
|
+
}
|
|
1534
1534
|
main().catch((error) => {
|
|
1535
1535
|
console.error(error instanceof Error ? error.message : error);
|
|
1536
1536
|
process$1.exitCode = 1;
|