pickier 0.1.20 → 0.1.22

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 (294) hide show
  1. package/README.md +80 -459
  2. package/dist/ast.d.ts +4 -15
  3. package/dist/bin/cli.js +22521 -17217
  4. package/dist/config.d.ts +1 -1
  5. package/dist/format.d.ts +1 -1
  6. package/dist/formatter.d.ts +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/linter.d.ts +3 -3
  9. package/dist/plugins/eslint.d.ts +1 -1
  10. package/dist/plugins/general.d.ts +1 -1
  11. package/dist/plugins/index.d.ts +1 -1
  12. package/dist/plugins/lockfile.d.ts +1 -1
  13. package/dist/plugins/markdown.d.ts +1 -1
  14. package/dist/plugins/node.d.ts +1 -1
  15. package/dist/plugins/perfectionist.d.ts +1 -1
  16. package/dist/plugins/pickier.d.ts +1 -1
  17. package/dist/plugins/publint.d.ts +1 -2
  18. package/dist/plugins/quality.d.ts +1 -1
  19. package/dist/plugins/regexp.d.ts +1 -1
  20. package/dist/plugins/shell.d.ts +2 -0
  21. package/dist/plugins/spell.d.ts +3 -0
  22. package/dist/plugins/style.d.ts +1 -1
  23. package/dist/plugins/ts.d.ts +1 -1
  24. package/dist/plugins/unused-imports.d.ts +1 -1
  25. package/dist/plugins/utils.d.ts +2 -1
  26. package/dist/rules/general/_template-tracking.d.ts +31 -0
  27. package/dist/rules/general/array-callback-return.d.ts +1 -1
  28. package/dist/rules/general/constructor-super.d.ts +1 -1
  29. package/dist/rules/general/for-direction.d.ts +1 -1
  30. package/dist/rules/general/getter-return.d.ts +1 -1
  31. package/dist/rules/general/no-async-promise-executor.d.ts +1 -1
  32. package/dist/rules/general/no-compare-neg-zero.d.ts +1 -1
  33. package/dist/rules/general/no-cond-assign.d.ts +1 -1
  34. package/dist/rules/general/no-const-assign.d.ts +1 -1
  35. package/dist/rules/general/no-constant-condition.d.ts +1 -1
  36. package/dist/rules/general/no-constructor-return.d.ts +1 -1
  37. package/dist/rules/general/no-dupe-class-members.d.ts +1 -1
  38. package/dist/rules/general/no-dupe-keys.d.ts +1 -1
  39. package/dist/rules/general/no-duplicate-case.d.ts +1 -1
  40. package/dist/rules/general/no-empty-pattern.d.ts +1 -1
  41. package/dist/rules/general/no-fallthrough.d.ts +1 -1
  42. package/dist/rules/general/no-irregular-whitespace.d.ts +1 -1
  43. package/dist/rules/general/no-loss-of-precision.d.ts +1 -1
  44. package/dist/rules/general/no-new.d.ts +1 -1
  45. package/dist/rules/general/no-promise-executor-return.d.ts +1 -1
  46. package/dist/rules/general/no-redeclare.d.ts +1 -1
  47. package/dist/rules/general/no-regex-spaces.d.ts +1 -1
  48. package/dist/rules/general/no-self-assign.d.ts +1 -1
  49. package/dist/rules/general/no-self-compare.d.ts +1 -1
  50. package/dist/rules/general/no-sparse-arrays.d.ts +1 -1
  51. package/dist/rules/general/no-undef.d.ts +1 -1
  52. package/dist/rules/general/no-unreachable.d.ts +1 -1
  53. package/dist/rules/general/no-unsafe-negation.d.ts +1 -1
  54. package/dist/rules/general/no-unused-vars.d.ts +1 -1
  55. package/dist/rules/general/no-useless-catch.d.ts +1 -1
  56. package/dist/rules/general/prefer-const.d.ts +1 -1
  57. package/dist/rules/general/prefer-object-spread.d.ts +1 -1
  58. package/dist/rules/general/prefer-template.d.ts +1 -1
  59. package/dist/rules/general/use-isnan.d.ts +1 -1
  60. package/dist/rules/general/valid-typeof.d.ts +1 -1
  61. package/dist/rules/imports/first.d.ts +1 -1
  62. package/dist/rules/imports/import-dedupe.d.ts +1 -1
  63. package/dist/rules/imports/named.d.ts +1 -1
  64. package/dist/rules/imports/no-cycle.d.ts +1 -1
  65. package/dist/rules/imports/no-duplicate-imports.d.ts +1 -1
  66. package/dist/rules/imports/no-import-dist.d.ts +1 -1
  67. package/dist/rules/imports/no-import-node-modules-by-path.d.ts +1 -1
  68. package/dist/rules/imports/no-unresolved.d.ts +1 -1
  69. package/dist/rules/lockfile/index.d.ts +1 -1
  70. package/dist/rules/lockfile/parser.d.ts +1 -1
  71. package/dist/rules/lockfile/validate-host.d.ts +1 -2
  72. package/dist/rules/lockfile/validate-https.d.ts +1 -1
  73. package/dist/rules/lockfile/validate-integrity.d.ts +1 -1
  74. package/dist/rules/lockfile/validate-package-names.d.ts +1 -1
  75. package/dist/rules/lockfile/validate-scheme.d.ts +1 -1
  76. package/dist/rules/markdown/_fence-tracking.d.ts +32 -0
  77. package/dist/rules/markdown/_shared.d.ts +9 -0
  78. package/dist/rules/markdown/blanks-around-fences.d.ts +1 -1
  79. package/dist/rules/markdown/blanks-around-headings.d.ts +1 -1
  80. package/dist/rules/markdown/blanks-around-lists.d.ts +1 -1
  81. package/dist/rules/markdown/blanks-around-tables.d.ts +1 -1
  82. package/dist/rules/markdown/code-block-style.d.ts +1 -1
  83. package/dist/rules/markdown/code-fence-style.d.ts +1 -1
  84. package/dist/rules/markdown/commands-show-output.d.ts +1 -1
  85. package/dist/rules/markdown/descriptive-link-text.d.ts +1 -1
  86. package/dist/rules/markdown/emphasis-style.d.ts +1 -1
  87. package/dist/rules/markdown/fenced-code-language.d.ts +1 -1
  88. package/dist/rules/markdown/first-line-heading.d.ts +1 -1
  89. package/dist/rules/markdown/heading-increment.d.ts +1 -1
  90. package/dist/rules/markdown/heading-start-left.d.ts +1 -1
  91. package/dist/rules/markdown/heading-style.d.ts +1 -1
  92. package/dist/rules/markdown/hr-style.d.ts +1 -1
  93. package/dist/rules/markdown/line-length.d.ts +1 -1
  94. package/dist/rules/markdown/link-fragments.d.ts +1 -1
  95. package/dist/rules/markdown/link-image-reference-definitions.d.ts +1 -1
  96. package/dist/rules/markdown/link-image-style.d.ts +1 -1
  97. package/dist/rules/markdown/list-indent.d.ts +1 -1
  98. package/dist/rules/markdown/list-marker-space.d.ts +1 -1
  99. package/dist/rules/markdown/no-alt-text.d.ts +1 -1
  100. package/dist/rules/markdown/no-bare-urls.d.ts +1 -1
  101. package/dist/rules/markdown/no-blanks-blockquote.d.ts +1 -1
  102. package/dist/rules/markdown/no-duplicate-heading.d.ts +1 -1
  103. package/dist/rules/markdown/no-emphasis-as-heading.d.ts +5 -1
  104. package/dist/rules/markdown/no-empty-links.d.ts +1 -1
  105. package/dist/rules/markdown/no-hard-tabs.d.ts +1 -1
  106. package/dist/rules/markdown/no-inline-html.d.ts +1 -1
  107. package/dist/rules/markdown/no-missing-space-atx.d.ts +1 -1
  108. package/dist/rules/markdown/no-missing-space-closed-atx.d.ts +1 -1
  109. package/dist/rules/markdown/no-multiple-blanks.d.ts +1 -1
  110. package/dist/rules/markdown/no-multiple-space-atx.d.ts +1 -1
  111. package/dist/rules/markdown/no-multiple-space-blockquote.d.ts +1 -1
  112. package/dist/rules/markdown/no-multiple-space-closed-atx.d.ts +1 -1
  113. package/dist/rules/markdown/no-reversed-links.d.ts +1 -1
  114. package/dist/rules/markdown/no-space-in-code.d.ts +1 -1
  115. package/dist/rules/markdown/no-space-in-emphasis.d.ts +1 -1
  116. package/dist/rules/markdown/no-space-in-links.d.ts +1 -1
  117. package/dist/rules/markdown/no-trailing-punctuation.d.ts +1 -1
  118. package/dist/rules/markdown/no-trailing-spaces.d.ts +1 -1
  119. package/dist/rules/markdown/ol-prefix.d.ts +1 -1
  120. package/dist/rules/markdown/proper-names.d.ts +1 -1
  121. package/dist/rules/markdown/reference-links-images.d.ts +10 -1
  122. package/dist/rules/markdown/required-headings.d.ts +1 -1
  123. package/dist/rules/markdown/single-title.d.ts +1 -1
  124. package/dist/rules/markdown/single-trailing-newline.d.ts +1 -1
  125. package/dist/rules/markdown/strong-style.d.ts +1 -1
  126. package/dist/rules/markdown/table-column-count.d.ts +1 -1
  127. package/dist/rules/markdown/table-column-style.d.ts +1 -1
  128. package/dist/rules/markdown/table-pipe-style.d.ts +1 -1
  129. package/dist/rules/markdown/ul-indent.d.ts +10 -1
  130. package/dist/rules/markdown/ul-style.d.ts +1 -1
  131. package/dist/rules/node/prefer-global-buffer.d.ts +1 -1
  132. package/dist/rules/node/prefer-global-process.d.ts +1 -1
  133. package/dist/rules/publint/bin-file-not-executable.d.ts +1 -1
  134. package/dist/rules/publint/deprecated-field-jsnext.d.ts +1 -1
  135. package/dist/rules/publint/exports-default-should-be-last.d.ts +1 -1
  136. package/dist/rules/publint/exports-fallback-array-use.d.ts +1 -1
  137. package/dist/rules/publint/exports-missing-root-entrypoint.d.ts +1 -1
  138. package/dist/rules/publint/exports-module-should-be-esm.d.ts +1 -1
  139. package/dist/rules/publint/exports-module-should-precede-require.d.ts +1 -1
  140. package/dist/rules/publint/exports-types-should-be-first.d.ts +1 -1
  141. package/dist/rules/publint/exports-value-invalid.d.ts +1 -1
  142. package/dist/rules/publint/field-invalid-value-type.d.ts +1 -1
  143. package/dist/rules/publint/file-does-not-exist.d.ts +1 -1
  144. package/dist/rules/publint/file-invalid-format.d.ts +1 -1
  145. package/dist/rules/publint/has-module-but-no-exports.d.ts +1 -1
  146. package/dist/rules/publint/imports-default-should-be-last.d.ts +1 -1
  147. package/dist/rules/publint/imports-key-invalid.d.ts +1 -1
  148. package/dist/rules/publint/imports-module-should-precede-require.d.ts +1 -1
  149. package/dist/rules/publint/imports-value-invalid.d.ts +1 -1
  150. package/dist/rules/publint/index.d.ts +13 -11
  151. package/dist/rules/publint/local-dependency.d.ts +1 -1
  152. package/dist/rules/publint/module-should-be-esm.d.ts +1 -1
  153. package/dist/rules/publint/use-type.d.ts +1 -1
  154. package/dist/rules/publint/utils.d.ts +2 -2
  155. package/dist/rules/quality/complexity.d.ts +1 -1
  156. package/dist/rules/quality/default-case.d.ts +1 -1
  157. package/dist/rules/quality/eqeqeq.d.ts +1 -1
  158. package/dist/rules/quality/max-depth.d.ts +1 -1
  159. package/dist/rules/quality/max-lines-per-function.d.ts +1 -1
  160. package/dist/rules/quality/no-alert.d.ts +1 -1
  161. package/dist/rules/quality/no-await-in-loop.d.ts +1 -1
  162. package/dist/rules/quality/no-caller.d.ts +1 -1
  163. package/dist/rules/quality/no-case-declarations.d.ts +1 -1
  164. package/dist/rules/quality/no-else-return.d.ts +1 -1
  165. package/dist/rules/quality/no-empty-function.d.ts +1 -1
  166. package/dist/rules/quality/no-empty.d.ts +1 -1
  167. package/dist/rules/quality/no-eval.d.ts +1 -1
  168. package/dist/rules/quality/no-extend-native.d.ts +1 -1
  169. package/dist/rules/quality/no-extra-boolean-cast.d.ts +1 -1
  170. package/dist/rules/quality/no-global-assign.d.ts +1 -1
  171. package/dist/rules/quality/no-implied-eval.d.ts +1 -1
  172. package/dist/rules/quality/no-iterator.d.ts +1 -1
  173. package/dist/rules/quality/no-lonely-if.d.ts +1 -1
  174. package/dist/rules/quality/no-new-func.d.ts +1 -1
  175. package/dist/rules/quality/no-new-wrappers.d.ts +1 -1
  176. package/dist/rules/quality/no-new.d.ts +1 -1
  177. package/dist/rules/quality/no-octal.d.ts +1 -1
  178. package/dist/rules/quality/no-param-reassign.d.ts +1 -1
  179. package/dist/rules/quality/no-proto.d.ts +1 -1
  180. package/dist/rules/quality/no-return-assign.d.ts +1 -1
  181. package/dist/rules/quality/no-sequences.d.ts +1 -1
  182. package/dist/rules/quality/no-shadow.d.ts +1 -1
  183. package/dist/rules/quality/no-throw-literal.d.ts +1 -1
  184. package/dist/rules/quality/no-use-before-define.d.ts +1 -1
  185. package/dist/rules/quality/no-useless-call.d.ts +1 -1
  186. package/dist/rules/quality/no-useless-concat.d.ts +1 -1
  187. package/dist/rules/quality/no-useless-escape.d.ts +1 -1
  188. package/dist/rules/quality/no-useless-rename.d.ts +1 -1
  189. package/dist/rules/quality/no-useless-return.d.ts +1 -1
  190. package/dist/rules/quality/no-var.d.ts +1 -1
  191. package/dist/rules/quality/no-with.d.ts +1 -1
  192. package/dist/rules/quality/prefer-arrow-callback.d.ts +1 -1
  193. package/dist/rules/quality/require-await.d.ts +1 -1
  194. package/dist/rules/regexp/no-super-linear-backtracking.d.ts +1 -1
  195. package/dist/rules/regexp/no-unused-capturing-group.d.ts +1 -1
  196. package/dist/rules/regexp/no-useless-lazy.d.ts +1 -1
  197. package/dist/rules/shell/_shared.d.ts +24 -0
  198. package/dist/rules/shell/command-substitution.d.ts +6 -0
  199. package/dist/rules/shell/consistent-case-terminators.d.ts +9 -0
  200. package/dist/rules/shell/function-style.d.ts +6 -0
  201. package/dist/rules/shell/heredoc-indent.d.ts +7 -0
  202. package/dist/rules/shell/indent.d.ts +2 -0
  203. package/dist/rules/shell/keyword-spacing.d.ts +10 -0
  204. package/dist/rules/shell/no-broken-redirect.d.ts +7 -0
  205. package/dist/rules/shell/no-cd-without-check.d.ts +6 -0
  206. package/dist/rules/shell/no-eval.d.ts +6 -0
  207. package/dist/rules/shell/no-exit-in-subshell.d.ts +7 -0
  208. package/dist/rules/shell/no-ls-parsing.d.ts +7 -0
  209. package/dist/rules/shell/no-trailing-semicolons.d.ts +6 -0
  210. package/dist/rules/shell/no-trailing-whitespace.d.ts +5 -0
  211. package/dist/rules/shell/no-useless-cat.d.ts +6 -0
  212. package/dist/rules/shell/no-variable-in-single-quotes.d.ts +7 -0
  213. package/dist/rules/shell/operator-spacing.d.ts +11 -0
  214. package/dist/rules/shell/prefer-double-brackets.d.ts +6 -0
  215. package/dist/rules/shell/prefer-printf.d.ts +6 -0
  216. package/dist/rules/shell/quote-variables.d.ts +2 -0
  217. package/dist/rules/shell/set-options.d.ts +8 -0
  218. package/dist/rules/shell/shebang.d.ts +2 -0
  219. package/dist/rules/sort/exports.d.ts +1 -1
  220. package/dist/rules/sort/heritage-clauses.d.ts +1 -1
  221. package/dist/rules/sort/imports.d.ts +1 -1
  222. package/dist/rules/sort/keys.d.ts +1 -1
  223. package/dist/rules/sort/named-imports.d.ts +1 -1
  224. package/dist/rules/sort/objects.d.ts +1 -1
  225. package/dist/rules/sort/tailwind-classes.d.ts +5 -0
  226. package/dist/rules/style/array-bracket-spacing.d.ts +1 -1
  227. package/dist/rules/style/arrow-parens.d.ts +1 -1
  228. package/dist/rules/style/arrow-spacing.d.ts +1 -1
  229. package/dist/rules/style/block-spacing.d.ts +1 -1
  230. package/dist/rules/style/brace-style.d.ts +1 -1
  231. package/dist/rules/style/comma-dangle.d.ts +1 -1
  232. package/dist/rules/style/comma-spacing.d.ts +1 -1
  233. package/dist/rules/style/comma-style.d.ts +1 -1
  234. package/dist/rules/style/computed-property-spacing.d.ts +1 -1
  235. package/dist/rules/style/consistent-chaining.d.ts +1 -1
  236. package/dist/rules/style/consistent-list-newline.d.ts +1 -1
  237. package/dist/rules/style/curly.d.ts +1 -1
  238. package/dist/rules/style/dot-location.d.ts +1 -1
  239. package/dist/rules/style/function-call-spacing.d.ts +1 -1
  240. package/dist/rules/style/generator-star-spacing.d.ts +1 -1
  241. package/dist/rules/style/if-newline.d.ts +1 -1
  242. package/dist/rules/style/indent-binary-ops.d.ts +1 -1
  243. package/dist/rules/style/indent-unindent.d.ts +1 -1
  244. package/dist/rules/style/key-spacing.d.ts +1 -1
  245. package/dist/rules/style/keyword-spacing.d.ts +1 -1
  246. package/dist/rules/style/lines-between-class-members.d.ts +1 -1
  247. package/dist/rules/style/max-statements-per-line.d.ts +1 -1
  248. package/dist/rules/style/multiline-ternary.d.ts +1 -1
  249. package/dist/rules/style/new-parens.d.ts +1 -1
  250. package/dist/rules/style/no-extra-parens.d.ts +1 -1
  251. package/dist/rules/style/no-floating-decimal.d.ts +1 -1
  252. package/dist/rules/style/no-mixed-operators.d.ts +1 -1
  253. package/dist/rules/style/no-mixed-spaces-and-tabs.d.ts +1 -1
  254. package/dist/rules/style/no-multi-spaces.d.ts +1 -1
  255. package/dist/rules/style/no-multiple-empty-lines.d.ts +1 -1
  256. package/dist/rules/style/no-tabs.d.ts +1 -1
  257. package/dist/rules/style/no-trailing-spaces.d.ts +1 -1
  258. package/dist/rules/style/no-whitespace-before-property.d.ts +1 -1
  259. package/dist/rules/style/object-curly-spacing.d.ts +1 -1
  260. package/dist/rules/style/operator-linebreak.d.ts +1 -1
  261. package/dist/rules/style/padded-blocks.d.ts +1 -1
  262. package/dist/rules/style/quote-props.d.ts +1 -1
  263. package/dist/rules/style/rest-spread-spacing.d.ts +1 -1
  264. package/dist/rules/style/semi-spacing.d.ts +1 -1
  265. package/dist/rules/style/space-before-blocks.d.ts +1 -1
  266. package/dist/rules/style/space-before-function-paren.d.ts +1 -1
  267. package/dist/rules/style/space-in-parens.d.ts +1 -1
  268. package/dist/rules/style/space-infix-ops.d.ts +1 -1
  269. package/dist/rules/style/space-unary-ops.d.ts +1 -1
  270. package/dist/rules/style/spaced-comment.d.ts +1 -1
  271. package/dist/rules/style/switch-colon-spacing.d.ts +1 -1
  272. package/dist/rules/style/template-curly-spacing.d.ts +1 -1
  273. package/dist/rules/style/template-tag-spacing.d.ts +1 -1
  274. package/dist/rules/style/top-level-function.d.ts +1 -1
  275. package/dist/rules/style/wrap-iife.d.ts +1 -1
  276. package/dist/rules/style/yield-star-spacing.d.ts +1 -1
  277. package/dist/rules/ts/member-delimiter-style.d.ts +1 -1
  278. package/dist/rules/ts/no-explicit-any.d.ts +1 -1
  279. package/dist/rules/ts/no-floating-promises.d.ts +1 -1
  280. package/dist/rules/ts/no-misused-promises.d.ts +1 -1
  281. package/dist/rules/ts/no-require-imports.d.ts +1 -1
  282. package/dist/rules/ts/no-top-level-await.d.ts +1 -1
  283. package/dist/rules/ts/no-ts-export-equal.d.ts +1 -1
  284. package/dist/rules/ts/no-unsafe-assignment.d.ts +1 -1
  285. package/dist/rules/ts/prefer-nullish-coalescing.d.ts +1 -1
  286. package/dist/rules/ts/prefer-optional-chain.d.ts +1 -1
  287. package/dist/rules/ts/type-annotation-spacing.d.ts +1 -1
  288. package/dist/rules/ts/type-generic-spacing.d.ts +1 -1
  289. package/dist/rules/ts/type-named-tuple-spacing.d.ts +1 -1
  290. package/dist/run.d.ts +1 -1
  291. package/dist/src/index.js +20387 -17154
  292. package/dist/types.d.ts +21 -4
  293. package/dist/utils.d.ts +36 -11
  294. package/package.json +16 -8
package/README.md CHANGED
@@ -1,488 +1,109 @@
1
- <p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
1
+ # pickier
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![GitHub Actions][github-actions-src]][github-actions-href]
5
- <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
6
- <!-- [![Codecov][codecov-src]][codecov-href] -->
3
+ Format, lint, and more in a fraction of a second.
7
4
 
8
- # Pickier
9
-
10
- > Fast linting and formatting. Minimal defaults. Extensible. Built for speed.
11
-
12
- ## Features
13
-
14
- - Fast CLI with instant feedback
15
- - Lint and format in one tool
16
- - Zero-config defaults; simple, typed `pickier.config.ts` when you need it
17
- - Import organization: splits type/value imports, sorts modules/specifiers, removes unused named imports
18
- - JSON and config sorting for common files _(e.g. `package.json`, `tsconfig.json`)_
19
- - **Markdown linting with 53+ rules** for documentation quality _(headings, lists, links, code blocks, tables, etc.)_
20
- - 27 rules support auto-fix for common formatting issues
21
- - Flexible formatting: `indent`, `indentStyle` _(tabs or spaces)_, `quotes`, `semi`, `trimTrailingWhitespace`, `maxConsecutiveBlankLines`, `finalNewline`
22
- - Smart whitespace cleanup
23
- - **Package.json validation with 20 publint rules** for correct npm publishing _(exports ordering, file format, module system, etc.)_
24
- - ESLint-style plugin system for lint rules _(load plugins, enable/disable rules, WIP labeling)_
25
- - CI-friendly reporters _(stylish, compact, JSON)_ and strict `--max-warnings` control
26
- - Programmatic API for custom tooling and editor integrations
27
-
28
- ## Install
5
+ ## Installation
29
6
 
30
7
  ```bash
31
- # as a dev dependency
32
8
  bun add -D pickier
33
-
34
- # or
35
- npm i -D pickier
36
-
37
- # or
38
- pnpm add -D pickier
39
-
40
- # or
41
- yarn add -D pickier
42
9
  ```
43
10
 
44
- You can also run it directly via npx without installing:
45
-
46
11
  ```bash
47
- npx pickier --help
48
-
49
- # or
50
- bunx pickier --help
51
- ```
52
-
53
- ## Quick Start
54
-
55
- ```bash
56
- # Lint your project
57
- pickier .
58
-
59
- # Auto-fix lint issues
60
- pickier . --fix
61
-
62
- # Format files
63
- pickier . --format
64
-
65
- # Check formatting without writing (CI-friendly)
66
- pickier . --format --check
67
-
68
- # Preview fixes without writing
69
- pickier . --fix --dry-run
12
+ npm install -D pickier
70
13
  ```
71
14
 
72
- By default, `pickier` lints. Use `--fix` to auto-fix problems or `--format` to format files.
73
-
74
- ## CLI
75
-
76
- ### `pickier [...globs]`
77
-
78
- Lints by default. Add `--fix` to auto-fix or `--format` to format files.
15
+ ## Usage
79
16
 
80
17
  ```bash
81
- # These are equivalent:
82
- pickier .
83
- pickier lint .
84
-
85
- # These are equivalent:
86
- pickier . --fix
18
+ # Lint files
87
19
  pickier lint . --fix
88
20
 
89
- # These are equivalent:
90
- pickier . --format
21
+ # Format files
91
22
  pickier format . --write
92
- ```
93
-
94
- ### `pickier lint [...globs]`
95
-
96
- Lint files.
97
-
98
- | Flag | Description | Default |
99
- |------|-------------|---------|
100
- | `--fix` | Auto-fix problems | `false` |
101
- | `--dry-run` | Simulate fixes without writing | `false` |
102
- | `--max-warnings <n>` | Fail if warnings exceed _n_ | `-1` |
103
- | `--reporter <name>` | `stylish`, `json`, or `compact` | `stylish` |
104
- | `--ext <exts>` | Comma-separated extensions (overrides config) | — |
105
- | `--ignore-path <file>` | Optional ignore file (e.g. `.gitignore`) | — |
106
- | `--config <path>` | Path to pickier config file | — |
107
- | `--cache` | Enable cache (reserved) | `false` |
108
- | `--verbose` | Verbose output | `false` |
109
-
110
- ### `pickier format [...globs]`
111
-
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` |
122
-
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.
132
-
133
- ## Configuration
134
-
135
- Pickier works out-of-the-box. To customize, create `pickier.config.ts` in your project root. All fields are optional.
136
-
137
- ```ts
138
- // pickier.config.ts
139
- import type { PickierConfig } from 'pickier'
140
-
141
- const config: PickierConfig = {
142
- verbose: false,
143
- ignores: ['**/node_modules/**', '**/dist/**', '**/build/**'],
144
-
145
- lint: {
146
- // which extensions to lint ('.ts' or 'ts' both supported)
147
- extensions: ['ts', 'js'],
148
- // stylish | json | compact
149
- reporter: 'stylish',
150
- // reserved (not used yet)
151
- cache: false,
152
- // -1 disables, otherwise fail when warnings > maxWarnings
153
- maxWarnings: -1,
154
- },
155
-
156
- format: {
157
- // which extensions to format
158
- extensions: ['ts', 'js', 'json', 'md', 'yaml', 'yml'],
159
- trimTrailingWhitespace: true,
160
- maxConsecutiveBlankLines: 1,
161
- // one | two | none
162
- finalNewline: 'one',
163
- // indentation width (code files)
164
- indent: 2,
165
- // 'spaces' | 'tabs'
166
- indentStyle: 'spaces',
167
- // preferred string quotes: 'single' | 'double'
168
- quotes: 'single',
169
- // when true, safely remove stylistic semicolons
170
- // (never touches for(;;) headers; removes duplicate/empty semicolons)
171
- semi: false,
172
- },
173
-
174
- rules: {
175
- // 'off' | 'warn' | 'error'
176
- noDebugger: 'error',
177
- noConsole: 'warn',
178
- },
179
-
180
- // Plugin rules for markdown, style, sorting, etc.
181
- pluginRules: {
182
- // Markdown linting (53+ rules available)
183
- 'markdown/heading-increment': 'error',
184
- 'markdown/no-trailing-spaces': 'error',
185
- 'markdown/fenced-code-language': 'error',
186
- 'markdown/no-duplicate-heading': 'warn',
187
- },
188
- }
189
-
190
- export default config
191
- ```
192
-
193
- ### Plugin System
194
-
195
- Pickier supports an ESLint-style plugin system for lint rules organized into focused categories.
196
-
197
- **Available Plugins:**
198
-
199
- | Plugin | Description | Rules |
200
- |--------|-------------|-------|
201
- | `pickier/` | Sorting, import organization, and core checks | 17+ |
202
- | `general/` | Error detection and possible problems | 35+ |
203
- | `quality/` | Best practices and code quality | 40+ |
204
- | `style/` | Code style enforcement (spacing, punctuation, line breaks, etc.) | 50+ |
205
- | `ts/` | TypeScript-specific rules (type safety, formatting) | 13+ |
206
- | `regexp/` | Regular expression safety | 3+ |
207
- | `markdown/` | Markdown documentation linting | 53+ |
208
- | `publint/` | Package.json validation for npm publishing ([publint](https://publint.dev) rules) | 20 |
209
- | `lockfile/` | Lock file validation | 5+ |
210
-
211
- Configure rules via `pluginRules`:
212
-
213
- ```ts
214
- pluginRules: {
215
- 'pluginName/ruleId': 'off' | 'warn' | 'error' | ['warn', options],
216
- }
217
- ```
218
-
219
- **Custom Plugin Example:**
220
-
221
- ```ts
222
- // sample-plugin.ts
223
- import type { PickierPlugin, RuleContext } from 'pickier'
224
-
225
- export const samplePlugin: PickierPlugin = {
226
- name: 'sample',
227
- rules: {
228
- 'no-todo': {
229
- meta: { docs: 'disallow TODO comments', recommended: true },
230
- check(content: string, ctx: RuleContext) {
231
- const issues = []
232
- const lines = content.split(/\r?\n/)
233
- for (let i = 0; i < lines.length; i++) {
234
- const col = lines[i].indexOf('TODO')
235
- if (col !== -1) {
236
- issues.push({
237
- filePath: ctx.filePath,
238
- line: i + 1,
239
- column: col + 1,
240
- ruleId: 'sample/no-todo',
241
- message: 'Unexpected TODO comment.',
242
- severity: 'warning',
243
- })
244
- }
245
- }
246
- return issues
247
- },
248
- },
249
- 'experimental-check': {
250
- meta: { wip: true },
251
- check() {
252
- // not implemented yet — WIP rules surface errors with a :wip-error suffix
253
- throw new Error('WIP rule')
254
- },
255
- },
256
- },
257
- }
258
- ```
259
-
260
- **Register the plugin in your config:**
261
-
262
- ```ts
263
- // pickier.config.ts
264
- import type { PickierConfig } from 'pickier'
265
- import { samplePlugin } from './sample-plugin'
266
-
267
- const config: PickierConfig = {
268
- plugins: [samplePlugin],
269
- pluginRules: {
270
- 'sample/no-todo': 'warn',
271
- 'sample/experimental-check': 'error',
272
- },
273
- }
274
-
275
- export default config
276
- ```
277
-
278
- ### Formatting Details
279
-
280
- **Semicolons**
281
-
282
- Controlled by `format.semi` (default `false`). When `true`, Pickier safely removes only stylistic semicolons:
283
-
284
- - Preserves `for (init; test; update)` headers
285
- - Removes duplicate trailing semicolons (e.g. `foo();;` -> `foo();`)
286
- - Removes lines that are just empty statements (`;`)
287
- - Keeps normal end-of-line semicolons otherwise (non-destructive)
288
-
289
- **Imports (TypeScript/JavaScript)**
290
-
291
- Groups and rewrites the top import block:
292
-
293
- - Splits type-only specifiers into `import type { ... } from 'x'`
294
- - Keeps default and namespace imports
295
- - Removes unused named specifiers (only when they have no alias)
296
- - Merges multiple imports from the same module
297
23
 
298
- Sorting order:
299
-
300
- - By kind: type imports, side-effect imports, value imports
301
- - For modules: external before relative
302
- - For specifiers: A-Z by identifier
303
-
304
- Spacing:
305
-
306
- - Ensures a single blank line between the import block and the rest of the file
307
- - Respects `format.finalNewline` at EOF
308
-
309
- **Built-in Rules**
310
-
311
- - `noDebugger` — removes `debugger` statements when `--fix` is used
312
- - `noConsole` — controls severity (turn off for libraries that allow console logs)
313
-
314
- ## Benchmarks
315
-
316
- Measured on an Apple M3 Pro with Bun 1.3.9. Each tool uses equivalent settings (single quotes, no semicolons, 2-space indent). Pickier and Prettier use their in-memory APIs; oxfmt and Biome have no JS formatting API, so they are called via stdin pipe. Full benchmark source is in `bechmarks/benchmarks/format-comparison.bench.ts`.
317
-
318
- ### In-memory / Programmatic API
319
-
320
- Pickier `formatCode()` and Prettier `format()` run in-process. oxfmt and Biome are piped via stdin (no JS formatting API).
321
-
322
- | File | Pickier | Biome (stdin) | oxfmt (stdin) | Prettier |
323
- |------|--------:|--------------:|--------------:|---------:|
324
- | Small (52 lines, 1 KB) | **41 us** | 40 ms | 51 ms | 1.59 ms |
325
- | Medium (419 lines, 10 KB) | **417 us** | 42 ms | 50 ms | 10.2 ms |
326
- | Large (1,279 lines, 31 KB) | **1.25 ms** | 46 ms | 50 ms | 28.1 ms |
327
-
328
- ### CLI (single file)
329
-
330
- All four tools spawn a process and read the file from disk.
331
-
332
- | File | Pickier | Biome | oxfmt | Prettier |
333
- |------|--------:|------:|------:|---------:|
334
- | Small (52 lines) | **37 ms** | 43 ms | 68 ms | 105 ms |
335
- | Medium (419 lines) | **38 ms** | 53 ms | 71 ms | 143 ms |
336
- | Large (1,279 lines) | **40 ms** | 90 ms | 73 ms | 187 ms |
337
-
338
- ### CLI Batch (all files, sequential)
339
-
340
- | Tool | Time |
341
- |------|-----:|
342
- | Pickier | **121 ms** |
343
- | Biome | 187 ms |
344
- | oxfmt | 216 ms |
345
- | Prettier | 423 ms |
346
-
347
- ### Throughput (large file x 20)
348
-
349
- | Tool | Time |
350
- |------|-----:|
351
- | Pickier | **26 ms** |
352
- | Prettier | 524 ms |
353
- | Biome (stdin) | 957 ms |
354
- | oxfmt (stdin) | 1,040 ms |
355
-
356
- > Pickier's in-memory API is **22-39x faster than Prettier** and orders of magnitude faster than tools that must spawn a process. On CLI, Pickier's compiled binary beats Biome's native Rust binary across all file sizes — **37ms vs 43ms on small files**, and pulling further ahead on larger files. At throughput scale (20x large file), Pickier is **20x faster** than Prettier and **37x faster** than Biome/oxfmt.
357
-
358
- ```bash
359
- # reproduce locally
360
- bun bechmarks/benchmarks/format-comparison.bench.ts
24
+ # Unified command
25
+ pickier run . --mode lint --fix
26
+ pickier run . --mode format --write
361
27
  ```
362
28
 
363
- ## Programmatic Usage
29
+ ### Programmatic API
364
30
 
365
- Call Pickier from code (Bun/Node) for custom tooling, editors, or pipelines.
31
+ ```typescript
32
+ import { lintText, runLintProgrammatic } from 'pickier'
366
33
 
367
- ```ts
368
- import type { RunOptions } from 'pickier'
369
- import { config, defaultConfig, run, runLint, runFormat, lintText } from 'pickier'
370
-
371
- // Unified run
372
- const exitCode = await run(['.'], {
373
- mode: 'lint',
374
- fix: true,
375
- })
34
+ // Lint a single string
35
+ const issues = await lintText('const x = "hello";')
376
36
 
377
- // Lint specific directories
378
- const lintCode = await runLint(['src', 'tests'], {
37
+ // Programmatic lint run
38
+ const results = await runLintProgrammatic({
39
+ files: ['src/**/*.ts'],
379
40
  fix: true,
380
- dryRun: false,
381
- reporter: 'json',
382
- maxWarnings: 0,
383
- })
384
-
385
- // Format specific globs
386
- const fmtCode = await runFormat(['src/**/*.ts'], {
387
- write: true,
388
41
  })
389
-
390
- // Lint a single string
391
- const result = await lintText('const x = 1;;', {
392
- filePath: 'virtual.ts',
393
- })
394
-
395
- // Access loaded config (from pickier.config.ts or defaults)
396
- console.log('loaded config:', config)
397
- ```
398
-
399
- ## Development
400
-
401
- This repository contains Pickier's source under `packages/pickier`.
402
-
403
- ```bash
404
- # install deps
405
- bun i
406
-
407
- # run tests (with coverage)
408
- bun test --coverage
409
-
410
- # build JS and type declarations
411
- bun run -C packages/pickier build
412
-
413
- # compile native binary for your platform
414
- bun run -C packages/pickier compile
415
-
416
- # compile all platform binaries
417
- bun run -C packages/pickier compile:all
418
42
  ```
419
43
 
420
- Try the CLI locally without publishing:
421
-
422
- ```bash
423
- # run the TS entry directly
424
- bun packages/pickier/bin/cli.ts --help
425
-
426
- # lint the current directory
427
- bun packages/pickier/bin/cli.ts .
428
-
429
- # or the compiled native binary (after compile)
430
- ./packages/pickier/bin/pickier-<your-platform> .
431
- ```
432
-
433
- ## Testing
434
-
435
- ```bash
436
- bun test
437
- ```
438
-
439
- ## Changelog
440
-
441
- Please see our [releases](https://github.com/pickier/pickier/releases) page for more information on what has changed recently.
442
-
443
- ## Contributing
444
-
445
- Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
446
-
447
- ## Community
448
-
449
- For help, discussion about best practices, or any other conversation that would benefit from being searchable:
450
-
451
- [Discussions on GitHub](https://github.com/pickier/pickier/discussions)
452
-
453
- For casual chit-chat with others using this package:
454
-
455
- [Join the Stacks Discord Server](https://discord.gg/stacksjs)
456
-
457
- ## Postcardware
458
-
459
- “Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where`pickier` is being used! We showcase them on our website too.
460
-
461
- Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
462
-
463
- ## Sponsors
464
-
465
- We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
466
-
467
- - [JetBrains](https://www.jetbrains.com/)
468
- - [The Solana Foundation](https://solana.com/)
469
-
470
- ## Credits
44
+ ## Features
471
45
 
472
- - [Chris Breuer](https://github.com/chrisbbreuer)
473
- - [All Contributors](../../contributors)
46
+ - **Fast CLI** - Instant feedback powered by Bun
47
+ - **Lint and Format** - One tool for both linting and formatting
48
+ - **Zero-config Defaults** - Works out of the box, or customize with `pickier.config.ts`
49
+ - **Import Organization** - Splits type/value imports, sorts modules and specifiers, removes unused imports
50
+ - **JSON Sorting** - Sorts `package.json`, `tsconfig.json`, and other config files
51
+ - **Tailwind CSS Class Ordering** - Enforces canonical class order across HTML/JSX/TSX/Vue/Svelte/STX
52
+ - **Markdown Linting** - Documentation quality checks with auto-fix support
53
+ - **Shell Script Linting & Formatting** - 21 rules for `.sh`, `.bash`, and `.zsh` files with auto-fix support and indentation normalization
54
+ - **Spell Checking** - Optional spell-check rules powered by [ts-spell-check](https://github.com/stacksjs/ts-spell-check) (234K dictionary, 150+ common misspelling corrections)
55
+ - **Flexible Formatting** - Configurable indent, quotes, semicolons, whitespace, and more
56
+ - **Package.json Validation** - Validates exports ordering, file format, and module system
57
+ - **ESLint-style Plugin System** - Load plugins, enable/disable rules
58
+ - **CI-friendly Reporters** - Stylish, compact, and JSON output formats
59
+ - **Programmatic API** - Use in custom tooling and editor integrations
60
+
61
+ ## Shell Script Support
62
+
63
+ Pickier includes a full `shell/` plugin with 21 rules for linting and formatting shell scripts (`.sh`, `.bash`, `.zsh`). Files are also detected by shebang (`#!/bin/bash`, `#!/usr/bin/env zsh`, etc.).
64
+
65
+ ### Formatting
66
+
67
+ Shell formatting normalizes indentation for control structures (`if/then/fi`, `case/esac`, `while/for/do/done`, function bodies), trims trailing whitespace, collapses blank lines, and ensures final newlines — all while preserving heredoc content verbatim.
68
+
69
+ ### Rules
70
+
71
+ **Error Prevention:**
72
+
73
+ | Rule | Fixable | Description |
74
+ |------|---------|-------------|
75
+ | `shell/command-substitution` | Yes | Use `$()` instead of backticks |
76
+ | `shell/quote-variables` | - | Quote `$var` to prevent word splitting |
77
+ | `shell/no-cd-without-check` | - | Require fallback exit after `cd` |
78
+ | `shell/no-eval` | - | Disallow `eval` |
79
+ | `shell/no-useless-cat` | - | Detect useless use of cat |
80
+ | `shell/no-ls-parsing` | - | Don't parse `ls` output |
81
+ | `shell/no-variable-in-single-quotes` | - | Flag `$var` inside single quotes |
82
+ | `shell/no-exit-in-subshell` | - | Flag `exit` inside subshells |
83
+
84
+ **Style:**
85
+
86
+ | Rule | Fixable | Description |
87
+ |------|---------|-------------|
88
+ | `shell/shebang` | - | Ensure proper shebang line |
89
+ | `shell/indent` | Yes | Consistent indentation (2 spaces default) |
90
+ | `shell/function-style` | Yes | Prefer `name() {` over `function name` |
91
+ | `shell/operator-spacing` | Yes | Spaces inside `[[ ]]` and `[ ]` |
92
+ | `shell/keyword-spacing` | - | Spacing around shell keywords |
93
+ | `shell/no-trailing-semicolons` | Yes | Remove unnecessary trailing `;` |
94
+ | `shell/no-trailing-whitespace` | Yes | Trim trailing whitespace |
95
+
96
+ **Best Practices:**
97
+
98
+ | Rule | Fixable | Description |
99
+ |------|---------|-------------|
100
+ | `shell/prefer-double-brackets` | Yes | `[[ ]]` over `[ ]` for bash/zsh |
101
+ | `shell/set-options` | - | Recommend `set -euo pipefail` |
102
+ | `shell/prefer-printf` | - | `printf` over `echo -e`/`echo -n` |
103
+ | `shell/consistent-case-terminators` | - | Consistent `;;` in case statements |
104
+ | `shell/no-broken-redirect` | - | Correct `2>&1` ordering |
105
+ | `shell/heredoc-indent` | - | Recommend `<<-` for indented heredocs |
474
106
 
475
107
  ## License
476
108
 
477
- The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
478
-
479
- Made with 💙
480
-
481
- <!-- Badges -->
482
- [npm-version-src]: https://img.shields.io/npm/v/pickier?style=flat-square
483
- [npm-version-href]: https://npmjs.com/package/pickier
484
- [github-actions-src]: https://img.shields.io/github/actions/workflow/status/pickier/pickier/ci.yml?style=flat-square&branch=main
485
- [github-actions-href]: https://github.com/pickier/pickier/actions?query=workflow%3Aci
486
-
487
- <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/pickier/pickier/main?style=flat-square -->
488
- <!-- [codecov-href]: https://codecov.io/gh/pickier/pickier -->
109
+ MIT
package/dist/ast.d.ts CHANGED
@@ -4,21 +4,10 @@ export declare function tokenize(text: string): Token[];
4
4
  export declare function findMatching(text: string, start: number, open: string, close: string): number;
5
5
  // Lightweight parsing utilities (no deps). Intentionally minimal for Pickier rules.
6
6
  // Provides tokenization, simple bracket matching, and loc <-> index mapping.
7
- export declare interface Loc {
8
- line: number
9
- column: number
10
- }
11
- export declare interface Range {
12
- start: number
13
- end: number
14
- }
15
- export declare interface Token {
16
- type: string
17
- value: string
18
- start: number
19
- end: number
20
- }
7
+ export declare interface Loc { line: number, column: number }
8
+ export declare interface Range { start: number, end: number }
9
+ export declare interface Token { type: string, value: string, start: number, end: number }
21
10
  export declare interface SourceMap {
22
11
  lineStarts: number[]
23
12
  indexToLoc: (idx: number) => Loc
24
- }
13
+ }