This package provides shared eslint
configurations with eslint 9 flat config. It includes two
presets:
base
- A standard configuration for TypeScript projects at Leather.react
- An additional setup for React projects to use withbase
.
You don’t need to install or link this package within monorepo packages. The base config
is applied to all packages and apps by default. To add custom configurations (e.g., React) for a
new package or app, add a new configuration object into eslint-config.js
file at the root of the
monorepo:
export default tseslint.config(
{...existingConfigs},
{
name: 'your-new-package-name',
files: ['packages/your-package-path/src/**/*.{ts,tsx}'],
extends: [reactConfig],
rules: {
// additional rules for the package
}
}
)
- Install the package:
npm install --save-dev @leather.io/eslint-config
- Make sure all peer dependencies for this package are installed in your repository as devDependencies. The list of dependencies can be found here or by running the following command:
npm info "@leather.io/eslint-config@latest" peerDependencies
- Configure
eslint.config.js
:
import { baseConfig, reactConfig } from '@leather.io/eslint-config';
export default [
...baseConfig,
...reactConfig, // Add for React projects
];
Refer to Running code quality checks with git hooks for information on how checks are run in the monorepo.
Outside the monorepo, add an npm script in package.json
to run eslint
, e.g.:
"lint": "eslint"
.