@ttskch/prettier-plugin-tailwindcss-anywhere
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -7,3 +7,2 @@ import { parse } from "./parser.js"; | ||
parsers: ["anywhere"], | ||
aceMode: "text", | ||
}, | ||
@@ -15,8 +14,4 @@ ]; | ||
astFormat: "anywhere", | ||
locStart(node) { | ||
return node.start; | ||
}, | ||
locEnd(node) { | ||
return node.end; | ||
}, | ||
locStart: (node) => node.start, | ||
locEnd: (node) => node.end, | ||
}, | ||
@@ -32,3 +27,3 @@ }; | ||
type: "string", | ||
category: "Anywhere", | ||
category: "Format", | ||
default: 'class="([^"]*)"', | ||
@@ -35,0 +30,0 @@ description: "regex to match class attribute", |
@@ -1,10 +0,3 @@ | ||
import type { ParserOptions } from "prettier"; | ||
type AnywhereNode = { | ||
type: "anywhere"; | ||
body: string; | ||
source: string; | ||
start: number; | ||
end: number; | ||
}; | ||
import { type ParserOptions } from "prettier"; | ||
import type { AnywhereNode } from "./types.js"; | ||
export declare const parse: (text: string, options: ParserOptions) => Promise<AnywhereNode>; | ||
export {}; |
@@ -22,8 +22,6 @@ import { format } from "prettier"; | ||
return { | ||
type: "anywhere", | ||
body: formattedText, | ||
start: 0, | ||
end: text.length, | ||
source: text, | ||
start: 0, | ||
}; | ||
}; |
export const print = (path) => { | ||
const node = path.node; | ||
switch (node.type) { | ||
case "anywhere": { | ||
return node.body; | ||
} | ||
} | ||
throw new Error(`Unknown node type: ${node.type}`); | ||
return node.body; | ||
}; |
{ | ||
"name": "@ttskch/prettier-plugin-tailwindcss-anywhere", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A Prettier plugin for sorting TailwindCSS classes in any HTML-like language, like Twig etc.", | ||
@@ -5,0 +5,0 @@ "keywords": ["prettier", "tailwindcss", "formatter", "html", "twig"], |
@@ -10,2 +10,3 @@ import type { | ||
import { print } from "./printer.js"; | ||
import type { AnywhereNode } from "./types.js"; | ||
@@ -19,3 +20,2 @@ /** | ||
parsers: ["anywhere"], | ||
aceMode: "text", | ||
}, | ||
@@ -31,9 +31,4 @@ ]; | ||
astFormat: "anywhere", | ||
// there's only a single node | ||
locStart(node) { | ||
return node.start; | ||
}, | ||
locEnd(node) { | ||
return node.end; | ||
}, | ||
locStart: (node: AnywhereNode) => node.start, | ||
locEnd: (node: AnywhereNode) => node.end, | ||
}, | ||
@@ -57,3 +52,3 @@ }; | ||
type: "string", | ||
category: "Anywhere", | ||
category: "Format", | ||
default: 'class="([^"]*)"', | ||
@@ -60,0 +55,0 @@ description: "regex to match class attribute", |
@@ -1,13 +0,5 @@ | ||
import type { ParserOptions } from "prettier"; | ||
import { format } from "prettier"; | ||
import { type ParserOptions, format } from "prettier"; | ||
import * as prettierPluginTailwindcss from "prettier-plugin-tailwindcss"; | ||
import type { AnywhereNode } from "./types.js"; | ||
type AnywhereNode = { | ||
type: "anywhere"; | ||
body: string; | ||
source: string; | ||
start: number; | ||
end: number; | ||
}; | ||
export const parse = async ( | ||
@@ -45,8 +37,6 @@ text: string, | ||
return { | ||
type: "anywhere", | ||
body: formattedText, | ||
start: 0, | ||
end: text.length, | ||
source: text, | ||
start: 0, | ||
}; | ||
}; |
import type { AstPath, Doc } from "prettier"; | ||
import type { AnywhereNode } from "./types.js"; | ||
export const print = (path: AstPath): Doc => { | ||
const node = path.node; | ||
switch (node.type) { | ||
case "anywhere": { | ||
return node.body; | ||
} | ||
} | ||
throw new Error(`Unknown node type: ${node.type}`); | ||
const node: AnywhereNode = path.node; | ||
return node.body; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15
10815
173