Getting Started
aaa-lint is a family of lint plugins that enforce the Arrange-Act-Assert pattern in your test code. Every test block must contain three marker comments — arrange, act, assert — in that exact order.
it('adds two numbers', () => {
// arrange
const a = 1
const b = 2
// act
const sum = a + b
// assert
expect(sum).toBe(3)
})Why AAA?
Tests that follow the AAA pattern are easier to read and easier to modify. Reviewers can locate the setup, the action under test, and the expectations at a glance. The pattern also nudges authors to keep tests small and focused.
aaa-lint turns this convention into a mechanical check so it survives code review fatigue and onboarding turnover.
Supported languages
| Language | Linter | Package |
|---|---|---|
| JavaScript / TypeScript | ESLint | eslint-plugin-aaa-pattern |
| Ruby | RuboCop | rubocop-aaa |
| PHP | PHP_CodeSniffer | phpcs-aaa |
All three implementations share the same option surface (labels, testFunctions, caseSensitive, allowEmptySection) so projects that mix languages can keep their configuration consistent.
Customizing labels
The default labels are English — arrange, act, assert. You can override them for any language or style:
{
"labels": {
"arrange": ["given"],
"act": ["when"],
"assert": ["then"]
}
}Multiple accepted spellings per section are supported, which is handy when team members naturally write slightly different wording:
{
"labels": {
"arrange": ["準備", "前準備"],
"act": ["実行"],
"assert": ["検証", "確認"]
}
}Next steps
Pick the plugin for your stack and follow its setup guide: