CodeIssuesPull Requests

Use ESLint Flat Config #84800

Mergedeps1lon wants to merge into canary from sebbie/10-09-use_flat_config_for_eslint
eps1loncommented 4 months agoowner

Switches from legacy config to ESLint's flat config which will be required for ESLint v10 and eprh v7.

We're now also failing on unused disable directives. This was previously only a CLI flag. Now we can enable it for certain folders. Only examples/ can have unused disable directives. They're really using their own ESLint config.

One thing I noticed is that ESLint ignores dot folders by default which you have to explicitly ignore in a Flat config. This mostly affects GitHub actions (.github) and Storybook (.storybook).

Test plan

  • Removed a case in packages/next/src/client/page-bootstrap.ts and still have failing pnpm lint-eslint due to non-exhaustive switch
  • Editor integration works in VSCode
  • Diffed linted files (DEBUG=eslint:cli-engine p lint-eslint . 2&> lint.log before and DEBUG="eslint:eslint-helpers" p lint-eslint . 2&> lint.log after)
ijjkaddedcreated-by: Next.js team4 months ago
ijjkaddedTurbopack4 months ago
ijjkaddedtype: next4 months ago
eps1lonmentioned this in #847974 months ago
eps1loncommented 4 months agomember
  • #84800
👈
  • #84797
  • #84799
  • canary
  • This stack of pull requests is managed by . Learn more about .

    eps1lonmentioned this in #847994 months ago
    ijjkcommented 4 months agomember

    Stats from current PR

    Default Build (Increase detected ⚠️)
    General
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    buildDuration33s28.5sN/A
    buildDurationCached28s21.4sN/A
    nodeModulesSize449 MB449 MBN/A
    nextStartRea..uration (ms)883ms902msN/A
    Client Bundles (main, webpack)
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    1916.HASH.js gzip169 B169 B
    4498-HASH.js gzip54 kB53.7 kBN/A
    9225-HASH.js gzip5.32 kB5.32 kBN/A
    c57d0559-HASH.js gzip62 kB62 kBN/A
    framework-HASH.js gzip59.8 kB59.8 kB
    main-app-HASH.js gzip257 B258 BN/A
    main-HASH.js gzip37.1 kB37 kBN/A
    webpack-HASH.js gzip1.69 kB1.69 kBN/A
    Overall change60 kB60 kB
    Legacy Client Bundles (polyfills)
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    polyfills-HASH.js gzip39.4 kB39.4 kB
    Overall change39.4 kB39.4 kB
    Client Pages
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    _app-HASH.js gzip193 B193 B
    _error-HASH.js gzip182 B182 B
    css-HASH.js gzip334 B334 B
    dynamic-HASH.js gzip1.8 kB1.8 kBN/A
    edge-ssr-HASH.js gzip256 B255 BN/A
    head-HASH.js gzip350 B352 BN/A
    hooks-HASH.js gzip384 B381 BN/A
    image-HASH.js gzip4.79 kB4.79 kBN/A
    index-HASH.js gzip259 B260 BN/A
    link-HASH.js gzip2.5 kB2.51 kBN/A
    routerDirect..HASH.js gzip318 B317 BN/A
    script-HASH.js gzip386 B386 B
    withRouter-HASH.js gzip315 B315 B
    1afbb74e6ecf..834.css gzip106 B106 B
    Overall change1.52 kB1.52 kB
    Client Build Manifests
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    _buildManifest.js gzip716 B719 BN/A
    Overall change0 B0 B
    Rendered Page Sizes
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    index.html gzip523 B524 BN/A
    link.html gzip536 B538 BN/A
    withRouter.html gzip519 B519 B
    Overall change519 B519 B
    Edge SSR bundle Size Overall increase ⚠️
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    edge-ssr.js gzip126 kB126 kBN/A
    page.js gzip254 kB255 kB⚠️ +698 B
    Overall change254 kB255 kB⚠️ +698 B
    Middleware size
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    middleware-b..fest.js gzip637 B641 BN/A
    middleware-r..fest.js gzip156 B157 BN/A
    middleware.js gzip33.4 kB33.2 kBN/A
    edge-runtime..pack.js gzip846 B846 B
    Overall change846 B846 B
    Next Runtimes
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    app-page-exp...dev.js gzip289 kB289 kBN/A
    app-page-exp..prod.js gzip159 kB159 kB
    app-page-tur...dev.js gzip289 kB289 kB
    app-page-tur..prod.js gzip159 kB159 kB
    app-page-tur...dev.js gzip285 kB285 kBN/A
    app-page-tur..prod.js gzip157 kB157 kB
    app-page.run...dev.js gzip285 kB285 kBN/A
    app-page.run..prod.js gzip157 kB157 kB
    app-route-ex...dev.js gzip67 kB67 kB
    app-route-ex..prod.js gzip46.4 kB46.4 kB
    app-route-tu...dev.js gzip67.1 kB67.1 kB
    app-route-tu..prod.js gzip46.4 kB46.4 kB
    app-route-tu...dev.js gzip66.6 kB66.6 kB
    app-route-tu..prod.js gzip46.2 kB46.2 kB
    app-route.ru...dev.js gzip66.6 kB66.6 kB
    app-route.ru..prod.js gzip46.1 kB46.1 kB
    dist_client_...dev.js gzip326 B326 B
    dist_client_...dev.js gzip328 B328 B
    dist_client_...dev.js gzip320 B320 B
    dist_client_...dev.js gzip318 B318 B
    pages-api-tu...dev.js gzip39.6 kB39.6 kB
    pages-api-tu..prod.js gzip29.9 kB29.9 kBN/A
    pages-api.ru...dev.js gzip39.6 kB39.6 kB
    pages-api.ru..prod.js gzip29.8 kB29.8 kB
    pages-turbo....dev.js gzip49.4 kB49.4 kB
    pages-turbo...prod.js gzip37 kB37 kBN/A
    pages.runtim...dev.js gzip49.3 kB49.3 kB
    pages.runtim..prod.js gzip37 kB37 kB
    server.runti..prod.js gzip76.1 kB76.1 kB
    Overall change1.7 MB1.7 MB
    build cache Overall increase ⚠️
    vercel/next.js canaryvercel/next.js sebbie/10-09-use_flat_config_for_eslintChange
    0.pack gzip3.09 MB3.1 MB⚠️ +10 kB
    index.pack gzip91.3 kB93 kB⚠️ +1.68 kB
    Overall change3.18 MB3.19 MB⚠️ +11.7 kB
    Diff details
    Diff for page.js

    Diff too large to display

    Diff for middleware.js

    Diff too large to display

    Diff for edge-ssr.js

    Diff too large to display

    Diff for css-HASH.js
    Diff for dynamic-HASH.js
    Diff for hooks-HASH.js
    Diff for image-HASH.js

    Diff too large to display

    Diff for index-HASH.js
    Diff for link-HASH.js
    Diff for routerDirect-HASH.js
    Diff for script-HASH.js
    Diff for withRouter-HASH.js
    Diff for 4498-HASH.js
    Diff for 9225-HASH.js
    Diff for main-HASH.js

    Diff too large to display

    Diff for main-app-HASH.js
    Diff for pages-api-tu..time.prod.js

    Diff too large to display

    Diff for pages-turbo...time.prod.js

    Diff too large to display

    Commit: c432dcbff9c21388a9ce459bcf116e51c2f7d65d
    ijjkcommented 4 months agomember

    Tests Passed

    codspeed-hq[bot]commented 4 months ago

    Merging #84800 will not alter performance

    Comparing sebbie/10-09-use_flat_config_for_eslint (c432dcb) with canary (6feaddf)

    Summary

    ✅ 17 untouched
    ⏩ 3 skipped

    Footnotes

    1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, .

    ijjkaddedcreate-next-app4 months ago
    ijjkaddedtests4 months ago
    Prevent failing `types-and-precompiled` from corrupting terminal outputa8acf64
    Use ESLint Flat Configb4c081e
    Restore ESLint legacy config defaultsc432dcb
    eps1lonrequested review fromdevjiwonchoi4 months ago
    eps1lonmerged commit 3b4e4474 months ago
    eps1lonclosed this4 months ago
    codenomnommentioned this in #836734 months ago
    github-actions[bot]addedlocked4 months ago
    github-actions[bot]locked this conversation as resolved4 months ago

    Labels

    type: nextcreate-next-appcreated-by: Next.js teamTurbopacklockedtests

    Changes

    +1835-120217 files

    Participants

    Back to pull requests