-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
apheleia-npx
in Yarn PnP projects (#301)
* `apheleia-npx` would use an incorrect path for the Yarn PnP ESM loader. * `apheleia-npx` did not correctly guard against word splitting. * `apheleia-npx` was sometimes not able to find formatters in a Yarn PnP project if there was also a node_modules folder at the root of the project. Unfortunately, many tools (including [Prettier](prettier/prettier#13032)) will create a cache folder in `node_modules` even in Yarn PnP projects. The presence of any `node_modules` folders are irrelevant when a `.pnp.cjs` file is present. --------- Co-authored-by: Radon Rosborough <[email protected]>
- Loading branch information
Showing
21 changed files
with
208 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
disable=SC2148 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
cd /tmp | ||
npm install --save-dev prettier-plugin-svelte prettier | ||
npm install -g prettier-plugin-svelte prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Fucking Node devs removed NODE_PATH support so now you have to do | ||
# this bullshit to get import() to work with globally installed | ||
# packages. | ||
ln -s /usr/lib/node_modules ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Fucking Node devs removed NODE_PATH support so now you have to do | ||
# this bullshit to get import() to work with globally installed | ||
# packages. | ||
ln -s /usr/lib/node_modules ./ |
3 changes: 3 additions & 0 deletions
3
test/formatters/samplecode/prettier/test-finds-config-file/.prettierrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"tabWidth": 3 | ||
} |
1 change: 1 addition & 0 deletions
1
test/formatters/samplecode/prettier/test-finds-config-file/in.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prettier-javascript/in.js |
10 changes: 10 additions & 0 deletions
10
test/formatters/samplecode/prettier/test-finds-config-file/out.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function HelloWorld({ | ||
greeting = "hello", | ||
greeted = '"World"', | ||
silent = false, | ||
onMouseOver, | ||
}) { | ||
if (!greeting) { | ||
return null; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/formatters/samplecode/prettier/test-uses-node-modules/.apheleia-ft.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm install |
1 change: 1 addition & 0 deletions
1
test/formatters/samplecode/prettier/test-uses-node-modules/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
6 changes: 6 additions & 0 deletions
6
test/formatters/samplecode/prettier/test-uses-node-modules/in.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Behavior differs between 2.x and 3.x | ||
// https://prettier.io/blog/2023/07/05/3.0.0.html | ||
call( | ||
@dec | ||
class {}, | ||
); |
8 changes: 8 additions & 0 deletions
8
test/formatters/samplecode/prettier/test-uses-node-modules/out.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Behavior differs between 2.x and 3.x | ||
// https://prettier.io/blog/2023/07/05/3.0.0.html | ||
call( | ||
( | ||
@dec | ||
class {} | ||
) | ||
); |
30 changes: 30 additions & 0 deletions
30
test/formatters/samplecode/prettier/test-uses-node-modules/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
test/formatters/samplecode/prettier/test-uses-node-modules/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "apheleia-ft-prettier-test-uses-node-modules", | ||
"version": "1.0.0", | ||
"description": "Prettier should be used from node_modules", | ||
"main": "index.js", | ||
"author": "Radian LLC <[email protected]>", | ||
"license": "MIT", | ||
"private": true, | ||
"dependencies": { | ||
"prettier": "^2.8.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters