Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prettier editor integration #1439

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .pnp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions .vscode/pnpify/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}

// Defer to the real eslint/bin/eslint.js your application uses
Expand Down
6 changes: 2 additions & 4 deletions .vscode/pnpify/eslint/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}

// Defer to the real eslint/lib/api.js your application uses
Expand Down
18 changes: 18 additions & 0 deletions .vscode/pnpify/prettier/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
6 changes: 6 additions & 0 deletions .vscode/pnpify/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "prettier",
"version": "2.0.5-pnpify",
"main": "./index.js",
"type": "commonjs"
}
6 changes: 2 additions & 4 deletions .vscode/pnpify/typescript/bin/tsc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}

// Defer to the real typescript/bin/tsc your application uses
Expand Down
6 changes: 2 additions & 4 deletions .vscode/pnpify/typescript/bin/tsserver
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}

// Defer to the real typescript/bin/tsserver your application uses
Expand Down
6 changes: 2 additions & 4 deletions .vscode/pnpify/typescript/lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}

// Defer to the real typescript/lib/tsc.js your application uses
Expand Down
6 changes: 2 additions & 4 deletions .vscode/pnpify/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}

// Defer to the real typescript/lib/tsserver.js your application uses
Expand Down
6 changes: 2 additions & 4 deletions .vscode/pnpify/typescript/lib/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}

// Defer to the real typescript/lib/typescript.js your application uses
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"prettier.prettierPath": ".vscode/pnpify/prettier/index.js"
}
Binary file not shown.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"jest-environment-node": "^24.5.0",
"jest-junit": "^5.2.0",
"micromatch": "^4.0.2",
"prettier": "^2.0.5",
"typescript": "^3.8.3"
},
"dependenciesMeta": {
Expand Down Expand Up @@ -88,5 +89,8 @@
},
"engines": {
"node": ">=10.19.0"
},
"devDependencies": {
"@types/prettier": "^2"
}
}
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4891,6 +4891,13 @@ __metadata:
languageName: node
linkType: hard

"@types/prettier@npm:^2":
version: 2.0.1
resolution: "@types/prettier@npm:2.0.1"
checksum: fba408d98574b9790446bd5d5f1200a1baf164beea676eaad139320a1d1cdf54f2e411a865b253fc75fbadd1a096bb7eacbf13083fa7d26785e98dca57932b47
languageName: node
linkType: hard

"@types/prop-types@npm:*":
version: 15.5.8
resolution: "@types/prop-types@npm:15.5.8"
Expand Down Expand Up @@ -6188,6 +6195,7 @@ __metadata:
"@types/emscripten": ^1.38.0
"@types/jest": ^24.0.25
"@types/node": ^13.7.0
"@types/prettier": ^2
"@typescript-eslint/eslint-plugin": ^2.29.0
"@typescript-eslint/parser": ^2.23.0
"@yarnpkg/cli": "workspace:^2.0.0-rc.33"
Expand All @@ -6204,6 +6212,7 @@ __metadata:
jest-environment-node: ^24.5.0
jest-junit: ^5.2.0
micromatch: ^4.0.2
prettier: ^2.0.5
typescript: ^3.8.3
dependenciesMeta:
core-js:
Expand Down Expand Up @@ -22705,7 +22714,7 @@ fsevents@~2.1.2:
languageName: node
linkType: hard

"prettier@npm:^2.0.4":
"prettier@npm:^2.0.4, prettier@npm:^2.0.5":
version: 2.0.5
resolution: "prettier@npm:2.0.5"
bin:
Expand Down