Files
openchamber/tools/oxlint/anti-slop/rules/no-shape-in-symbol-names.ts
Bohdan Triapitsyn 51aef5e316 chore(lint): vendor anti-slop oxlint plugin and add batched cleanup pipeline
Vendor the anti-slop Oxlint plugin at tools/oxlint/anti-slop and register it
in oxlint.config.ts, with Oxlint's own rule categories disabled so ESLint
stays the general-purpose linter.

Add scripts/anti-slop.mjs (bun run deslop) mirroring the React Doctor batch
interface: next-batch, check-batch, active, release, top, file. Batch handoff
directories now double as file claims shared across clones via
~/.openchamber/maintenance-claims, so concurrent maintenance batches from
either pipeline never select the same file.

Harden both scheduled maintenance flows: stop on a dirty worktree, stop on
NO BATCH AVAILABLE, validate per package instead of workspace-wide, and pin
react-doctor to 0.9.12. The anti-slop task command documents concrete
good and bad fixes and forbids laundering types to satisfy a rule.
2026-08-16 15:55:08 +03:00

40 lines
1.2 KiB
TypeScript

import { defineRule } from "@oxlint/plugins";
import type { ESTree } from "@oxlint/plugins";
const FORBIDDEN_SYMBOL_NAME = "shape";
function containsForbiddenSymbolName(name: string): boolean {
return name.toLowerCase().includes(FORBIDDEN_SYMBOL_NAME);
}
/** Ban the case-insensitive substring "shape" in every JavaScript and TypeScript symbol name. */
export const noForbiddenTermInSymbolNamesRule = defineRule({
meta: {
type: "problem",
docs: {
description:
'Disallow the case-insensitive substring "shape" in JavaScript, TypeScript, private, and JSX symbol names.',
},
messages: {
forbiddenSymbolName:
'Rename symbol "{{name}}" for its domain role; "shape" describes structure rather than ownership.',
},
},
createOnce(context) {
const reportForbiddenSymbolName = (node: ESTree.Node & { name: string }) => {
if (!containsForbiddenSymbolName(node.name)) return;
context.report({
node,
messageId: "forbiddenSymbolName",
data: { name: node.name },
});
};
return {
Identifier: reportForbiddenSymbolName,
PrivateIdentifier: reportForbiddenSymbolName,
JSXIdentifier: reportForbiddenSymbolName,
};
},
});