@nextnode/eslint-plugin v1.1.0
@nextnode/eslint-plugin
A comprehensive ESLint configuration package for TypeScript and React projects, optimized for Next.js applications.
Features
- 🔧 TypeScript support with strict type checking
- ⚛️ React and React Hooks rules
- 🚀 Next.js specific rules and optimizations
- 📦 Import sorting and organization with path groups
- 🎯 Modern JavaScript features support
- 🌐 Node.js and Browser globals
- ⚠️ Only warnings mode (no errors that break builds)
Installation
pnpm add -D @nextnode/eslint-plugin eslint@^9.22.0Note: This package requires ESLint v9.22.0 or higher and uses the new flat config format.
Quick Start
Base Configuration (TypeScript)
For a basic TypeScript setup:
// eslint.config.js
import nextnodeEslint from '@nextnode/eslint-plugin/base'
export default nextnodeEslintReact Configuration
For React projects:
// eslint.config.js
import nextnodeEslint from '@nextnode/eslint-plugin/react'
export default nextnodeEslintNext.js Configuration
For Next.js projects:
// eslint.config.js
import nextnodeEslint from '@nextnode/eslint-plugin/next'
export default nextnodeEslintConfiguration Details
Base Configuration Features
- TypeScript Parser: Uses
@typescript-eslint/parserwith project-aware type checking - Import Management: Automatic import sorting with custom path groups for React, Next.js, and internal modules
- Modern JavaScript: Support for latest ECMAScript features
- Globals: Includes both Node.js and browser globals
- File Extensions: Supports
.mjs,.cjs,.js,.jsx,.ts,.tsx
Import Sorting Rules
The configuration includes intelligent import sorting with the following groups:
- Built-in and external packages (React, Next.js prioritized)
- Internal modules
- Relative imports (sibling, parent, index)
- Object imports
- Type imports
Example of sorted imports:
import React from 'react'
import { NextPage } from 'next'
import { Button } from '@mui/material'
import { utils } from '@/lib/utils'
import { Header } from '../components/Header'
import { Footer } from './Footer'
import type { User } from '@/types/user'Advanced Usage
Extending Configuration
You can extend any configuration and override specific rules:
// eslint.config.js
import nextnodeEslint from '@nextnode/eslint-plugin/base'
export default [
...nextnodeEslint,
{
rules: {
// Override specific rules
'@typescript-eslint/explicit-function-return-type': 'off',
'import-x/order': ['error', {
groups: [
['builtin', 'external'],
'internal',
['sibling', 'parent', 'index'],
'object',
'type'
],
'newlines-between': 'always'
}]
}
}
]Custom Ignores
Add custom ignore patterns:
// eslint.config.js
import nextnodeEslint from '@nextnode/eslint-plugin/base'
export default [
...nextnodeEslint,
{
ignores: [
'dist/',
'build/',
'*.generated.ts'
]
}
]Dependencies
This package includes and configures the following ESLint plugins:
Core
eslint- The core ESLint linter@eslint/js- ESLint's recommended JavaScript rules
TypeScript Support
typescript- TypeScript compiler@typescript-eslint/parser- TypeScript parser for ESLinttypescript-eslint- TypeScript-specific ESLint rules
React & Next.js
@next/eslint-plugin-next- Next.js specific ruleseslint-plugin-react- React specific ruleseslint-plugin-react-hooks- React Hooks rules
Import Management
eslint-plugin-import-x- Import/export syntax ruleseslint-import-resolver-typescript- TypeScript import resolution
Utilities
eslint-plugin-only-warn- Converts all errors to warningsglobals- Global variables definitions
Requirements
- Node.js: >= 20.0.0
- TypeScript: >= 5.8.2
- ESLint: >= 9.22.0
Troubleshooting
Common Issues
"Cannot find module" errors: Ensure your
tsconfig.jsonis properly configured and in the project root.Import resolution issues: Make sure your TypeScript paths are correctly set up in
tsconfig.json.Performance issues: For large projects, consider using
project: ['./tsconfig.json']instead ofproject: truein your TypeScript parser options.
Changesets & Version Management
This project uses Changesets for automated version management and publishing.
Quick Changeset Guide
When making changes that should trigger a version bump:
pnpm changesetThis will prompt you to:
1. Select which packages to bump (@nextnode/eslint-plugin)
2. Choose the change type:
- patch (1.0.0 → 1.0.1): Bug fixes, documentation updates
- minor (1.0.0 → 1.1.0): New features, new rules
- major (1.0.0 → 2.0.0): Breaking changes
- Provide a summary of your changes
Automated Workflow
- PR Creation: Changeset-check ensures a changeset is present
- Merge to Main: Creates a "Version Packages" PR automatically
- Version PR Merge: Publishes the new version to npm
Manual Commands
# Create a changeset
pnpm changeset
# Apply changesets and update versions (automated)
pnpm changeset:version
# Publish to npm (automated)
pnpm changeset:publishFor detailed information, see our Changesets Documentation and the official Changesets Documentation.
Contributing
When contributing to this project:
- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm changesetto create a changeset describing your changes - Commit the changeset file along with your changes
- Create a Pull Request
The changeset workflow will automatically handle versioning and publishing once your PR is merged.
License
ISC © Walid M