@mctools/format
v1.1.3
Published
Format .zs files by using ESLint for typescript
Maintainers
Readme
Format .zs files by using ESLint for typescript
The pipeline is:
.zs ──Peggy──▶ .ts (with markers) ──ESLint --fix──▶ .ts ──regex revert──▶ .zsThe Peggy grammar (src/zenscript.peggy) lexes ZenScript and emits valid TypeScript sprinkled with block-comment markers. ESLint formats it like any other TS file, then a disciplined set of regexes (see src/tsToZs.ts) maps the markers back to ZS.
Requirements:
eslint@^9is a peer dependency — install it in the host project alongside whatever ESLint config you want applied to the intermediate.tsfiles (e.g.@antfu/eslint-config). The package intentionally provides no config of its own; the whole point is to reuse yours.
Programmatic API:
import { revert, zsToTs } from '@mctools/format'
const result = zsToTs(zsSource) // pure: string → { ok, ts } | { ok: false, error }
if (result.ok) {
// result.ts contains marker-laden TypeScript
const back = revert(/* TS source after ESLint */)
}zsToTs / revert are pure (string in → string out). For batch file I/O see convertToTs from @mctools/format/dist/formatFile.
Usage
Open console, navigate to your Minecraft directory (one with the mods/ directory or options.txt file)
> cd C:/Instances/MyModpackRun:
> npx @mctools/format --help
Options
Format .zs files by using ESLint for typescript (@mctools/format v0.0.0)
USAGE @mctools/format [OPTIONS] <FILES>
ARGUMENTS
FILES Path to file / files for formatting
OPTIONS
-i, --ignore Same as --ignore-pattern for ESLint
-p, --pause Pause and ask before linting
-v, --verbose Show timing for each stepAuthor
- https://github.com/Krutoy242
Other tools
- @mctools/errors - Scan debug.log file to find unknown errors
- @mctools/format - Format .zs files by using ESLint for typescript
- @mctools/manifest -
manifest.jsongeneration tool - @mctools/modlist - Generate .md file with all mods listed
- @mctools/reducer - Partially disable minecraft mods
- @mctools/source - Locate, clone or decompile Minecraft mod source code
- @mctools/tcon - Tweaks Tinker Constructs' materials with csv tables
