-
Notifications
You must be signed in to change notification settings - Fork 18
Flatter #228
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
Conversation
I forgot to add `eslint-plugin-jsdoc` when creating our new configuration, even though it's present in the legacy configurations. This change re-adds the plugin and configures it for better interaction with TypeScript.
BREAKING CHANGE: Configurations are now returned as objects, like most shared ESLint configurations. The `make*Config` functions are no more. Also, everything is now exported through one file.
See comments about `no-undef`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces function‐generated configurations with flat static configurations for both ESLint and Prettier, following the latest community conventions. It updates various test examples (both good and bad) to reflect the new configuration style, revises legacy configuration files, and updates the documentation accordingly.
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/recommended/react.good.jsx | Valid React example using the new flat configuration. |
test/recommended/react.bad.jsx | Bad React test case demonstrating expected ESLint errors. |
test/recommended/plain.good.ts | Valid plain TypeScript example. |
test/recommended/plain.good.mjs | Valid plain JavaScript example. |
test/recommended/plain.bad.ts | Bad TypeScript test case with expected errors. |
test/recommended/plain.bad.mjs | Bad JavaScript test case with expected errors (e.g. unexpected JSX). |
test/recommended/eslint.config.mjs | ESLint configuration file updated to use flat configs. |
test/eslint.test.mjs | Linting tests updated to reflect new configuration results. |
prettier.config.mjs | Prettier configuration now exports a recommended config directly. |
lib/prettier.mjs | Legacy Prettier config module updated to export the new recommended config. |
lib/legacy/*.mjs | Legacy configuration files updated with proper type annotations. |
lib/index.mjs | Re-exports flat ESLint and Prettier configuration objects. |
lib/eslint.mjs | ESLint configurations revamped to align with flat configuration style. |
eslint.config.mjs | Main ESLint config file now uses the flat configuration API. |
README.md | Documentation updated to explain the flat configuration usage. |
Files not reviewed (2)
- package.json: Language not supported
- test/snapshots/eslint.test.mjs.snap: Language not supported
Comments suppressed due to low confidence (1)
lib/eslint.mjs:353
- The variable 'eslintConfigPrettier' is referenced but not defined. Consider replacing it with the appropriate Prettier configuration (for example, 'prettierConfigScratch.recommended') or importing its definition.
eslintConfigPrettier,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay, tests 🎉
Clever idea with the snapshots
Proposed Changes
Follow
eslint
community conventions better by offering flat configurations rather than functions to generate them.Reason for Changes
I started trying to use the previous version (see #214) and realized it wasn't practical.
Test Coverage
Now with tests! It's not full coverage, but it at least covers our
recommended
ruleset foreslint
.I now also have a real-world example of this configuration in action: scratchfoundation/scratch-l10n#624