@umapps/lint
v2.0.1
Published
Reusable ESLint config slices + custom rules for Ultra Mega Apps projects.
Keywords
Readme
@ultra-mega-apps/lint
Reusable ESLint config slices + custom rules for Ultra Mega Apps projects.
Install (monorepo local)
- Add as a workspace package (already in this repo):
- Root
package.jsonshould include"lint"inworkspaces. - Root
devDependencies:"@ultra-mega-apps/lint": "file:./lint".
- Root
Usage
In your repo’s root eslint.config.mjs:
import path from "node:path";
import { includeIgnoreFile } from "@eslint/compat";
import { createConfig } from "@ultra-mega-apps/lint";
// Captured during install; edit as needed
const tsProjects = [
// path.resolve("tsconfig.json"),
];
const base = createConfig({
tsProjects,
// testFiles default to ["**/*.test.ts", "**/*.spec.ts"]
// tsconfigRootDir: process.cwd(), // Optional if you use relative tsconfig paths
});
export default [includeIgnoreFile(path.resolve(".gitignore")), ...base];- Consumers may adjust
tsProjects,testFiles, or linter options passed tocreateConfig. - This package bundles ESLint, required plugins/configs (including
eslint-plugin-jsx-a11y), Prettier, and TypeScript as dependencies, so consumers only need to install@ultra-mega-apps/lint.
What’s included
- Airbnb-based strict rules + Prettier integration
- TypeScript + React slices
- Custom rules:
- empty-line-after/var blocks, let/const spacing
- min identifier length
- numeric literal separators
- padding around braces/if/try
- disallow nullish coalescing in returns
- Playwright: disallow
page.locator
Rule details
- pad-around-if: requires a blank line before
if(except first in block orelse if) and after standaloneifwhen the next token is not}. A comment may appear directly above anifwithout an extra blank line.
Notes
- This package does not read
.gitignore. Consumers decide ignore strategy (e.g.,includeIgnoreFile). - This package does not guess tsconfig paths; pass them in explicitly.
CLI
Run without installing anything in the target project (one-off fix):
npx @ultra-mega-apps/lint fix <dir>Install and wire ESLint config + scripts into a project:
npx @ultra-mega-apps/lint install <dir>This writes a minimal eslint.config.mjs with a literal tsProjects array discovered during install, adds lint and lint:fix scripts if missing, and runs npm i -D @ultra-mega-apps/lint.
Additionally, install will:
- Create an empty
.gitignoreif it does not exist (so the generated ESLint config can include it viaincludeIgnoreFile). - Create or update
.vscode/settings.jsonwith"eslint.useFlatConfig": "auto"for a smoother VS Code experience with ESLint v9 flat config. - Create or update
prettierrc.jsonto ensure{ "printWidth": 120 }.
To skip installing dependencies (useful in CI or when testing), pass:
npx @ultra-mega-apps/lint install <dir> --skip-deps