lintapple README

The project's README from github.com/gholtzap/lintapple. As one markdown file: README.md.

lintapple logo

lintapple

It should be impossible for AI to make a bad UI.

npm · Demo

Install

Requires Node.js 22 or later. Run in your app’s project directory:

npm install -D lintapple && npx lintapple init

This creates ui-policy.json and a lint:ui script. Existing settings are kept. Set the fonts and text sizes in ui-policy.json to match your app. Set the app URL in the lint:ui script; the default is http://localhost:3000.

Use

Start your app, then run:

npm run lint:ui

Each finding includes the rule, element, measured value, and suggested fix. Exit codes: 0 passed, 1 findings, 2 check did not finish.

To check another URL or save a JSON report:

npx lintapple http://localhost:3000 --json

For a page that loads asynchronously, add --ready '[data-app-ready]' with a selector that is visible when the page is ready.

Use in Playwright

Add this to an existing test after the page is ready:

import { expectUI } from 'lintapple/playwright';

await expectUI(page, testInfo);

Findings fail the test and attach a JSON report. The helper reads your ui-policy.json. See the example tests.

Mark layout elements

Font, contrast, control size, and screen bounds checks work without extra markup. Add these attributes for checks that need layout information:

Attribute Use on
data-ui-stack A group whose child spacing must be checked.
data-ui-actions A button group whose gaps must be checked.
data-ui-container A surface whose button insets must be checked.
data-ui-number A changing number that needs equal digit widths.
data-ui-content A container whose text must stay inside its edges.
data-ui-align="start" A group whose marked elements must align. Use center or end for other alignments.
data-ui-align-item Each element to compare in an alignment group.
data-ui-radius An outer surface with equal corner radii and insets.
data-ui-radius-inner Its direct inner surface. Its radius must equal the outer radius minus the inset.

You can also use controlContainers in the policy to select existing button containers. See example styles.

License

MIT. See LICENSE.

lintapple (gholtzap/lintapple)

Searching Database…

What is this?lintapple is a CLI tool that checks a running web app's UI for layout and design mistakes AI coding tools commonly make, like bad fonts, low contrast, misaligned elements, and inconsistent spacing.
Is it a linter I run from the terminal, or a library I import into code?It is a CLI linter: installing it adds a ui-policy.json config and a lint:ui npm script that checks your running app's URL, and it also has a helper you can call from Playwright tests.
How do I add it to my project?Run the install command in your app's project directory; it creates ui-policy.json (where you set your fonts and sizes) and adds a lint:ui script pointing at your app's URL.
Do I need anything besides Node to run it?You need Node.js 22 or later, and your app must already be running locally so lintapple can check it at its URL.
Do all the checks work out of the box, or do I need to add markup?Font, contrast, control-size, and screen-bounds checks work with no extra markup, but spacing, alignment, and corner-radius checks need data-ui-* attributes added to your elements.
What do the exit codes mean when I run lint:ui?Exit code 0 means the check passed, 1 means it found UI issues, and 2 means the check itself failed to complete.
What information does each finding give me?Each finding reports the rule that was violated, the element involved, the measured value, and a suggested fix.
Can I check a different URL or save the results?Yes, lintapple lets you point it at another URL or save its output as a JSON report instead of just printing to the terminal.
Creator
gholtzap
Size
2 MB
Stars
499
Age
11d
Commits · 90 Days