mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 13:36:36 +00:00
chore: add design tokens\css lint rules
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Shared helpers to talk to the postcss AST of Svelte <style> blocks that
|
||||
// svelte-eslint-parser exposes. All rules use the same plumbing.
|
||||
|
||||
// Returns the postcss Root of the <style> block, or null when the file is not
|
||||
// a Svelte component (or its style failed to parse).
|
||||
export function getStyleRoot(context) {
|
||||
const parserServices = context.sourceCode?.parserServices;
|
||||
if (!parserServices || typeof parserServices.getStyleContext !== "function") {
|
||||
return null;
|
||||
}
|
||||
const styleContext = parserServices.getStyleContext();
|
||||
return styleContext?.status === "success" ? styleContext.sourceAst : null;
|
||||
}
|
||||
|
||||
// Returns a converter from a postcss node to an ESLint loc, or null if the
|
||||
// parser doesn't expose it.
|
||||
export function getStyleNodeLoc(context) {
|
||||
return context.sourceCode?.parserServices?.styleNodeLoc ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user