@veriff/eslint-config
This package includes different ESLint configurations that enforce code style rules and best practices for JavaScript,
TypeScript, and React projects.
Usage
At first, install eslint
and the package:
npm i -D eslint @veriff/eslint-config
There are 5 different configuration for different type of projects:
base
– plain TypeScriptbase-javascript
– plain JavaScriptreact
– React / TypeScriptreact-javascript
– React / JavaScriptjest
– Jesttesting-library
– Testing library for React
To apply the configuration you need to add create a .eslintrc.json
file in the root with the following contents:
{
"extends": [
"@veriff/eslint-config/<config-name>"
]
}
For TypeScript-based projects you also must provide a path to tsconfig.json
to make ESLint understand the project
better:
{
"extends": [
"@veriff/eslint-config/<config-name>"
],
"parserOptions": {
"project": "path/to/tsconfig.json"
}
}
For example, the React / TypeScript application with tests (Jets + testing-library) with tsconfig.json
in the root
should have the following ESLint configuration:
{
"extends": [
"@veriff/eslint-config/react",
"@veriff/eslint-config/jest",
"@veriff/eslint-config/testing-library"
],
"parserOptions": {
"project": "./tsconfig.json"
}
}
Or the Node.js plain JavaScript application with tests should have the following configuration:
{
"extends": [
"@veriff/eslint-config/base-javascript",
"@veriff/eslint-config/jest"
]
}
Minimal
Considering the code style is pretty strict, it might be hard to migrate to it right away. So there are minimal
versions of the configs that include only essential best practices and prevent common issues (basically, they just don't
have Airbnb):
base-minimal
– plain TypeScriptbase-javascript-minimal
– plain JavaScriptreact-minimal
- React / TypeScriptreact-javascript-minimal
– React / Javascript
These configs are not permanent and exposed only for simplifying the migration process. They will be deprecated in the
next major release.