Package Exports
- @sanity/eslint-config-cli
- @sanity/eslint-config-cli/eslint.config.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sanity/eslint-config-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@sanity/eslint-config-cli
Shared ESLint configuration for Sanity CLI packages.
Installation
npm install --save-dev @sanity/eslint-config-cli eslintor with pnpm:
pnpm add --save-dev @sanity/eslint-config-cli eslintUsage
Create an eslint.config.mjs file in your project root:
import eslintConfig from '@sanity/eslint-config-cli'
export default [
...eslintConfig,
// Add your custom rules here
]You can also extend or override specific rules:
import eslintConfig from '@sanity/eslint-config-cli'
export default [
...eslintConfig,
{
rules: {
// Override or add custom rules
'@typescript-eslint/no-explicit-any': 'warn',
},
},
]What's Included
This configuration includes:
- ESLint recommended rules - Core ESLint best practices
- TypeScript ESLint - TypeScript-specific linting rules
- Import plugin - Validates proper imports and prevents cycles
- Node.js plugin - Node.js best practices
- Unicorn plugin - Additional best practices and modern patterns
- Perfectionist plugin - Automatic sorting of imports, objects, and interfaces
- TSDoc plugin - Validates TSDoc comments
- Unused imports - Automatically detects and reports unused imports
- Prettier compatibility - Works seamlessly with Prettier
Configuration Details
The configuration enforces:
- Natural sorting of imports with proper grouping
- Consistent code formatting
- TypeScript best practices
- Import validation and cycle detection
- Unused import detection
- Proper TSDoc syntax
License
MIT © Sanity.io