This restores the changes that were reverted in #66554. This corrects
the issue that triggered the revert by removing the `--no-ignore` flag
which allows ESLint to handle the ignored files correctly.
To allow us to incrementally adopt more comprehensive linting rules,
this pull request disables the previous behaviour of failing CI when any
warnings were discovered. Instead, this modifies the previous warnings
to be errors which will preserve the previous linting behaviour. As we
enable new lint rules, they can be added as warnings which will gently
nudge us towards fixing in related pull requests.
cc @samcx
### Why?
The previous change on `lint-staged` dropped, ignoring files from
eslint, resulting in errors on files that should be ignored (e.g. `dist`
inside `.github/actions/`).
x-ref: #66383
### How?
This PR reverts PARTIAL commit 0558f61c41.
### RFC
> ESLint v8.51.0 introduced [--no-warn-ignored CLI
flag](https://eslint.org/docs/latest/use/command-line-interface#--no-warn-ignored).
It suppresses the warning File ignored because of a matching ignore
pattern. Use "--no-ignore" to override warning, so manually ignoring
files via eslint.isPathIgnored is no longer necessary.
How about we convert current config as flat config, which would be
necessary if we upgrade to v9, and use the `--no-warn-ignored` flag on
`lint-staged` to reduce the operation introduced in #65861?
x-ref:
https://github.com/lint-staged/lint-staged?tab=readme-ov-file#eslint--8510--flat-eslint-config
---------
Co-authored-by: Sam Ko <sam@vercel.com>
Old logic from the pages router was previously being hit during
development. This was more apparent when PPR was enabled as it was
mixing dynamic + static rendering in development which propagated to
errors. This change ensures that requests that are made with `RSC: 1`
are not marked as `/_next/data` URL's, and don't use the same logic
paths.
Previously it was a bit confusing because we used the variable
`isDataReq` in a few places that made it hard to tell what it was
referring to. In this case, the `isDataReq` is actually only used by the
pages router. This renames the `isDataReq` to `isNextDataRequest` to
make it clearer, as well as refactors to ensure that it's not used in
the paths for app routes.
Also to better represent the rendering modes the `supportsDynamicHTML`
variable was renamed to `supportsDynamicResponse`.
Fixes#66241
Previously, eslint was not running during lint-staged because
`isPathIgnored` actually returns a promise. This changes it to async to
make it work correctly.
Make templates actual executable tests to that we ensure there are no regressions.
It also makes the setup easier.
Also changes the layout to typescript because that's what we want to use by default anyway.
Also refactors helper function to use plop specific `{{ toFileName name }}` syntax for easier template modification.
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
This PR introduces [Edge Runtime](https://edge-runtime.vercel.app/) for emulating [Edge Functions](https://vercel.com/features/edge-functions) locally.
Every time you run a [middleware](https://nextjs.org/docs/advanced-features/middleware) locally via `next dev`, an isolated edge runtime context will be created.
These contexts have the same constraints as production servers, plus they don't pollute the global scope; Instead, all the code run in a vm on top of a Node.js process.
Additionally, `@edge-runtime/jest-environment` has been added to make easier testing Edge Functions in a programmatic way.
It dropped the following polyfills from Next.js codebase, since they are now part of Edge Runtime:
- abort-controller
- formdata
- uuid
- web-crypto
- web-streams
Co-authored-by: Gal Schlezinger <2054772+Schniz@users.noreply.github.com>
Looks like `caniuse-lite` is out of date and causing test failures.
- I upgraded both `browserslist` and `caniuse-lite` to latest semver compatible version.
- This seemed to cause changes in ncc compiled files, so recompiled.
- `lint-staged` failed on these files even though they should be ignored. As a fix, I applied the advice from https://github.com/okonet/lint-staged#how-can-i-ignore-files-from-eslintignore-
- Updated some test snapshots. 🤔 not sure this is the way to go