@robeasthope/eslint-config
v6.2.1
Published
Shared ESLint configuration with TypeScript and React support
Maintainers
Readme
@robeasthope/eslint-config
Shared ESLint v9 configuration with TypeScript and React support.
📦 Installation
Install the config along with ESLint:
pnpm add -D @robeasthope/eslint-config eslintThat's it! All ESLint plugins are bundled as dependencies, so you don't need to install them separately.
Migrating from v5.x
v6.0.0 introduces a breaking change: Type import style has changed from inline to top-level for React Router 7 compatibility.
# Update to v6.0.0
pnpm update @robeasthope/[email protected]
# Auto-fix most import style changes
pnpm lint:fixWhat changed:
// Before (v5.x - Inline Style)
import { useState, type FC } from "react";
// After (v6.0.0 - Top-Level Style)
import type { FC } from "react";
import { useState } from "react";Manual fixes required for mixed imports:
// Before
import { useState, type FC, type ReactNode } from "react";
// After - Split manually
import type { FC, ReactNode } from "react";
import { useState } from "react";If you overrode import rules for React Router 7, you can now remove those overrides as they're built-in.
See the full migration guide for details.
Migrating from v4.x
If you're upgrading from v4.x, you can remove the plugin dependencies:
# Update to v5.0.0+
pnpm update @robeasthope/eslint-config
# Remove plugin dependencies (now bundled)
pnpm remove astro-eslint-parser eslint-plugin-import-x \
eslint-plugin-jsdoc eslint-plugin-jsx-a11y eslint-plugin-n \
eslint-plugin-prettier eslint-plugin-promise eslint-plugin-react \
eslint-plugin-react-hooks eslint-plugin-regexp eslint-plugin-unicorn \
typescript-eslint🚀 Usage
In your eslint.config.js:
import eslintConfig from "@robeasthope/eslint-config";
export default [
...eslintConfig,
// your custom rules
{
rules: {
// override or add rules here
},
},
];Note: This config requires ESLint v9+ with flat config. For older ESLint versions, use
@robeasthope/[email protected].
✨ Features
This configuration includes:
- TypeScript Support: Full TypeScript linting with type checking
- React Support: React and JSX best practices
- React Router 7 Compatible: Top-level type imports for virtual module compatibility
- Modern JavaScript: ES2022+ features
- Code Quality: Enforces consistent code style
- Accessibility: Basic a11y checks for React components
📝 Rules Overview
Included Plugins
- TypeScript ESLint rules
- React hooks rules
- Import ordering and resolution
- Best practices for modern JavaScript
Key Rules
- Strict TypeScript checking
- React 19 compatible rules
- Top-level type imports (
import type { }instead ofimport { type }) - Consistent import ordering
- No unused variables or imports
- Consistent naming conventions
🛠️ Customization
Override Rules
You can override any rules by adding them to your local config:
export default [
...eslintConfig,
{
rules: {
"@typescript-eslint/no-explicit-any": "warn", // downgrade from error
"react/prop-types": "off", // disable prop-types
},
},
];Custom Plugin Configuration
If you need to configure plugins directly, install them separately:
import eslintConfig from "@robeasthope/eslint-config";
import pluginReact from "eslint-plugin-react";
export default [
...eslintConfig,
{
plugins: {
react: pluginReact,
},
rules: {
"react/jsx-uses-react": "error",
},
},
];🔧 Development
# Install dependencies
pnpm install
# Run linting on this package
pnpm lint
# Fix linting issues
pnpm lint:fix📄 License
MIT License - see LICENSE file in the root directory.
This software is provided "as is", without warranty of any kind. Use at your own risk.
