mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
* chore(lint): add anti-slop oxlint plugin (all rules off) Vendors dmmulroy/anti-slop (MIT) plus no-call-only-assertions and no-pass-through-type-alias from maharshi365/deslop (MIT). Every rule starts "off"; each follow-up PR fixes one rule's violations and flips it to "error". * fix(lint): actually exclude the vendored plugin from the anti-slop audit oxlint does not honour ignorePatterns supplied via --config, so the config/oxlint-plugins/anti-slop/** entry never matched and the vendored rule source was being linted as first-party code (505 violations). Move the exclusion to the --ignore-pattern CLI flag in audit:anti-slop, which does work, and drop the entry that gave a false sense of coverage. Keeping vendored source unlinted matters because anti-slop is updated by three-way merge against the upstream snapshot; reformatting it locally would conflict on every update. * chore(lint): pin anti-slop instead of vendoring it; drop deslop Replaces the ~5k vendored lines with a git-pinned devDependency: oxlint-plugin-anti-slop: github:dmmulroy/anti-slop#c44ef22 anti-slop ships raw .ts with no build step, and Node refuses to type-strip anything under node_modules (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING), so oxlint cannot load it from there -- which is why upstream says to vendor it. A postinstall step copies the pinned package's source to .anti-slop-plugin/ (gitignored), which Node will type-strip because it sits outside node_modules. Upgrading is now a SHA bump rather than a re-vendor and three-way merge. Verified byte-identical rule output to the vendored copy across all 16 rules that fire. Drops maharshi365/deslop and its two rules (no-call-only-assertions, no-pass-through-type-alias). It is not on npm either, so it would need a second git pin and copy step, and it is a 5-star single-maintainer repo that is itself a re-namespaced copy of anti-slop. One upstream is enough. * ci(lint): run audit:anti-slop in PR CI config/scripts/pr-workflow-lint-parity.test.mjs requires every step in `pnpm lint` to have a matching step in .github/workflows/pr.yml; adding audit:anti-slop to lint without the workflow step failed that ratchet. Also makes audit:anti-slop sync the plugin itself before linting. The generated .anti-slop-plugin/ directory is gitignored and otherwise only created by postinstall, so a cached install that skips postinstall would leave oxlint unable to load the plugin.
21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
// anti-slop ships raw .ts with no build step, and Node refuses to type-strip anything
|
|
// under node_modules (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING), so oxlint cannot load
|
|
// it from there. Copy the pinned package's source out to a gitignored dir it can load.
|
|
import { cpSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { resolve } from 'node:path'
|
|
|
|
const repoRoot = resolve(import.meta.dirname, '../..')
|
|
const source = resolve(repoRoot, 'node_modules/oxlint-plugin-anti-slop/src')
|
|
const target = resolve(repoRoot, '.anti-slop-plugin')
|
|
|
|
rmSync(target, { recursive: true, force: true })
|
|
mkdirSync(target, { recursive: true })
|
|
cpSync(source, target, { recursive: true })
|
|
// Effect rules are opt-in upstream and this repo does not use Effect; tests would be linted.
|
|
rmSync(resolve(target, 'effect'), { recursive: true, force: true })
|
|
cpSync(
|
|
resolve(repoRoot, 'node_modules/oxlint-plugin-anti-slop/LICENSE'),
|
|
resolve(target, 'LICENSE')
|
|
)
|
|
writeFileSync(resolve(target, 'package.json'), '{ "type": "module" }\n')
|