Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add options.type #2112

Merged
merged 4 commits into from
Apr 3, 2025
Merged

feat: add options.type #2112

merged 4 commits into from
Apr 3, 2025

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Apr 2, 2025

PR Checklist

Overview

Goes a different, more comprehensive direction than #2110. Instead of encouraging a blockPackageJson it promotes type to a top-level option. --type commonjs will now work if a user really wants.

blockESLint will now print its config as eslint.config.mjs if options.type is "commonjs". It's still eslint.config.js otherwise.

🎁

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Compliance Checks Passed!

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.80%. Comparing base (9648653) to head (8c2e1a4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2112   +/-   ##
=======================================
  Coverage   99.80%   99.80%           
=======================================
  Files         127      127           
  Lines        5214     5238   +24     
  Branches      361      369    +8     
=======================================
+ Hits         5204     5228   +24     
  Misses         10       10           

☔ 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.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft April 2, 2025 21:56
@JoshuaKGoldberg
Copy link
Owner Author

😬 JoshuaKGoldberg/package-json-validator#178 is failing linting with:

$ pnpm lint

> [email protected] lint /Users/josh/repos/package-json-validator
> eslint . --max-warnings 0


/Users/josh/repos/package-json-validator/create-typescript-app.config.mjs
  8:1  error  Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

/Users/josh/repos/package-json-validator/eslint.config.mjs
  1:1  error  Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

✖ 2 problems (2 errors, 0 warnings)

Sigh. I'll have to add some .mjs-specific parsing shenanigans, or something like that.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review April 3, 2025 11:16
@JoshuaKGoldberg JoshuaKGoldberg merged commit a07f6ed into main Apr 3, 2025
13 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the type-option branch April 3, 2025 11:40
Copy link

github-actions bot commented Apr 3, 2025

🎉 This is included in version v2.23.0 🎉

The release is available on:

Cheers! 📦🚀

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.

🐛 Bug: eslint.config.js used with ESM even if package type is "commonjs"
1 participant