Laint

raw JSON →
0.1.7 verified Fri May 01 auth: no javascript

Laint is an AI-focused linting SDK for JSX/TSX code, currently at v0.1.7 with weekly releases. It provides 50+ programmatic lint rules targeting React, React Native, Expo, and backend development, designed to be used by AI agents (e.g., Claude Code) via hooks. Unlike ESLint, Laint focuses on AI-generated code patterns like no-relative-paths, no-manual-retry-loop, and prefer-guard-clauses, and supports platform-specific rule sets (expo, web, backend). It offers include/exclude mode and a CLI, with zero setup for Claude Code integration.

error Cannot find module 'laint'
cause Package not installed or path incorrect.
fix
Run npm install laint and ensure node_modules contains it.
error 'lintJsxCode' is not exported from 'laint'
cause Using CommonJS require and destructuring incorrectly, or importing from wrong path.
fix
Use import { lintJsxCode } from 'laint' (ESM only).
error TypeError: laint__WEBPACK_IMPORTED_MODULE_0__.lintJsxCode is not a function
cause Using default import instead of named import.
fix
Change import laint from 'laint' to import { lintJsxCode } from 'laint'.
error Exit code 1 on clean file
cause Running in file mode; exit code 1 indicates violations found.
fix
Use --hook flag for Claude Code integration to get exit code 2 on violations.
breaking Laint is v0.x and may introduce breaking changes without major version bump.
fix Pin to exact version and test upgrades.
deprecated The rule 'no-type-assertion' was deprecated in v0.1.6 and may be removed.
fix Use prefer-guard-clauses or type guards instead.
gotcha Exclude mode requires explicit 'rules' array even if empty: `{ rules: [], exclude: true }` runs all rules.
fix Always provide an array for 'rules' when using exclude mode.
gotcha Platform mode: 'platform' option ignores 'rules' array; only 'platform' property is used.
fix Use platform: 'expo' or others; setting both rules and platform may behave unexpectedly.
gotcha CLI exit code 2 in hook mode prints violations to stderr; code 0/1 reads stdout.
fix When integrating with Claude Code, check stderr for violations.
npm install laint
yarn add laint
pnpm add laint

Shows programmatic linting with lintJsxCode and how to retrieve all rule names.

import { lintJsxCode, getAllRuleNames } from 'laint';

const code = `
  <Link href="./profile">Profile</Link>
  <Button onPress={() => router.navigate('../settings')} />
`;

// Run specific rules
const results = lintJsxCode(code, {
  rules: ['no-relative-paths', 'expo-image-import', 'fetch-response-ok-check'],
});

console.log(results);
// [
//   { rule: 'no-relative-paths', message: 'Use absolute paths...', line: 2, column: 14, severity: 'error' },
//   { rule: 'no-relative-paths', message: 'Use absolute paths...', line: 3, column: 41, severity: 'error' }
// ]

// Get all rule names
console.log(getAllRuleNames());
// ['no-relative-paths', 'expo-image-import', ...]