Skip to content

Commit

Permalink
fix snapshots broken by prettier (also fix .prettierignore) (#48586)
Browse files Browse the repository at this point in the history
### What?
Fix snapshots that were no longer fulfilling the original purpose after
prettier had its way.

The `.prettierignore` also had the old `target/` directory (prior to the
`Cargo.toml` move in #48198) so running `pnpm prettier-fix` formatted
files in the `target/` directory
  • Loading branch information
ForsakenHarmony authored Apr 21, 2023
1 parent a06fef0 commit 4354eda
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 40 deletions.
40 changes: 24 additions & 16 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
node_modules
**/.next/**
**/_next/**
**/dist/**
# Build artifacts
.next/
.turbo/
_next/
__tmp__/
dist/
node_modules/
target/
compiled/

lerna.json
test-timings.json
pnpm-lock.yaml

packages/next/src/bundles/webpack/packages/*.runtime.js
packages/next/src/bundles/webpack/packages/lazy-compilation-*.js
packages/next/src/compiled/**
packages/react-refresh-utils/**/*.js
packages/react-refresh-utils/**/*.d.ts
packages/react-dev-overlay/lib/**
**/__tmp__/**
lerna.json

.github/actions/next-stats-action/.work
.github/actions/issue-validator/index.mjs
.github/actions/issue-labeler/lib/index.js
packages/next-swc/crates/next-core/js/src/compiled/**/*

packages/next-swc/crates/**/tests/**/output*
packages/next-swc/target/**/*
packages/next-swc/crates/core/tests/loader/issue-32553/input.js
packages/next-swc/native/**/*
packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*

packages/next-codemod/transforms/__testfixtures__/**
packages/next-codemod/transforms/__tests__/**
packages/next-codemod/**/*.js
packages/next-codemod/**/*.d.ts

packages/next-env/**/*.d.ts
test-timings.json

test/**/out/**
test/development/basic/hmr/components/parse-error.js

bench/nested-deps/pages/**/*
bench/nested-deps/components/**/*
pnpm-lock.yaml

**/convex/_generated/**
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'react'
;('use client')

// prettier-ignore
'use client'

export default function () {
return null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'react';
'use client';
export default function() {
return null;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

x NEXT_RSC_ERR_CLIENT_DIRECTIVE_PAREN
,-[input.js:1:1]
1 | import 'react'
2 | ;('use client')
: ^^^^^^^^^^^^^^
x NEXT_RSC_ERR_CLIENT_DIRECTIVE
,-[input.js:3:1]
3 | // prettier-ignore
4 | 'use client'
: ^^^^^^^^^^^^
`----
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ const foo = async () => {

const bar = async () => {
const x = 1
;('use server')

// prettier-ignore
'use server'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const $$ACTION_1 = async (closure)=>{
var $$ACTION_0;
const bar = async ()=>{
const x = 1;
// prettier-ignore
'use server';
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

x The "use server" directive must be at the top of the function body.
,-[input.js:9:1]
9 | // prettier-ignore
10 | 'use server'
: ^^^^^^^^^^^^
11 | }
`----
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import 'my-module'
;('use server')

// prettier-ignore
'use server'
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import 'my-module';
// prettier-ignore
'use server';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

x The "use server" directive must be at the top of the file, and cannot be wrapped in parentheses.
,-[input.js:1:1]
1 | import 'my-module'
2 | ;('use server')
: ^^^^^^^^^^^^^^
x The "use server" directive must be at the top of the file.
,-[input.js:3:1]
3 | // prettier-ignore
4 | 'use server'
: ^^^^^^^^^^^^
`----
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
'use client'

import 'fs'
;('bar')

// prettier-ignore
'bar'

// This is a comment.

1 + 1
;('baz')

// prettier-ignore
'baz'

export default function () {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
// This is a comment.
'foo';
import 'fs';
// prettier-ignore
'bar';
// This is a comment.
1 + 1;
// prettier-ignore
'baz';
export default function() {
return null;
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
'random-directive'

import 'fs'
;('qwerty')

// prettier-ignore
'qwerty'

// This is a comment.

1 + 1
;('sasaya')

// prettier-ignore
'sasaya'

export default function () {
return null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
;<div>children</div>
;('<>hello</>')
<div>children</div>; '<>hello</>'
4 changes: 1 addition & 3 deletions packages/next-swc/crates/next-build/build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use turbo_binding::turbo::tasks_build::{generate_register, rerun_if_glob};
use turbo_binding::turbo::tasks_build::generate_register;
use vergen::{vergen, Config};

fn main() {
generate_register();

rerun_if_glob("tests/integration/*/*", "tests/integration");

// Attempt to collect some build time env values but will skip if there are any
// errors.
let _ = vergen(Config::default());
Expand Down

0 comments on commit 4354eda

Please sign in to comment.