@imtf/eslint-config
v1.4.0
Published
Shared ESLint flat configs for IMTF projects
Keywords
Readme
IMTF ESLint 9 configurations
This package contains the ESLint configurations for the IMTF javascript / typescript projects.
Installation
npm install --save-dev @imtf/eslint-configUsage
Create a eslint.config.js file in the root of your project and extend the desired configuration.
import { react, recommended, defineConfig } from "@imtf/eslint-config";
export default defineConfig([
...recommended,
// If your project uses React, then also use specific rules
...react,
]);And voilà, you are good to go !
Additional setup for typescript / react projects
If your project uses typescript, you will have to configure the @typescript-eslint/parser parser in your eslint.config.js file.
You can do this by adding the following code to your configuration file:
import { react, recommended, defineConfig } from "@imtf/eslint-config";
export default defineConfig([
...recommended,
...react,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
settings: {
react: {
version: "detect",
},
"import-x/resolver": {
typescript: {
project: import.meta.dirname,
},
},
},
},
]);Rules
For more details about the rules, please refer to the GitHub repository.
As there is some new rule that has been enforced, you might have a lot of warnings / errors not showing up before in your project. As such, you might want to disable some of them and fix them progressively.
Migrate from @imtf/eslint-config-react
If you were using the @imtf/eslint-config-react package, you can easily migrate to the new package by following these steps:
1. Remove the @imtf/eslint-config-react package from your project:
npm uninstall @imtf/eslint-config-react2. Also remove eslint and prettier
They where previously peer dependencies of the @imtf/eslint-config-react package, but are now direct dependencies of the @imtf/eslint-config package.
npm uninstall eslint prettier3. Install the new @imtf/eslint-config package:
npm install --save-dev @imtf/eslint-config4. Create a eslint.config.js file:
Have a look at the Usage section for more details. You will also probably want to reapply the custom rules you had in your previous configuration.
5. Remove the old .eslintrc config file.
Or any other ESLint < 9 configuration file you had.
