eslightning
v0.3.8
Published
Opinionated ESLint configurations for TypeScript projects
Maintainers
Readme
What's included?
- ESLint recommended rules
- TypeScript ESLint strict configuration
- Neostandard (modern JavaScript style guide)
- Vitest globals support
- Import sorting and validation
- Unused imports removal
- Prettier-compatible formatting
Setup
Node.js
Install the dependencies:
pnpm add -D eslightning eslint typescriptCreate an eslint.config.mjs file:
import node from 'eslightning/node'
export default [
...node,
]With custom ignores
import node from 'eslightning/node'
export default [
{
ignores: ['dist/**', 'node_modules/**'],
},
...node,
]Overriding rules
import node from 'eslightning/node'
export default [
...node,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
]Rules
TypeScript Strict
| Rule | Level | Description |
|------|-------|-------------|
| no-explicit-any | error | Disallow any type |
| consistent-type-assertions | error | Disallow as keyword (no type assertions) |
| no-unnecessary-type-assertion | error | Disallow unnecessary type assertions |
| no-unused-vars | warn | Warn on unused variables (ignores _ prefix) |
Code Style
| Rule | Level | Description |
|------|-------|-------------|
| max-len | warn | Maximum 120 characters per line |
| no-console | error | Disallow console (except console.error) |
| no-var | error | Require let or const instead of var |
| no-multiple-empty-lines | warn | Maximum 1 empty line |
Import Organization
Imports are automatically sorted in the following order:
- Node.js built-ins (
node:) - External packages
@nestjs/*packages@prisma/*packages- Project aliases (
@/core,@/domain,@/infra, etc.) - Relative imports
Additional import rules:
- Unused imports are automatically removed
- Import paths are validated
- Exports are sorted
Class Members
| Context | Blank Line | |---------|------------| | Between fields | Never | | Between methods | Always | | Between field and method | Always |
Testing (Vitest)
Vitest globals are available without imports:
describe,it,testexpect,vibeforeAll,afterAll,beforeEach,afterEach
Test files (*.test.ts, *.spec.ts) have relaxed padding rules.
Peer Dependencies
| Package | Version |
|---------|---------|
| eslint | >= 9.0.0 |
| typescript | >= 5.0.0 |
License
MIT
