-
Notifications
You must be signed in to change notification settings - Fork 28k
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(eslint-plugin): add minimal built-in flat presets #73873
Conversation
Tests Passed |
Stats from current PRDefault BuildGeneral
Client Bundles (main, webpack)
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size
Middleware size
Next Runtimes
build cache
Diff detailsDiff for main-HASH.jsDiff too large to display |
Take a look at these two comments and the surrounding discussion and also at the ESLint docs:
TLDR: ESLint prefers not to use a |
Adding a In the meantime, attaching an extra type-safe flat preset under the While |
Yeah I agree, just wanted to make sure that this is considered and that there is already a plan in place to match the recommendation in the next major next.js release. Ideally the flat config would have been part of 15.0 along with eslint 9 support, sadly eslint 9 support landed with such short notice before 15.0 that no one catched this in canary :( |
module.exports = plugin | ||
module.exports.flatConfig = { | ||
recommended: { | ||
name: 'eslint-plugin-next recommended', |
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.
It's probably better to call it next/recommended
, like other plugins do?
- https://github.com/un-ts/eslint-plugin-import-x/blob/ac6d2e1b39e2a0d01b981b98b58aad0eb7939c70/src/index.ts#L161
- https://github.com/Rel1cx/eslint-react/blob/c7c18c6af30d6a26108a7d47aaa0da6bd56bd404/packages/plugins/eslint-plugin/src/configs/recommended.ts#L10
- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/7566e13531f09a040daee4c16d0cba0c28d321c4/src/index.js#L303
- https://github.com/sindresorhus/eslint-plugin-unicorn/blob/1774135a5ddbded2c89f82952e37a3e3bb01cdfa/index.js#L73
Same for core-web-vitals
config.
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.
Done in 8a7d85c
(#73873).
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.
@rakleed kindly ask to review and merge the changes, thanks
Related issue: #73655 |
'@next/next': plugin, | ||
}, | ||
rules: { | ||
...recommendedRules, |
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.
Personally I think coreWebVitals
should just include the coreWebVitalsRules
instead of including the recommededRules, which is the same as the legacy configs, and users who want both presets could add them separately. However, I don't against the new rules set either, maybe it is up to the Next js members to decide.
Hi @devjiwonchoi, I saw you were involved in #73655, could you review this PR? This doesn't fix #73655 but it is at least one step towards flat configs |
Sorry for the delay, and thank you for the PR! |
👋 Just confirming that #75298 is still reproducible with [email protected] and flat config using [email protected]. Here’s the output from running pnpm next lint: Invalid Options:
- Unknown options: useEslintrc, extensions, resolvePluginsRelativeTo, rulePaths, ignorePath, reportUnusedDisableDirectives
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.
- 'ignorePath' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
- 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead. dependencies:
next 15.3.0-canary.18
eslint 8.57.0 |
Add minimal flat config presets for those who are building their own eslint flat presets and want to use their own parsers and settings.
The usage would be like: