89 lines
2.1 KiB
JavaScript
89 lines
2.1 KiB
JavaScript
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
import prettier from "eslint-plugin-prettier";
|
|
import tsParser from "@typescript-eslint/parser";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import js from "@eslint/js";
|
|
import { FlatCompat } from "@eslint/eslintrc";
|
|
|
|
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 [
|
|
...compat.extends(
|
|
"eslint:recommended",
|
|
"prettier",
|
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
),
|
|
{
|
|
files: ["./src/*.{ts,tsx}", "./test/*.{ts,tsx}"],
|
|
plugins: {
|
|
"@typescript-eslint": typescriptEslint,
|
|
prettier,
|
|
},
|
|
|
|
languageOptions: {
|
|
globals: {},
|
|
parser: tsParser,
|
|
ecmaVersion: 5,
|
|
sourceType: "script",
|
|
|
|
parserOptions: {
|
|
project: "./tsconfig.json",
|
|
},
|
|
},
|
|
|
|
rules: {
|
|
"prettier/prettier": "warn",
|
|
|
|
"spaced-comment": [
|
|
"error",
|
|
"always",
|
|
{
|
|
markers: ["/"],
|
|
},
|
|
],
|
|
|
|
"no-fallthrough": "error",
|
|
"@typescript-eslint/ban-ts-comment": "warn",
|
|
|
|
"@typescript-eslint/consistent-type-imports": [
|
|
"error",
|
|
{
|
|
prefer: "type-imports",
|
|
},
|
|
],
|
|
|
|
"@typescript-eslint/no-inferrable-types": [
|
|
"error",
|
|
{
|
|
ignoreParameters: false,
|
|
ignoreProperties: false,
|
|
},
|
|
],
|
|
|
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
"@typescript-eslint/no-floating-promises": "error",
|
|
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
args: "after-used",
|
|
argsIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
|
|
"@typescript-eslint/no-empty-function": ["error"],
|
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
},
|
|
},
|
|
];
|