Skip to content

Commit

Permalink
chore: migrate to eslint v8
Browse files Browse the repository at this point in the history
Signed-off-by: Will Soto <willsoto@users.noreply.github.com>
  • Loading branch information
willsoto committed Nov 5, 2024
1 parent 658657e commit afb2fa7
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 34 deletions.
33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

70 changes: 70 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* eslint-disable */
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ["**/node_modules", "**/dist", "**/coverage", "**/typings"],
},
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: "commonjs",

parserOptions: {
tsconfigRootDir: "/Users/willsoto/code/nestjs-objection",
project: "./tsconfig.lint.json",
},
},
},
...compat.extends("plugin:mocha/recommended").map((config) => ({
...config,
files: ["test/**/*.ts"],
})),
{
files: ["test/**/*.ts"],

languageOptions: {
globals: {
...globals.mocha,
},
},

rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"no-unused-expressions": "off",
"no-magic-numbers": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-unused-expressions": "off",
},
},
];
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"devDependencies": {
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@istanbuljs/nyc-config-typescript": "1.0.2",
"@nestjs/common": "10.4.6",
"@nestjs/core": "10.4.6",
Expand All @@ -131,6 +133,7 @@
"eslint": "8.57.1",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-mocha": "10.5.0",
"globals": "^15.12.0",
"husky": "9.1.6",
"knex": "3.1.0",
"lint-staged": "15.2.10",
Expand Down
72 changes: 72 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tsconfig.lint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"ad-hocs/**/*.ts",
".*.js",
"*.js",
"*.ts"
"*.ts",
"*.mjs"
]
}

0 comments on commit afb2fa7

Please sign in to comment.