yarn add -D @eslint-community/eslint-plugin-eslint-comments eslint
yarn add -D git+https://github.com/runtimeverification/eslint-config-rv-web-nestjs.git#master
npm install --save-dev @eslint-community/eslint-plugin-eslint-comments eslint prettier
npm install --save-dev git+https://github.com/runtimeverification/eslint-config-rv-web-nestjs.git#master
Create eslint.config.js
in the root of your project and add the following configuration and adjust the settings to your needs
// eslint.config.js
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import { fileURLToPath } from 'node:url';
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments';
import rv from 'eslint-config-rv-web-nestjs';
import path from 'node:path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig([
{
ignores: [
// files that should be ignored
'**/.eslintrc.js',
'src/@generated/**',
'build/**',
'build-web/**',
],
},
{ plugins: { '@eslint-community/eslint-comments': eslintComments } },
// ⬇️ flatten the shared config (no nested `extends`)
...rv,
// Custom rules
{
rules: {
'unicorn/prevent-abbreviations': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'unicorn/filename-case': [
'error',
{
cases: {
kebabCase: false,
pascalCase: false,
camelCase: true,
},
},
],
},
},
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
// path to your tsconfig
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
globals: { ...globals.node, ...globals.jest },
},
plugins: { '@typescript-eslint': tsPlugin },
},
]);
Create .prettierrc
in the root of your project and add the following configuration
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2
}
{
"scripts": {
"format": "prettier --config .prettierrc --write .",
"lint": "eslint",
"fix": "eslint --fix"
}
}