mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
chore: add lint rules, fix script\configs
This commit is contained in:
+21
-13
@@ -4,18 +4,10 @@ import { fileURLToPath } from "node:url";
|
||||
const WEB_DIR = fileURLToPath(new URL("../", import.meta.url));
|
||||
const node = process.execPath;
|
||||
|
||||
// Every lint layer of the redesign, in one command. Each step runs even if a
|
||||
// previous one fails; the exit code is nonzero if any did.
|
||||
//
|
||||
// Stream wiring: children run with stdio ["ignore", 1, 1] — both stdout and
|
||||
// stderr are bound to OUR stdout file descriptor (shell `2>&1`). It is real FD
|
||||
// inheritance, no pipes or buffering, so `> css-lint.txt` catches every byte.
|
||||
// Color decisions are then the tool's own against the actual destination:
|
||||
// a terminal gets colors, a redirected file gets plain text.
|
||||
//
|
||||
// One quirk: stylelint prints its report to stderr and paints it even when the
|
||||
// destination is not a TTY. So for a non-TTY destination we pass its official
|
||||
// --no-color explicitly.
|
||||
// Every lint layer in one command. Each step runs even if a previous one
|
||||
// fails; the exit code is nonzero if any did. Children inherit our stdout FD
|
||||
// directly (no pipes), so `> out.txt` catches every byte; stylelint paints
|
||||
// even to a non-TTY, hence the explicit --no-color there.
|
||||
const colorFlag = process.stdout.isTTY ? [] : ["--no-color"];
|
||||
|
||||
const bins = {
|
||||
@@ -28,10 +20,26 @@ const bins = {
|
||||
checkTokens: fileURLToPath(new URL("check-tokens.mjs", import.meta.url)),
|
||||
};
|
||||
|
||||
// Warn-only rules with a non-zero baseline stay out of the gate until the
|
||||
// cleanup lands (docs/backlog.md, tests-and-lint section): they nag in
|
||||
// `pnpm lint` and editors, but --max-warnings=0 would make the gate red.
|
||||
// After the cleanup the overrides are removed and the rules become errors.
|
||||
const pendingCleanupOverrides = [
|
||||
"conventions/ascii-only",
|
||||
"conventions/comments-english",
|
||||
"conventions/comment-format",
|
||||
].flatMap((rule) => ["--rule", `${rule}: off`]);
|
||||
|
||||
const steps = [
|
||||
{
|
||||
name: "ESLint (svelte) + design-tokens rules",
|
||||
args: [bins.eslint, ...colorFlag, "--max-warnings=0", "."],
|
||||
args: [
|
||||
bins.eslint,
|
||||
...colorFlag,
|
||||
"--max-warnings=0",
|
||||
...pendingCleanupOverrides,
|
||||
".",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Stylelint (css) — design-token style",
|
||||
|
||||
Reference in New Issue
Block a user