react-linter-setup
React & TypeScript linter setup
This skill handles project setup for the company ESLint stack: installing dependencies, adding config files, custom rules, and package.json scripts. For applying and enforcing rules on existing code, use a coding-standards or review skill when available.
When to use this skill
- User wants to install or configure ESLint in a React/TypeScript project.
- User asks to add lint scripts, devDependencies, or ESLint flat config.
- User wants custom rules (e.g. TODO ticket reference) or to migrate to the company config.
- User mentions "setup linter", "eslint config", "lint setup", "add eslint to project".
Prerequisites
- Project has a
package.json(npm or yarn). - Project has a
tsconfig.json(ortsconfig.app.json) at the root — required forprojectService: truein the config. - Node.js 18+ (for ESLint 10 and flat config).
Setup checklist
Follow this order. Reference files are in assets/ and references/.
1. Dependencies
Install the listed devDependencies (see assets/package.json.snippet.json for example versions and structure). Prefer current compatible versions in real projects — the snippet is for illustration only. Merge into the project package.json or run:
yarn add -D eslint @eslint/js typescript-eslint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-testing-library globals
(or equivalent npm install -D ...). See references/dependencies-and-scripts.md for package list, example versions, and rationale.
2. ESLint config and TODO ticket rule (flat config — ESLint 9+)
- Copy assets/eslint.config.js to the project root (it includes the TODO ticket reference rule).
- Copy assets/eslint-rules/todo-ticket-ref.js to the repo (e.g.
eslint-rules/todo-ticket-ref.js). - Ensure
globalIgnoresmatch the project (e.g.dist, generated code). Adjust the rulepatternfor your ticketing tool (e.g. JIRA) if needed.
3. Scripts
Add to package.json scripts (same as in assets/package.json.snippet.json; versions in that file are examples only):
"lint": "eslint .",
"lint:fix": "eslint . --fix"
Use yarn or npm consistently with the rest of the project.
4. Verify
- Run
yarn lintornpm run lint. - Fix any environment issues (missing tsconfig, wrong ignores, parser options).
See assets/README.md for file list and quick reference.
Rules applied (summary)
The default config applies common React/TypeScript rules:
- Coding:
no-explicit-any,prefer-const,eqeqeq,no-nested-ternary,no-empty(catch),no-useless-catch,prefer-nullish-coalescing,consistent-indexed-object-style,max-depth - React:
no-array-index-key,jsx-fragments,react-hooks/* - Tests:
testing-library/prefer-screen-queries
Reference files
| Purpose | File |
|---|---|
| Dependencies & scripts | references/dependencies-and-scripts.md |
| Assets overview | assets/README.md |
Rules of thumb
- One config at root: Use a single
eslint.config.jsat the project root (flat config). - Match package manager: Use
yarnornpmconsistently for install and scripts. - Ignore generated code: Add generated or third-party paths to
globalIgnoresto avoid noisy violations. - TypeScript required: The config uses
projectService: true; do not use this skill for non-TypeScript projects without adapting the config.
More from lichens-innovation/ai-dev-tools
react-coding-standards
Enforces internal React and TypeScript coding standards using avoid/prefer rules. Use when reviewing or refactoring React/TS code, applying company standards, or when the user asks to align code with coding standards.
23generate-pr-description
Generates pull request descriptions by comparing current branch with parent branch. Creates semantic commit-style PR titles and fills PR templates. Use when the user asks to generate PR description, prepare pull request, or create merge request description. The user may include ticket IDs in the request (e.g. tickets: NN-123, TB-456) from the company tracking system; treat those as the related issue IDs for the PR.
20react-single-responsibility
Strategies to simplify components, hooks, and methods: decomposition order (utilities, hooks, sub-components), early returns, control flow, parameter design, and code smell fixes. Use when the user says: ungodify this method/function/component, simplify this method/function/component, make this method/function/component less complex; or when refactoring a large component, hook, or function, reducing complexity, applying single responsibility, or asking how to simplify a component, hook, or method.
19review-staged-changes
Reviews staged git changes for code quality, maintainability, readability, and potential regressions. Verifies changes make sense in context, improve maintainability, enhance readability, and don't introduce side effects. Use when reviewing staged changes, examining git diffs, or when the user asks to review modifications before committing.
14react-files-structure-standards
Enforces file and folder naming and structure standards for React/TypeScript projects. Use when normalizing file/folder names, auditing project structure, renaming files or directories, or when the user asks to align file/folder naming with standards.
13review-code-changes
Reviews code changes for quality, maintainability, readability, and potential regressions. Supports reviewing explicitly mentioned files, git staged files, or changes between branches. Verifies changes make sense in context, improve maintainability, enhance readability, and don't introduce side effects. Use when reviewing code changes, examining git diffs, reviewing staged changes, comparing branches, or when the user asks to review modifications.
3