mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 13:36:36 +00:00
chore: update lint rules
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
// `verifyInFixtures` runs a rule with cwd fixed to `__fixtures__/`, so both
|
||||
// work without touching process.cwd() or the real src/ tree.
|
||||
import { Linter } from "eslint";
|
||||
import type { Rule } from "eslint";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -32,3 +33,18 @@ export function verifyInFixtures(
|
||||
const linter = new Linter({ configType: "flat", cwd: FIXTURES_DIR });
|
||||
return linter.verify(code, config, path.join(FIXTURES_SRC, relFile));
|
||||
}
|
||||
|
||||
/** Wrap a script body into a minimal Svelte component (runs in runes mode). */
|
||||
export function svelteComponent(script: string): string {
|
||||
return `<main>Hello</main>\n\n<script lang="ts">\n${script}\n</script>\n`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Narrow an inferred JS rule to the typed `Rule.RuleModule`. The plugin rule
|
||||
* files are plain JS, so TypeScript infers a widened shape (`meta.type: string`)
|
||||
* that `RuleTester.run` rejects; the shape is structurally correct at runtime,
|
||||
* which is why existing rules keep their JS inference and only the tests cast.
|
||||
*/
|
||||
export function asRuleModule(rule: unknown): Rule.RuleModule {
|
||||
return rule as Rule.RuleModule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user