import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import prettier from "eslint-plugin-prettier";
import prettierConfig from "eslint-config-prettier";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
prettierConfig,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
plugins: {
prettier,
},
rules: {
"prettier/prettier": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/require-await": "warn",
},
},
// Type-checked rules only for source files
{
files: ["src/**/*.ts"],
extends: [...tseslint.configs.recommendedTypeChecked],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
},
{
ignores: [
"dist/**",
"node_modules/**",
"*.js",
"*.d.ts",
"*.map",
"coverage/**",
"*.tgz",
"__tests__/**",
],
}
);