Commit graph

24 commits

Author SHA1 Message Date
Wyatt Johnson
6606630af2
refactor: simplified lint-staged config (#66720)
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.
2024-06-11 08:51:53 -07:00
Wyatt Johnson
996a290afd
[lint] Allow lint warnings to pass in CI (#66140)
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.
2024-06-10 12:57:46 -07:00
Jiwon Choi
cef8bfa5de
Revert "refactor: remove unnecessary lint-staged operations (#65861)" (#66554)
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>
2024-06-04 23:51:24 -07:00
Jiwon Choi
3506398d37
fix: revert removed flags from lint-staged config (#66381)
cc @ijjk @samcx 

Revert removed flags from lint-staged.

x-ref:
https://github.com/vercel/next.js/pull/65861#issuecomment-2140007873
2024-05-30 11:39:06 -07:00
Jiwon Choi
0558f61c41
refactor: remove unnecessary lint-staged operations (#65861)
### Why?

The current `lint-staged` hook uses [function
signature](https://github.com/lint-staged/lint-staged?tab=readme-ov-file#function-signature)
to target the **staged files** and has extra steps for handling those
files that seem to have been passed on from a [5-year-old legacy
code](https://github.com/vercel/next.js/pull/9245).

The entire process is unnecessary today since `lint-staged` only runs on
the staged files.

### How?

This PR removed unnecessary logic, removed some no-effect flags, and
[removed `git
add`](https://github.com/lint-staged/lint-staged?tab=readme-ov-file#v10).

> If your task previously contained a git add step, please remove this.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-30 00:56:30 +00:00
Wyatt Johnson
b5d911c92c
[ppr] Don't mark RSC requests as /_next/data requests (#66249)
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
2024-05-28 07:53:04 -07:00
Wyatt Johnson
eff272f17e
[eslint] Fix lint-staged to ensure eslint is ran (#65622)
Previously, eslint was not running during lint-staged because
`isPathIgnored` actually returns a promise. This changes it to async to
make it work correctly.
2024-05-10 12:50:01 -06:00
hrmny
64b718c661
chore: update prettier to 3.2.5 (#65092) 2024-05-08 21:47:14 +02:00
Leah
00aea747c5
add cargo fmt to lint staged (#56430)
Keep forgetting to run `cargo fmt` before committing

Closes WEB-1707
2023-10-04 17:46:44 +00:00
JJ Kasper
f9c10469a2
Run dev tests against default CNA templates (#45211) 2023-01-24 11:01:03 -08:00
Jan Kaifer
015a7dd9ee
Change test template to use TS and improve template for app-dir (#44227)
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>
2023-01-06 20:36:47 +00:00
JJ Kasper
9573174196
Replace pre-commit with husky (#38350)
* Replace pre-commit with husky

* update lock

* actually update lock
2022-07-06 11:14:16 -05:00
Kiko Beats
fafbea8b74
Use Edge Runtime for running Edge Functions locally (#37024)
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>
2022-05-30 12:01:36 +00:00
matamatanot
3821662eb7
Replace CLIEngine with ESLint (#25801)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-06-09 13:54:10 +02:00
Jan Potoms
f69757408e
Update browserslist/caniuse-lite (#13605)
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
2020-05-31 19:37:01 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
matamatanot
5787cbd9de
Update lint-staged (#12225) 2020-05-02 15:47:16 -04:00
JJ Kasper
84b89c8b24
Pre-ncc compiled packages to prevent re-nccing unnecessarily (#11569)
* Pre-ncc compiled packages to prevent re-nccing unnecessarily

* Add compiled files

* Re-run pre-ncc step

* Add check to workflow to ensure pre-compiled doesnt need updating

* Update check-pre-compiled script

* Add handling for lower case license while nccing

* bump

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-07 09:42:16 -04:00
Joe Haddad
683486da63
Add TypeScript Definitions for Sass (#10363)
* Add TypeScript Definitions for Sass

* fix test
2020-02-03 00:03:42 -05:00
Joe Haddad
338e08b49f Adjust Commit Linting Hook (#9694) 2019-12-10 20:29:39 -06:00
Joe Haddad
462aa91652
Fix Linting Pre-Commit Hook (#9654) 2019-12-06 23:07:31 -05:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
Luis Alvarez D
ab5e606e1e Ignore shell-quote on Windows (#9296) 2019-11-09 11:54:19 -08:00
Joe Haddad
6b54e9ed66 Fix Prettier Commit Hook (#9245)
* Apply format to webpack config

* hit all files
2019-10-30 12:35:51 +01:00