Skip to content

feat: ecosystem improvements — public API, new options, CJS, regex attrs#12

Merged
pierluigilenoci merged 2 commits into
mainfrom
feat/ecosystem-improvements
May 3, 2026
Merged

feat: ecosystem improvements — public API, new options, CJS, regex attrs#12
pierluigilenoci merged 2 commits into
mainfrom
feat/ecosystem-improvements

Conversation

@pierluigilenoci

Copy link
Copy Markdown
Owner

Summary

Comprehensive feature release bringing the plugin in line with ecosystem best practices observed in popular Prettier plugins (tailwindcss, svelte, astro, organize-imports, sort-imports).

New Features

  • Public Sorting APIimport { createSorter } from 'prettier-plugin-bootstrap/sorter' for programmatic use in linters, codemods, and build tools
  • bootstrapPreserveWhitespace — preserve original multi-space/tab separators between classes
  • bootstrapPreserveDuplicates — set to false to remove duplicate class names
  • Regex in bootstrapAttributes — patterns like /^data-class/ match dynamic attribute names
  • File-level ignore<!-- prettier-bootstrap-ignore --> skips sorting for an entire file
  • bootstrapVersion — declared option for future version-specific sorting rules
  • CJS export — dual ESM+CJS build for CommonJS consumers

Infrastructure

  • Prettier version matrix in CI (3.0.0 + latest 3.x)
  • Test fixtures with snapshot testing (HTML, JSX, Vue)
  • FUNDING.yml for GitHub Sponsors

Documentation

  • "Why?" rationale section
  • Plugin Compatibility table with load order guidance
  • TypeScript/JSDoc configuration example
  • Regex attributes documentation
  • File-level ignore documentation
  • FAQ: printWidth interaction

Stats

  • 121 tests, 100% coverage (statements, branches, functions, lines)
  • Dual ESM+CJS output verified at runtime
  • Publish dry-run passes

Test plan

  • pnpm run lint — clean
  • pnpm run format:check — clean
  • pnpm run typecheck — clean
  • pnpm run test:coverage — 121 tests, 100% coverage
  • pnpm run build — produces index.mjs, index.cjs, sorter.mjs, sorter.cjs + type declarations
  • node -e "import('./dist/index.mjs')" — OK
  • node -e "require('./dist/index.cjs')" — OK
  • node -e "import('./dist/sorter.mjs')" — OK
  • pnpm publish --dry-run — valid package

@pierluigilenoci pierluigilenoci force-pushed the feat/ecosystem-improvements branch from 2ebeba8 to 9e1710c Compare May 3, 2026 15:04
@codecov

codecov Bot commented May 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ff2cd30) to head (b543b98).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #12   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         5    +1     
  Lines          549       635   +86     
  Branches        82       104   +22     
=========================================
+ Hits           549       635   +86     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pierluigilenoci pierluigilenoci force-pushed the feat/ecosystem-improvements branch from 9e1710c to ae0f028 Compare May 3, 2026 15:08
- Public sorting API via `prettier-plugin-bootstrap/sorter` with `createSorter()`
- New options: bootstrapPreserveWhitespace, bootstrapPreserveDuplicates, bootstrapVersion
- Regex pattern support in bootstrapAttributes (e.g. `/^data-class/`)
- File-level ignore comment (`prettier-bootstrap-ignore`)
- Dual ESM+CJS build output
- Prettier version matrix in CI (3.0.0 + latest)
- Test fixtures with snapshot testing
- Expanded README: Why section, Plugin Compatibility, TypeScript config, FAQ
- FUNDING.yml for GitHub Sponsors

Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
@pierluigilenoci pierluigilenoci force-pushed the feat/ecosystem-improvements branch from ae0f028 to add9e36 Compare May 3, 2026 15:43
@pierluigilenoci pierluigilenoci merged commit 9079811 into main May 3, 2026
5 checks passed
@pierluigilenoci pierluigilenoci deleted the feat/ecosystem-improvements branch May 3, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant