# eslint-config — Agent usage Configure a coding agent for @nexload-sdk/eslint-config. **Topic:** agents **Package:** `@nexload-sdk/eslint-config` v9.39.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/eslint-config/agents/ ## Install matching skills These are shared engineering skills. ### nexload-way [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/nexload/way/SKILL.md) ```text MUST load before writing or refactoring TypeScript or React in a project that follows the nexload way: creating, naming, moving or splitting a file, module, component or helper; extracting repeated code; exports; branching on a union or status. Picks the file role, module location and helper rung. Lint and enola enforce the mechanical rules. ``` ```bash npx skills add gecut/nexload-sdk --skill nexload-way ``` ### nexload-package [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/nexload/package/SKILL.md) ```text Use when the primary task changes or evaluates the shipped contract of a publishable Nexload TypeScript package: ownership, public exports and subpaths, entrypoint runtime isolation, core/adapter direction where shared policy exists, metadata, dependencies or peers, packed artifacts, package-scoped compatibility, or README/API alignment. Do not use for internal-only code, React behavior, visual styling, repository-wide runtime standards, or release execution. ``` ```bash npx skills add gecut/nexload-sdk --skill nexload-package ``` ## Doctrine (opt-in) Enable the `nexload-way` rules (file roles, import boundaries, size limits) per project: ```js import { nexloadConfig } from "@nexload-sdk/eslint-config"; export default nexloadConfig({ doctrine: true }); ``` The exported `doctrineConfig` (also at `@nexload-sdk/eslint-config/doctrine`) can be spread into a custom flat config instead. The option is off by default; existing projects are never migrated implicitly. Whole-project moves: [Migrate a Project to the nexload Way](/nexload-sdk/standards/nexload-way-migration/). The `nexload-doctrine` bin ships with the package: ```bash pnpm exec nexload-doctrine names pnpm exec nexload-doctrine suggest --kind pnpm exec nexload-doctrine verify [--base ] ``` * `names` checks file names and prints violations. * `suggest` prints the correct file name and export symbol for a role. Verb-named roles (`util`, `service` and the Payload `before-*` / `after-*` hooks) print a `` symbol hint, such as `Slug`. A junk-drawer name (`utils`, `helpers`, `common`) exits `2`: split the file by responsibility first. * `verify` runs ESLint and the name check on changed files, then `enola check` on the whole repository. A missing tool prints `: not run ()`. An installed ESLint that crashes or prints unreadable output prints `eslint: failed (eslint exit )` and its error line, and counts as a failure. A file-name finding reported by both the name check and ESLint's `nexload/file-role` rule is printed and counted once. The last line is `verify: violation(s); not run: ...`. The skill also ships inside the package at `node_modules/@nexload-sdk/eslint-config/skills/nexload-way/`. Without a bin, run `node node_modules/@nexload-sdk/eslint-config/skills/nexload-way/scripts/doctrine.mjs verify`. ### AGENTS.md block Paste into the consumer project's `AGENTS.md`: ```markdown ## Code conventions — MANDATORY Load the installed `nexload-way` skill before you create, name, move or split a file, module, component or helper, or extract repeated code. Open only the reference its index names. - File name: `[_].[.server|.client].`; `` never repeats the folder name. No `export default` outside framework-mandated files. Branch on unions with `match().exhaustive()`, not `switch`. - Lint and check messages start with a rule ID (for example `[ST-06]`). Fix the code; never suppress the rule. - Before reporting done, run `pnpm lint` and `pnpm exec nexload-doctrine verify`. Report any check that did not run as not run. Install: `npx skills add gecut/nexload-sdk --skill nexload-way` (also at `node_modules/@nexload-sdk/eslint-config/skills/nexload-way/`). ``` ## Project AGENTS.md ```markdown For @nexload-sdk/eslint-config, load nexload-way when its trigger matches. Read the package bundle and check public exports against the installed version before editing. ``` ## Package context [Scoped Markdown bundle](/nexload-sdk/packages/eslint-config/llms.txt). ## Prompts ```text Configure ESLint for the project runtime. Use @nexload-sdk/eslint-config and nexload-way. Inspect the installed version and show a minimal typed example for my project. ``` ```text Review my @nexload-sdk/eslint-config integration against the optimization page. Identify the relevant source for each finding and one test for the highest-risk behavior. ``` --- # eslint-config — Configuration reference Exported configuration entries for @nexload-sdk/eslint-config. **Topic:** api **Package:** `@nexload-sdk/eslint-config` v9.39.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/eslint-config/api/ ## Public entries * `.` * `./base` * `./base.js` * `./node` * `./node.js` * `./react` * `./react.js` * `./nextjs` * `./nextjs.js` * `./payload` * `./payload.js` * `./*` * `./*.js` ## Usage Use the default nexloadConfig factory or compose named presets for base, node, react, nextjs and payload. The .js aliases resolve through the package export map. [Package manifest](https://github.com/gecut/nexload-sdk/blob/main/tools/eslint-config/package.json). --- # Configuration Guides & Recipes Type-aware linting with projectService, customizing factory rules, and migrating from legacy .eslintrc. **Topic:** guides **Package:** `@nexload-sdk/eslint-config` v9.39.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/eslint-config/guides/ ## Type-Aware Linting with `projectService` `@nexload-sdk/eslint-config` uses `typescript-eslint` v8's `projectService: true` instead of static `project: "./tsconfig.json"` arrays. ### Benefits of `projectService` * **Dynamic Project Discovery**: Resolves `tsconfig.json` contexts automatically per file without parsing slow monolithic solution files. * **Standalone Script Safety**: Standalone configuration scripts (`eslint.config.mjs`, `esbuild.config.mjs`) are automatically parsed without triggering type-information crashes. * **Zero Configuration Boilerplate**: No need to maintain manual tsconfig path lists in your lint config. ```js title="eslint.config.mjs" import { nexloadConfig } from "@nexload-sdk/eslint-config"; export default nexloadConfig({ typeAware: true, // Enables full type-checked rules }); ``` *** ## Customizing Rules with `nexloadConfig` The `nexloadConfig` factory accepts custom rules, extra flat configs, and custom ignore patterns: ```js title="eslint.config.mjs" import { nexloadConfig } from "@nexload-sdk/eslint-config"; export default nexloadConfig({ framework: "next", ignores: [ "dist/**", ".next/**", "public/static/**", ], rules: { // Override or add project-specific rules safely "no-console": ["warn", { allow: ["warn", "error"] }], }, extraConfigs: [ { files: ["scripts/**/*.mjs"], rules: { "no-console": "off", }, }, ], }); ``` *** ## Prettier Integration & Zero Conflicts Many teams experience conflicts between ESLint stylistic rules and Prettier. `@nexload-sdk/eslint-config` handles this deterministically: 1. **Semantic Padding Preserved**: `@stylistic/padding-line-between-statements` handles logical separation lines between statements and returns. 2. **Prettier Conflict Termination**: `eslint-config-prettier` is applied as the final configuration object in the flat config chain. It turns off all formatting rules that might fight Prettier (quotes, semicolons, indentations). 3. **Format Separation**: Use Prettier for syntax formatting (`prettier --write .`) and ESLint for structural, semantic, and type rules (`eslint --fix .`). *** ## Migrating from Legacy `.eslintrc.js` To migrate a repository from ESLint 8 (`.eslintrc.*`) to `@nexload-sdk/eslint-config`: ### Step 1: Remove Deprecated Dependencies ```bash pnpm remove eslint-plugin-import eslint-plugin-only-warn @typescript-eslint/parser @typescript-eslint/eslint-plugin ``` ### Step 2: Delete Old Config & Ignore Files Remove legacy files from the repository root: * `.eslintrc.js`, `.eslintrc.json`, or `.eslintrc.yml` * `.eslintignore` (migrated to `ignores` in flat config) ### Step 3: Create `eslint.config.mjs` ```js title="eslint.config.mjs" import { nexloadConfig } from "@nexload-sdk/eslint-config"; export default nexloadConfig({ framework: "node", // Select: "node", "react", "next", or "payload" }); ``` ### Step 4: Update Package Scripts ESLint 9 Flat Config lints JavaScript and TypeScript by default. Remove deprecated `--ext` flags from `package.json`: ```json title="package.json" { "scripts": { "lint": "eslint .", "lint:fix": "eslint --fix ." } } ``` ### Step 5: Run Automated Fixes ```bash pnpm lint:fix ``` This automatically sorts imports according to perfectionist groupings, normalizes statement spacing, and surfaces any remaining strictness errors. --- # Overview & Quick Start Strict, zero-compromise ESLint 9 Flat Config enforcing clean architecture, deterministic imports, and zero-any rules. **Topic:** overview **Package:** `@nexload-sdk/eslint-config` v9.39.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/eslint-config/ **Package:** `@nexload-sdk/eslint-config` **Workspace version:** `9.39.3` Shared authoritative ESLint configurations for the Nexload SDK monorepo [npm](https://www.npmjs.com/package/@nexload-sdk/eslint-config) · [Source](https://github.com/gecut/nexload-sdk/tree/main/tools/eslint-config) `@nexload-sdk/eslint-config` provides a unified, strict ESLint 9 Flat Config system for TypeScript repositories. Built on `typescript-eslint` v8, `eslint-plugin-perfectionist`, and `eslint-plugin-unicorn`, it enforces clean architectural discipline, deterministic import order, semantic whitespace padding, and zero-`any` type safety. *** ## 10-Second Code Snippet Create `eslint.config.mjs` in your project root using the `nexloadConfig()` universal factory: ```js title="eslint.config.mjs" import { nexloadConfig } from "@nexload-sdk/eslint-config"; export default nexloadConfig({ framework: "next", // "next" | "react" | "node" | "payload" | "none" typeAware: true, }); ``` *** ## The Enforced Mental Model This configuration enforces unambiguous, production-grade engineering standards: ### 1. Mandatory Kebab-Case Filenames (`unicorn/filename-case`) Every file in your source tree must use `kebab-case.ts`. CamelCase, PascalCase, or snake\_case file names trigger compile-blocking linter errors. ```text ✅ src/user-profile.ts ✅ src/auth-guard.spec.ts ❌ src/UserProfile.ts ❌ src/user_profile.ts ``` ### 2. Deterministic Perfectionist Imports (`perfectionist/sort-imports`) Imports are automatically organized alphabetically into strict semantic groups separated by blank lines: 1. Type imports (`import type { ... }`) 2. Node.js built-ins (`node:fs`, `node:path`) 3. External dependencies (`react`, `zod`, `payload`) 4. Internal ecosystem packages (`@nexload-sdk/*`) 5. Parent & sibling relative imports (`../`, `./`) ### 3. Absolute Zero-`any` Policy (`@typescript-eslint/no-explicit-any`) Using `any` is treated as a hard error. Types must be properly narrowed at boundary points using unknown, generics, type guards, or Zod schemas. ### 4. Semantic Whitespace Padding (`@stylistic/padding-line-between-statements`) Blank lines are enforced around returns, classes, exports, and multi-line declarations to eliminate visual clutter and ensure code remains human-readable and AI-friendly. ### 5. Floating Promise Prevention (`@typescript-eslint/no-floating-promises`) Async operations must be explicitly awaited or handled with `.catch()`. Unhandled background promises fail CI immediately. *** ## Available Presets & Factory | Preset Export | Target Environment | Included Plugins | |---|---|---| | `baseConfig` | Universal TypeScript foundation | `typescript-eslint`, `perfectionist`, `unicorn`, `@stylistic`, `prettier` | | `nodeConfig` | Node.js backend services | Base + Node globals and environment rules | | `reactConfig` | React libraries & SPAs | Base + `react-hooks` | | `nextjsConfig` | Next.js App Router | Base + `react-hooks` + `@next/eslint-plugin-next` | | `payloadConfig` | Payload CMS applications | Base + `react-hooks` + Payload-specific admin & server boundary rules | | `nexloadConfig(options)` | Universal configurable factory | Combines presets, custom rules, ignores, and overrides in one call | *** ## Installation & Requirements ```bash pnpm add -D @nexload-sdk/eslint-config eslint@^9.0.0 typescript ``` Peer requirements: `eslint >= 9.0.0`, `typescript >= 5.0.0`. ## Next steps [Optimization](./optimization/) [Agent usage](./agents/) --- # eslint-config — Optimization Production choices for @nexload-sdk/eslint-config. **Topic:** optimization **Package:** `@nexload-sdk/eslint-config` v9.39.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/eslint-config/optimization/ ## Choose the runtime preset Use nexloadConfig with the options for the project runtime. Compose exported presets when explicit ordering is needed. ## Keep type-aware linting enabled Use the shared base rules for type-aware checks and inline type imports. ## Use project service for typed rules The base configuration uses TypeScript project service for type-aware linting. Ensure the project has a suitable TypeScript configuration. ## Compose overrides after the preset Pass custom rules or ignores as additional arguments to `nexloadConfig`, or compose the exported preset arrays in the order needed. ## Sources [Package guidance](https://github.com/gecut/nexload-sdk/blob/main/tools/eslint-config/README.md) · [Implementation](https://github.com/gecut/nexload-sdk/blob/main/tools/eslint-config/src/index.ts).