Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jul 25, 2023
1 parent c5fa881 commit 536a80a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 1,488 deletions.
1,452 changes: 0 additions & 1,452 deletions .yarn/patches/prettier-npm-3.0.0-7ffbcce680.patch

This file was deleted.

2 changes: 0 additions & 2 deletions e2e/__tests__/crawlSymlinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ test('Should throw if watchman used with haste.enableSymlinks', () => {
expect(stderr).toMatchInlineSnapshot(`
"Validation Error:
haste.enableSymlinks is incompatible with watchman
Either set haste.enableSymlinks to false or do not use watchman"
`);
expect(exitCode).toBe(1);
Expand Down
5 changes: 0 additions & 5 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import {createRequire} from 'module';
const require = createRequire(import.meta.url);

const jestSnapshotIndex = require.resolve('jest-snapshot');
const requireFromSnapshot = createRequire(jestSnapshotIndex);
const prettierPath = requireFromSnapshot.resolve('prettier');

/** @type {import('jest').Config} */
export default {
collectCoverageFrom: [
Expand All @@ -35,7 +31,6 @@ export default {
'website/.*',
'e2e/runtime-internal-module-registry/__mocks__',
],
prettierPath,
projects: ['<rootDir>', '<rootDir>/examples/*/'],
snapshotFormat: {
printBasicPrototype: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"node-notifier": "^10.0.0",
"p-limit": "^3.1.0",
"pkg-dir": "^5.0.0",
"prettier": "patch:prettier@npm:^3.0.0#./.yarn/patches/prettier-npm-3.0.0-7ffbcce680.patch",
"prettier": "^3.0.0",
"promise": "^8.0.2",
"read-pkg": "^5.2.0",
"resolve": "^1.20.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/babel-plugin-jest-hoist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
"@babel/preset-typescript": "^7.0.0",
"@types/babel__template": "^7.0.2",
"@types/node": "*",
"@types/prettier": "^2.1.5",
"babel-plugin-tester": "^11.0.2",
"prettier": "^2.1.1"
"prettier": "^3.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@jest/expect-utils": "workspace:^",
"@jest/transform": "workspace:^",
"@jest/types": "workspace:^",
"@prettier/sync": "^0.3.0",
"babel-preset-current-node-syntax": "^1.0.0",
"chalk": "^4.0.0",
"expect": "workspace:^",
Expand All @@ -46,11 +47,10 @@
"@types/babel__core": "^7.1.14",
"@types/graceful-fs": "^4.1.3",
"@types/natural-compare": "^1.4.0",
"@types/prettier": "^2.1.5",
"@types/semver": "^7.1.0",
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
"prettier": "^2.1.1",
"prettier": "^3.0.0",
"tsd-lite": "^0.7.0"
},
"engines": {
Expand Down
9 changes: 7 additions & 2 deletions packages/jest-snapshot/src/InlineSnapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
Program,
TraversalAncestors,
} from '@babel/types';
import {createSynchronizedPrettier} from '@prettier/sync';
import * as fs from 'graceful-fs';
import type {
CustomParser as PrettierCustomParser,
Expand Down Expand Up @@ -60,6 +61,10 @@ export function saveInlineSnapshots(
try {
// @ts-expect-error requireOutside Babel transform
prettier = requireOutside(prettierPath) as Prettier;

if (semver.gte(prettier.version, '3.0.0')) {
prettier = createSynchronizedPrettier({prettierEntry: prettierPath});
}
} catch {
// Continue even if prettier is not installed.
}
Expand Down Expand Up @@ -292,7 +297,7 @@ const runPrettier = (
// Resolve project configuration.
// For older versions of Prettier, do not load configuration.
const config = prettier.resolveConfig
? prettier.resolveConfig.sync(sourceFilePath, {editorconfig: true})
? prettier.resolveConfig(sourceFilePath, {editorconfig: true})
: null;

// Prioritize parser found in the project config.
Expand All @@ -302,7 +307,7 @@ const runPrettier = (
const inferredParser: PrettierParserName | null | undefined =
(config && typeof config.parser === 'string' && config.parser) ||
(prettier.getFileInfo
? prettier.getFileInfo.sync(sourceFilePath).inferredParser
? prettier.getFileInfo(sourceFilePath).inferredParser
: simpleDetectParser(sourceFilePath));

if (!inferredParser) {
Expand Down
36 changes: 14 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ __metadata:
node-notifier: ^10.0.0
p-limit: ^3.1.0
pkg-dir: ^5.0.0
prettier: "patch:prettier@npm:^3.0.0#./.yarn/patches/prettier-npm-3.0.0-7ffbcce680.patch"
prettier: ^3.0.0
promise: ^8.0.2
read-pkg: ^5.2.0
resolve: ^1.20.0
Expand Down Expand Up @@ -3824,6 +3824,15 @@ __metadata:
languageName: node
linkType: hard

"@prettier/sync@npm:^0.3.0":
version: 0.3.0
resolution: "@prettier/sync@npm:0.3.0"
peerDependencies:
prettier: ^3.0.0
checksum: a663ceca292629c66c2c983662293b047b48435942c25b7ea76f0eab899e434f2bc17ae3dce56ee66b29929f7853118073f716fd4c7dabc3cccf78458a168dd4
languageName: node
linkType: hard

"@react-native-community/cli-clean@npm:^10.1.1":
version: 10.1.1
resolution: "@react-native-community/cli-clean@npm:10.1.1"
Expand Down Expand Up @@ -4981,13 +4990,6 @@ __metadata:
languageName: node
linkType: hard

"@types/prettier@npm:^2.1.5":
version: 2.7.3
resolution: "@types/prettier@npm:2.7.3"
checksum: 705384209cea6d1433ff6c187c80dcc0b95d99d5c5ce21a46a9a58060c527973506822e428789d842761e0280d25e3359300f017fbe77b9755bc772ab3dc2f83
languageName: node
linkType: hard

"@types/prompts@npm:^2.0.1":
version: 2.4.4
resolution: "@types/prompts@npm:2.4.4"
Expand Down Expand Up @@ -6366,9 +6368,8 @@ __metadata:
"@types/babel__template": ^7.0.2
"@types/babel__traverse": ^7.0.6
"@types/node": "*"
"@types/prettier": ^2.1.5
babel-plugin-tester: ^11.0.2
prettier: ^2.1.1
prettier: ^3.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -13104,11 +13105,11 @@ __metadata:
"@jest/test-utils": "workspace:^"
"@jest/transform": "workspace:^"
"@jest/types": "workspace:^"
"@prettier/sync": ^0.3.0
"@tsd/typescript": ^5.0.4
"@types/babel__core": ^7.1.14
"@types/graceful-fs": ^4.1.3
"@types/natural-compare": ^1.4.0
"@types/prettier": ^2.1.5
"@types/semver": ^7.1.0
ansi-regex: ^5.0.1
ansi-styles: ^5.0.0
Expand All @@ -13122,7 +13123,7 @@ __metadata:
jest-message-util: "workspace:^"
jest-util: "workspace:^"
natural-compare: ^1.4.0
prettier: ^2.1.1
prettier: ^3.0.0
pretty-format: "workspace:^"
semver: ^7.5.3
tsd-lite: ^0.7.0
Expand Down Expand Up @@ -16995,7 +16996,7 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:^2.1.1, prettier@npm:^2.8.3":
"prettier@npm:^2.8.3":
version: 2.8.8
resolution: "prettier@npm:2.8.8"
bin:
Expand All @@ -17013,15 +17014,6 @@ __metadata:
languageName: node
linkType: hard

"prettier@patch:prettier@npm:^3.0.0#./.yarn/patches/prettier-npm-3.0.0-7ffbcce680.patch::locator=%40jest%2Fmonorepo%40workspace%3A.":
version: 3.0.0
resolution: "prettier@patch:prettier@npm%3A3.0.0#./.yarn/patches/prettier-npm-3.0.0-7ffbcce680.patch::version=3.0.0&hash=fad750&locator=%40jest%2Fmonorepo%40workspace%3A."
bin:
prettier: bin/prettier.cjs
checksum: a13645a0b420fe8824ef521ea9ca55bc394e0c90654a101450fbe95053c9addc5f6b89c03d3fd3f7da0c1ba578556536a9a880061f1d1923a17b91cdb3b4bb52
languageName: node
linkType: hard

"pretty-bytes@npm:^5.3.0":
version: 5.6.0
resolution: "pretty-bytes@npm:5.6.0"
Expand Down

0 comments on commit 536a80a

Please sign in to comment.