Mozlint

From mozilla/enterprise-firefox · View interactive version

Mozlint is an AI agent skill from the GitHub repository mozilla/enterprise-firefox. You MUST use this skill when working with Firefox's linting infrastructure (mozlint), adding new linters, modifying existing linters, running linters, or dealing with linting issues.

How to use this skill

Skill file

Mozlint

Overview

Firefox's linting infrastructure (mozlint) provides a unified way to run various linters across the codebase. It integrates multiple linters including ESLint, Stylelint, ruff, clippy, clang-format, and many others.

Workflow

Python linters

Python-based linters are the right choice when the linter primarily calls external programs (e.g., eslint, ruff, clang-format) or needs complex Python library integrations. They use types like external, string, regex, structured_log, or global, with a payload of the form module:function.

mozcheck (Rust linter binary)

Rust-based checks in mozcheck are preferred over new Python linters whenever feasible.

tools/lint/mozcheck/ is a Rust crate hosting fast, in-process checks (currently file-perm, file-whitespace, license, rejected-words, test-manifest-toml, trojan-source). The Python shim at tools/lint/mozcheck/__init__.py finds or builds the binary and invokes it in batch mode.

Wire a YAML to it with type: external, payload: mozcheck:lint, check: <subcommand>, and support-files: ['tools/lint/mozcheck/**']. Extra YAML keys are forwarded as the check's config.

To add a check: add src/<name>.rs, register it in src/main.rs and src/batch.rs, create the YAML, and add tests under tools/lint/test/. Prefer this over a new Python linter for self-contained file checks.

Adding New Linters

See docs/code-quality/lint/create.rst for the full guide on creating a new linter.

1. Create a YAML configuration in tools/lint/

2. If it's a custom linter, implement the Python module in tools/lint/python/ (or add a check to tools/lint/mozcheck/ for fast file checks)

3. Add tests in tools/lint/test/

Common Linters

Configuration Files

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.