summaryrefslogtreecommitdiff
path: root/src/compiler/transform
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/transform')
-rw-r--r--src/compiler/transform/doctype.ts1
-rw-r--r--src/compiler/transform/index.ts2
-rw-r--r--src/compiler/transform/prism.ts4
-rw-r--r--src/compiler/transform/styles.ts1
4 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/transform/doctype.ts b/src/compiler/transform/doctype.ts
index d19b01f81..e871f5b48 100644
--- a/src/compiler/transform/doctype.ts
+++ b/src/compiler/transform/doctype.ts
@@ -21,6 +21,7 @@ export default function (_opts: { filename: string; fileID: string }): Transform
name: '!doctype',
type: 'Element',
};
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
parent.children!.splice(index, 0, dtNode);
hasDoctype = true;
}
diff --git a/src/compiler/transform/index.ts b/src/compiler/transform/index.ts
index 6a81b92b0..02a98709b 100644
--- a/src/compiler/transform/index.ts
+++ b/src/compiler/transform/index.ts
@@ -56,6 +56,7 @@ function walkAstWithVisitors(tmpl: TemplateNode, collection: VisitorCollection)
walk(tmpl, {
enter(node, parent, key, index) {
if (collection.enter.has(node.type)) {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const fns = collection.enter.get(node.type)!;
for (let fn of fns) {
fn.call(this, node, parent, key, index);
@@ -64,6 +65,7 @@ function walkAstWithVisitors(tmpl: TemplateNode, collection: VisitorCollection)
},
leave(node, parent, key, index) {
if (collection.leave.has(node.type)) {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const fns = collection.leave.get(node.type)!;
for (let fn of fns) {
fn.call(this, node, parent, key, index);
diff --git a/src/compiler/transform/prism.ts b/src/compiler/transform/prism.ts
index 5433f3586..7848e1672 100644
--- a/src/compiler/transform/prism.ts
+++ b/src/compiler/transform/prism.ts
@@ -4,13 +4,13 @@ import { getAttrValue } from '../../ast.js';
const PRISM_IMPORT = `import Prism from 'astro/components/Prism.astro';\n`;
const prismImportExp = /import Prism from ['"]astro\/components\/Prism.astro['"]/;
-
+/** escaping code samples that contain template string replacement parts, ${foo} or example. */
function escape(code: string) {
return code.replace(/[`$]/g, (match) => {
return '\\' + match;
});
}
-
+/** default export - Transform prism */
export default function (module: Script): Transformer {
let usesPrism = false;
diff --git a/src/compiler/transform/styles.ts b/src/compiler/transform/styles.ts
index d8e3196a1..0c7b4c3c1 100644
--- a/src/compiler/transform/styles.ts
+++ b/src/compiler/transform/styles.ts
@@ -124,6 +124,7 @@ async function transformStyle(code: string, { type, filename, scopedClass, mode
const { default: tailwindcss } = await import('@tailwindcss/jit');
postcssPlugins.push(tailwindcss());
} catch (err) {
+ // eslint-disable-next-line no-console
console.error(err);
throw new Error(`tailwindcss not installed. Try running \`npm install tailwindcss\` and trying again.`);
}