Configuration and rules for ESLint, Prettier and TypeScript.
We recommend and assume your project to have TypeScript.
Add this package
yarn add -D @valtech-ch/eslint-config
Add peer dependencies (for existing projects maybe you prefer to add them manually)
npx install-peerdeps -D @valtech-ch/eslint-config
This package contains configurations and rules:
@valtech-ch/eslint-config/config
@valtech-ch/eslint-config/plugins
@valtech-ch/eslint-config/rules
@valtech-ch/eslint-config/config/react
@valtech-ch/eslint-config/plugins/react
@valtech-ch/eslint-config/rules/react
@valtech-ch/eslint-config/config/react
@valtech-ch/eslint-config/plugins/react
@valtech-ch/eslint-config/rules/nextjs
-
To setup ESLint, create a
.eslintrc.js
file with- this content if you want our given config:
module.exports = {
extends: [
'@valtech-ch/eslint-config/config',
'@valtech-ch/eslint-config/plugins',
'@valtech-ch/eslint-config/rules',
],
}
- or this content if you want your own config instead:
module.exports = {
// your custom config
extends: [
'@valtech-ch/eslint-config/plugins',
'@valtech-ch/eslint-config/rules',
],
}
-
To setup Prettier, create a
prettier.config.js
file with this content:module.exports = require("@valtech-ch/eslint-config/prettier.config")
-
To setup TypeScript, create a
tsconfig.json
file with- this content for non-React projects:
{ "extends": "@valtech-ch/eslint-config/tsconfig" }
- this content for React projects:
{ "extends": "@valtech-ch/eslint-config/tsconfig.react" }