Opt-out keys
The .opt-out file at the repository root disables individual checks: one key per line, blank lines
ignored. A listed key removes the step wherever it would run — the step is dropped from the
configuration, not skipped with a warning. If the file does not exist, every check runs.
The file ships with createapextestsuiteprecommit and testapexprecommit listed, so those two
steps are off by default:
Pre-commit steps
These keys affect only the pre-commit hook. .lintstagedrc.mjs consults all of them except
createapextestsuiteprecommit, which apex testsuite precommit reads: suite generation runs once
from the hook script itself, before lint-staged.
| Key | Disables | Default |
|---|---|---|
markdowntoc |
doctoc TOC regeneration for staged */README.md and docs/*.md. |
on |
autoformat |
Prettier formatting of staged files (all file groups) and the format:check step of npm run validate. |
on |
lintmarkdownprecommit |
Markdown lint on staged markdown files. | on |
lintjavascriptprecommit |
JavaScript lint on staged JS/LWC files. | on |
testjavascriptprecommit |
Related Jest tests (--findRelatedTests) for staged JS/LWC files. |
on |
createapextestsuiteprecommit |
Regeneration of the CiTestSuite test suite from staged Apex classes. |
off |
lintapexprecommit |
lint metadata (PMD Apex rules, copy-paste detection, secret regex rules) on staged Apex files; there is no separate Apex command. |
on |
testapexprecommit |
Apex test run for staged Apex files (executes against your default org). | off |
See how to control which Apex tests run on a full deploy
for how to use the suite createapextestsuiteprecommit regenerates.
The credential scan on staged files (lint secrets, the '*' entry of .lintstagedrc.mjs) has no
key and cannot be opted out.
Commit-message check
| Key | Disables | Default |
|---|---|---|
lintcommitmsg |
The commitlint check in the commit-msg hook. |
on |
npm run lint and npm run test sub-steps
These keys disable the sub-step in every invocation of the owning command — locally, in
npm run validate, and in CI.
| Key | Disables | Default |
|---|---|---|
lintmetadata |
The lint metadata step of npm run lint. |
on |
lintjavascript |
The lint javascript step of npm run lint. |
on |
lintmarkdown |
The lint markdown step of npm run lint. |
on |
testapex |
The test apex step of npm run test. |
on |
testjavascript |
The test javascript step of npm run test. |
on |
Related ignore files
Opting out disables a whole step. Excluding individual files or findings from a step that stays on is done through the step's ignore file:
.forceignore,.markdownlintignore,.prettierignore,.testsuiteignoreCi— file-level exclusions, one path pattern per line.code-analyzer/code-analyzer.yml—ignores.files(glob patterns removed from every engine) and the suppression baseline: a per-folder, per-rule cap on existing violations, applied on everysf code-analyzer run(lintmetadataandlintjavascript;npm run lint,npm run validate, CI alike). Violations above a cap fail the run. See how to baseline the code analyzer and how to exclude files from lint rules.
Scan scope of sf code-analyzer run as the toolchain invokes it: the workspace is the set of
top-level folders holding git-tracked files, excluding dot-prefixed ones; untracked files are not
scanned. node_modules/, logs/, dist/, coverage/, test-reports/, config/ and the other
ignores.files patterns in code-analyzer/code-analyzer.yml are excluded. On a pre-commit run the
staged files are passed explicitly, so a staged root dot-file such as .prettierrc.js is linted.