pickier 0.1.18 → 0.1.19
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/README.md +62 -39
- package/dist/bin/cli.js +10847 -11113
- package/dist/plugins/publint.d.ts +11 -0
- package/dist/plugins/utils.d.ts +2 -1
- package/dist/rules/general/prefer-template.d.ts +0 -6
- package/dist/rules/markdown/no-duplicate-heading.d.ts +5 -0
- package/dist/rules/publint/bin-file-not-executable.d.ts +2 -0
- package/dist/rules/publint/deprecated-field-jsnext.d.ts +2 -0
- package/dist/rules/publint/exports-default-should-be-last.d.ts +2 -0
- package/dist/rules/publint/exports-fallback-array-use.d.ts +2 -0
- package/dist/rules/publint/exports-missing-root-entrypoint.d.ts +2 -0
- package/dist/rules/publint/exports-module-should-be-esm.d.ts +2 -0
- package/dist/rules/publint/exports-module-should-precede-require.d.ts +2 -0
- package/dist/rules/publint/exports-types-should-be-first.d.ts +2 -0
- package/dist/rules/publint/exports-value-invalid.d.ts +2 -0
- package/dist/rules/publint/field-invalid-value-type.d.ts +2 -0
- package/dist/rules/publint/file-does-not-exist.d.ts +2 -0
- package/dist/rules/publint/file-invalid-format.d.ts +2 -0
- package/dist/rules/publint/has-module-but-no-exports.d.ts +2 -0
- package/dist/rules/publint/imports-default-should-be-last.d.ts +2 -0
- package/dist/rules/publint/imports-key-invalid.d.ts +2 -0
- package/dist/rules/publint/imports-module-should-precede-require.d.ts +2 -0
- package/dist/rules/publint/imports-value-invalid.d.ts +2 -0
- package/dist/rules/publint/index.d.ts +20 -0
- package/dist/rules/publint/local-dependency.d.ts +2 -0
- package/dist/rules/publint/module-should-be-esm.d.ts +2 -0
- package/dist/rules/publint/use-type.d.ts +2 -0
- package/dist/rules/publint/utils.d.ts +73 -0
- package/dist/src/index.js +2100 -316
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
14
|
- Fast CLI with instant feedback
|
|
15
|
-
- Lint and format in one tool
|
|
15
|
+
- Lint and format in one tool
|
|
16
16
|
- Zero-config defaults; simple, typed `pickier.config.ts` when you need it
|
|
17
17
|
- Import organization: splits type/value imports, sorts modules/specifiers, removes unused named imports
|
|
18
18
|
- JSON and config sorting for common files _(e.g. `package.json`, `tsconfig.json`)_
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- 27 rules support auto-fix for common formatting issues
|
|
21
21
|
- Flexible formatting: `indent`, `indentStyle` _(tabs or spaces)_, `quotes`, `semi`, `trimTrailingWhitespace`, `maxConsecutiveBlankLines`, `finalNewline`
|
|
22
22
|
- Smart whitespace cleanup
|
|
23
|
+
- **Package.json validation with 20 publint rules** for correct npm publishing _(exports ordering, file format, module system, etc.)_
|
|
23
24
|
- ESLint-style plugin system for lint rules _(load plugins, enable/disable rules, WIP labeling)_
|
|
24
25
|
- CI-friendly reporters _(stylish, compact, JSON)_ and strict `--max-warnings` control
|
|
25
26
|
- Programmatic API for custom tooling and editor integrations
|
|
@@ -51,61 +52,83 @@ bunx pickier --help
|
|
|
51
52
|
|
|
52
53
|
## Quick Start
|
|
53
54
|
|
|
54
|
-
The unified `pickier run` command handles both linting and formatting:
|
|
55
|
-
|
|
56
55
|
```bash
|
|
57
|
-
#
|
|
58
|
-
pickier
|
|
59
|
-
|
|
60
|
-
# Lint everything
|
|
61
|
-
pickier run . --mode lint
|
|
56
|
+
# Lint your project
|
|
57
|
+
pickier .
|
|
62
58
|
|
|
63
|
-
# Auto-fix lint issues
|
|
64
|
-
pickier
|
|
65
|
-
|
|
66
|
-
# Preview fixes without writing
|
|
67
|
-
pickier run . --mode lint --fix --dry-run --verbose
|
|
59
|
+
# Auto-fix lint issues
|
|
60
|
+
pickier . --fix
|
|
68
61
|
|
|
69
|
-
# Format
|
|
70
|
-
pickier
|
|
62
|
+
# Format files
|
|
63
|
+
pickier . --format
|
|
71
64
|
|
|
72
65
|
# Check formatting without writing (CI-friendly)
|
|
73
|
-
pickier
|
|
66
|
+
pickier . --format --check
|
|
67
|
+
|
|
68
|
+
# Preview fixes without writing
|
|
69
|
+
pickier . --fix --dry-run
|
|
74
70
|
```
|
|
75
71
|
|
|
72
|
+
By default, `pickier` lints. Use `--fix` to auto-fix problems or `--format` to format files.
|
|
73
|
+
|
|
76
74
|
## CLI
|
|
77
75
|
|
|
78
|
-
### `pickier
|
|
76
|
+
### `pickier [...globs]`
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
Lints by default. Add `--fix` to auto-fix or `--format` to format files.
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
```bash
|
|
81
|
+
# These are equivalent:
|
|
82
|
+
pickier .
|
|
83
|
+
pickier lint .
|
|
84
|
+
|
|
85
|
+
# These are equivalent:
|
|
86
|
+
pickier . --fix
|
|
87
|
+
pickier lint . --fix
|
|
88
|
+
|
|
89
|
+
# These are equivalent:
|
|
90
|
+
pickier . --format
|
|
91
|
+
pickier format . --write
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `pickier lint [...globs]`
|
|
95
|
+
|
|
96
|
+
Lint files.
|
|
83
97
|
|
|
84
98
|
| Flag | Description | Default |
|
|
85
99
|
|------|-------------|---------|
|
|
86
|
-
| `--
|
|
87
|
-
| `--
|
|
88
|
-
| `--dry-run` | Simulate fixes without writing (lint mode) | `false` |
|
|
89
|
-
| `--write` | Write changes to files (format mode) | `false` |
|
|
90
|
-
| `--check` | Check without writing, non-zero exit on differences (format mode) | `false` |
|
|
100
|
+
| `--fix` | Auto-fix problems | `false` |
|
|
101
|
+
| `--dry-run` | Simulate fixes without writing | `false` |
|
|
91
102
|
| `--max-warnings <n>` | Fail if warnings exceed _n_ | `-1` |
|
|
92
103
|
| `--reporter <name>` | `stylish`, `json`, or `compact` | `stylish` |
|
|
93
104
|
| `--ext <exts>` | Comma-separated extensions (overrides config) | — |
|
|
94
105
|
| `--ignore-path <file>` | Optional ignore file (e.g. `.gitignore`) | — |
|
|
95
106
|
| `--config <path>` | Path to pickier config file | — |
|
|
96
|
-
| `--cache` | Enable cache (
|
|
107
|
+
| `--cache` | Enable cache (reserved) | `false` |
|
|
97
108
|
| `--verbose` | Verbose output | `false` |
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
### `pickier format [...globs]`
|
|
100
111
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
Format files.
|
|
113
|
+
|
|
114
|
+
| Flag | Description | Default |
|
|
115
|
+
|------|-------------|---------|
|
|
116
|
+
| `--write` | Write changes to files | `false` |
|
|
117
|
+
| `--check` | Check without writing, non-zero exit on differences (CI-friendly) | `false` |
|
|
118
|
+
| `--ext <exts>` | Comma-separated extensions (overrides config) | — |
|
|
119
|
+
| `--ignore-path <file>` | Optional ignore file (e.g. `.gitignore`) | — |
|
|
120
|
+
| `--config <path>` | Path to pickier config file | — |
|
|
121
|
+
| `--verbose` | Verbose output | `false` |
|
|
107
122
|
|
|
108
|
-
|
|
123
|
+
### `pickier run [...globs]`
|
|
124
|
+
|
|
125
|
+
Unified command that routes to lint or format based on `--mode`.
|
|
126
|
+
|
|
127
|
+
| Flag | Description | Default |
|
|
128
|
+
|------|-------------|---------|
|
|
129
|
+
| `--mode <mode>` | `auto`, `lint`, or `format` | `auto` |
|
|
130
|
+
|
|
131
|
+
Accepts all flags from both `lint` and `format`. Useful for scripts that need explicit mode control.
|
|
109
132
|
|
|
110
133
|
## Configuration
|
|
111
134
|
|
|
@@ -182,6 +205,7 @@ Pickier supports an ESLint-style plugin system for lint rules organized into foc
|
|
|
182
205
|
| `ts/` | TypeScript-specific rules (type safety, formatting) | 13+ |
|
|
183
206
|
| `regexp/` | Regular expression safety | 3+ |
|
|
184
207
|
| `markdown/` | Markdown documentation linting | 53+ |
|
|
208
|
+
| `publint/` | Package.json validation for npm publishing ([publint](https://publint.dev) rules) | 20 |
|
|
185
209
|
| `lockfile/` | Lock file validation | 5+ |
|
|
186
210
|
|
|
187
211
|
Configure rules via `pluginRules`:
|
|
@@ -344,11 +368,10 @@ Call Pickier from code (Bun/Node) for custom tooling, editors, or pipelines.
|
|
|
344
368
|
import type { RunOptions } from 'pickier'
|
|
345
369
|
import { config, defaultConfig, run, runLint, runFormat, lintText } from 'pickier'
|
|
346
370
|
|
|
347
|
-
// Unified run
|
|
371
|
+
// Unified run
|
|
348
372
|
const exitCode = await run(['.'], {
|
|
349
|
-
mode: '
|
|
373
|
+
mode: 'lint',
|
|
350
374
|
fix: true,
|
|
351
|
-
verbose: false,
|
|
352
375
|
})
|
|
353
376
|
|
|
354
377
|
// Lint specific directories
|
|
@@ -400,11 +423,11 @@ Try the CLI locally without publishing:
|
|
|
400
423
|
# run the TS entry directly
|
|
401
424
|
bun packages/pickier/bin/cli.ts --help
|
|
402
425
|
|
|
403
|
-
#
|
|
404
|
-
bun packages/pickier/
|
|
426
|
+
# lint the current directory
|
|
427
|
+
bun packages/pickier/bin/cli.ts .
|
|
405
428
|
|
|
406
429
|
# or the compiled native binary (after compile)
|
|
407
|
-
./packages/pickier/bin/pickier-<your-platform>
|
|
430
|
+
./packages/pickier/bin/pickier-<your-platform> .
|
|
408
431
|
```
|
|
409
432
|
|
|
410
433
|
## Testing
|