From 222492a3f9811ddcb2d6fdf71b5815ed2fec63f4 Mon Sep 17 00:00:00 2001 From: skarab42 Date: Wed, 13 Jul 2022 18:07:34 +0200 Subject: [PATCH] fix: force tsconfigRootDir to __dirname --- .eslintrc.cjs | 31 +++++++++++++++++++++++++++++++ .eslintrc.json | 31 ------------------------------- tsconfig.eslint.json | 10 ++++++++++ 3 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 .eslintrc.cjs delete mode 100644 .eslintrc.json create mode 100644 tsconfig.eslint.json diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..7edb008 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,31 @@ +module.exports = { + root: true, + env: { es2022: true, node: true, browser: false }, + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json', './tsconfig.*.json'], + }, + plugins: ['@typescript-eslint', 'unicorn'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/strict', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'prettier', + ], + rules: { + 'no-alert': 'error', + 'no-console': 'warn', + 'no-debugger': 'warn', + '@typescript-eslint/prefer-ts-expect-error': 'error', + '@typescript-eslint/explicit-function-return-type': 'error', + }, + settings: { + 'import/resolver': { + node: { extensions: ['.ts', '.js', '.cjs', '.mjs'] }, + }, + }, +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 236e1c9..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "root": true, - "env": { "es2022": true, "node": true, "browser": false }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "tsconfigRootDir": ".", - "project": ["./tsconfig.json", "./tsconfig.*.json"] - }, - "plugins": ["@typescript-eslint", "unicorn"], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:@typescript-eslint/strict", - "plugin:import/recommended", - "plugin:import/typescript", - "prettier" - ], - "rules": { - "no-alert": "error", - "no-console": "warn", - "no-debugger": "warn", - "@typescript-eslint/prefer-ts-expect-error": "error", - "@typescript-eslint/explicit-function-return-type": "error" - }, - "settings": { - "import/resolver": { - "node": { "extensions": [".ts", ".js", ".cjs", ".mjs"] } - } - } -} diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..7d78591 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.default.json", + "compilerOptions": { + "noEmit": true, + "module": "commonjs", + "target": "es2020", + "lib": ["es2020"] + }, + "include": [".eslintrc.cjs"] +}