pickier 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +62 -39
  2. package/dist/bin/cli.js +10854 -11119
  3. package/dist/plugins/publint.d.ts +11 -0
  4. package/dist/plugins/utils.d.ts +2 -1
  5. package/dist/rules/general/prefer-template.d.ts +0 -6
  6. package/dist/rules/markdown/no-duplicate-heading.d.ts +5 -0
  7. package/dist/rules/publint/bin-file-not-executable.d.ts +2 -0
  8. package/dist/rules/publint/deprecated-field-jsnext.d.ts +2 -0
  9. package/dist/rules/publint/exports-default-should-be-last.d.ts +2 -0
  10. package/dist/rules/publint/exports-fallback-array-use.d.ts +2 -0
  11. package/dist/rules/publint/exports-missing-root-entrypoint.d.ts +2 -0
  12. package/dist/rules/publint/exports-module-should-be-esm.d.ts +2 -0
  13. package/dist/rules/publint/exports-module-should-precede-require.d.ts +2 -0
  14. package/dist/rules/publint/exports-types-should-be-first.d.ts +2 -0
  15. package/dist/rules/publint/exports-value-invalid.d.ts +2 -0
  16. package/dist/rules/publint/field-invalid-value-type.d.ts +2 -0
  17. package/dist/rules/publint/file-does-not-exist.d.ts +2 -0
  18. package/dist/rules/publint/file-invalid-format.d.ts +2 -0
  19. package/dist/rules/publint/has-module-but-no-exports.d.ts +2 -0
  20. package/dist/rules/publint/imports-default-should-be-last.d.ts +2 -0
  21. package/dist/rules/publint/imports-key-invalid.d.ts +2 -0
  22. package/dist/rules/publint/imports-module-should-precede-require.d.ts +2 -0
  23. package/dist/rules/publint/imports-value-invalid.d.ts +2 -0
  24. package/dist/rules/publint/index.d.ts +20 -0
  25. package/dist/rules/publint/local-dependency.d.ts +2 -0
  26. package/dist/rules/publint/module-should-be-esm.d.ts +2 -0
  27. package/dist/rules/publint/use-type.d.ts +2 -0
  28. package/dist/rules/publint/utils.d.ts +73 -0
  29. package/dist/src/index.js +2110 -325
  30. 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 via `pickier run`
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
- # Auto-detect mode (lint + format)
58
- pickier run .
59
-
60
- # Lint everything
61
- pickier run . --mode lint
56
+ # Lint your project
57
+ pickier .
62
58
 
63
- # Auto-fix lint issues (safe fixes only)
64
- pickier run . --mode lint --fix
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 and write changes
70
- pickier run . --mode format --write
62
+ # Format files
63
+ pickier . --format
71
64
 
72
65
  # Check formatting without writing (CI-friendly)
73
- pickier run . --mode format --check
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 run [...globs]`
76
+ ### `pickier [...globs]`
79
77
 
80
- The primary command. Routes to lint or format based on `--mode`.
78
+ Lints by default. Add `--fix` to auto-fix or `--format` to format files.
81
79
 
82
- **Options:**
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
- | `--mode <mode>` | `auto`, `lint`, or `format` | `auto` |
87
- | `--fix` | Apply safe fixes (lint mode) | `false` |
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 (lint mode, reserved) | `false` |
107
+ | `--cache` | Enable cache (reserved) | `false` |
97
108
  | `--verbose` | Verbose output | `false` |
98
109
 
99
- **Examples:**
110
+ ### `pickier format [...globs]`
100
111
 
101
- ```bash
102
- pickier run . --mode auto
103
- pickier run src --mode lint --fix
104
- pickier run "**/*.{ts,tsx,js}" --mode format --write
105
- pickier run . --mode lint --reporter json --max-warnings 0
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
- > **Note:** The legacy `pickier lint` and `pickier format` commands are deprecated and will be removed in a future release. Use `pickier run --mode lint` and `pickier run --mode format` instead.
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 (recommended)
371
+ // Unified run
348
372
  const exitCode = await run(['.'], {
349
- mode: 'auto',
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
- # run the built dist CLI
404
- bun packages/pickier/dist/bin/cli.js run . --mode lint
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> --help
430
+ ./packages/pickier/bin/pickier-<your-platform> .
408
431
  ```
409
432
 
410
433
  ## Testing