This package is a shared configuration file for ESLint. To use this config, follow the installation instructions.
Install the following packages:
eslint@ivao/eslint-config
npm add --save-dev eslint @ivao/eslint-config or
yarn add -D eslint @ivao/eslint-config or
pnpm add -D eslint @ivao/eslint-config
You must add a eslint.config.(m)js file to your project to use this config package:
import ivaoConfig from '@ivao/eslint-config';
export default [
...ivaoConfig.configs.base,
...ivaoConfig.configs.prettier,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['eslint.config.(m)js'],
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
tsconfigRootDir: import.meta.dirname,
},
},
},
];The package provides 5 configuration presets and 2 setups.
The base configuration for all projects.
Enables the prettier plugin.
Enables many React ESLint plugins. Checkout src/react.ts for more information. Tip: you can always disable some specific rules in your eslint.config.(m)js file by appending a new block to the export array in which you can overwrite any settings.
Enables the react-refresh plugin, which is used for hot reloading in development. The rule option allowConstantExport is enabled by default, and should be disabled for non-vite environemnts.
Enables rules and plugins for Storybook development.
For this config to work, install eslint-plugin-storybook in your project. It is
an optional peer dependency because its dependency tree includes Storybook,
which is only needed by some projects.
npm add --save-dev eslint-plugin-storybook or
yarn add -D eslint-plugin-storybook or
pnpm add -D eslint-plugin-storybook
import ivaoConfig from '@ivao/eslint-config';
export default [
// ...
...ivaoConfig.configs.storybook(),
];Enables ESLint rules for TailwindCSS.
This rule is not enabled automatically, because at time of writing, the eslint tailwind plugin does not support tailwind v4.
Works for tailwind v3 only!
import ivaoConfig from '@ivao/eslint-config';
import ivaoTaliwindConfig from '@ivao/eslint-config/tailwind';
export default [
// ...
...ivaoTaliwindConfig,
// ...
];The setup enables the configs base, prettier, react.
The setup enables the configs base, react.