Skip to content

Commit a48440a

Browse files
committed
chore: apply suggestions
1 parent 2ea4c5e commit a48440a

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

src/embedded/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ function getTemplateLiteralExpressionIndent(
6868
tabWidth: number,
6969
): { indentSize: number; previousQuasiText: string } {
7070
let i = index;
71-
const currentQuasi = templateLiteral.quasis[i];
72-
const previousQuasiText = currentQuasi?.value.raw ?? "";
71+
const precedingQuasi = templateLiteral.quasis[i];
72+
const previousQuasiText = precedingQuasi?.value.raw ?? "";
7373

7474
if (previousQuasiText.includes("\n")) {
7575
return {

tests/fixtures.spec.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,6 @@ function loadLanguageOptions(languageDir: string): LanguageOptions {
2727
}
2828
}
2929

30-
/**
31-
* Dynamically import plugins specified in the config
32-
*/
33-
async function loadPlugins(pluginNames: string[]): Promise<Plugin[]> {
34-
const plugins: Plugin[] = [];
35-
for (const name of pluginNames) {
36-
try {
37-
const plugin = await import(name);
38-
plugins.push(plugin.default ?? plugin);
39-
} catch (error) {
40-
console.warn(`Failed to load plugin "${name}":`, error);
41-
}
42-
}
43-
return plugins;
44-
}
45-
4630
/**
4731
* Find the line containing @prettier options in the content
4832
* Returns the line index if found, -1 otherwise
@@ -121,17 +105,14 @@ for (const languageDir of languageDirs) {
121105
const filename = path.basename(file);
122106

123107
it(filename, async () => {
124-
// Load plugins inside the test
125-
const languagePlugins = await loadPlugins([...plugins]);
126-
127108
const content = readFileSync(file, "utf-8");
128109
const fileOptions = parsePrettierOptions(content);
129110
const codeToFormat = getContentWithoutOptionsLine(content);
130111

131112
const formatted = await prettier.format(codeToFormat, {
132113
...restOptions,
133114
...fileOptions,
134-
plugins: [embed, ...languagePlugins],
115+
plugins: [embed, ...plugins],
135116
filepath: file,
136117
});
137118

0 commit comments

Comments
 (0)