Skip to content

Commit 99edc42

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Fork internal vs external prettier plugin resolution (#52787)
Summary: Pull Request resolved: #52787 Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D78808694 fbshipit-source-id: 15f6b390bd2674303334dc0615ddb63e96872d4c
1 parent c7c11f6 commit 99edc42

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.prettierrc.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
* @format
88
*/
99

10+
let plugins = ['prettier-plugin-hermes-parser'];
11+
try {
12+
plugins = require('./.prettier-plugins.fb.js');
13+
} catch {}
14+
1015
module.exports = {
1116
arrowParens: 'avoid',
1217
bracketSameLine: true,
@@ -15,14 +20,7 @@ module.exports = {
1520
singleQuote: true,
1621
trailingComma: 'all',
1722
endOfLine: 'lf',
18-
plugins: [
19-
// Using module.parent and createRequire hack to simulate prettier v2 plugin resolution behavior.
20-
// The hack allows us to resolve the plugin from the install location of prettier.
21-
(module.parent
22-
? require('module').createRequire(module.parent.id)
23-
: require
24-
).resolve('prettier-plugin-hermes-parser'),
25-
],
23+
plugins,
2624
overrides: [
2725
{
2826
files: ['*.code-workspace'],

0 commit comments

Comments
 (0)