74 lines
1.5 KiB
TypeScript
74 lines
1.5 KiB
TypeScript
import js from "@eslint/js";
|
|
import tseslint from "typescript-eslint";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
|
export default defineConfig([
|
|
globalIgnores(["dist", "tests/generated", "coverage"]),
|
|
{
|
|
files: ["**/*.{ts,tsx}"],
|
|
extends: [
|
|
js.configs.recommended,
|
|
tseslint.configs.strictTypeChecked,
|
|
tseslint.configs.stylisticTypeChecked,
|
|
],
|
|
rules: {
|
|
"@typescript-eslint/array-type": [
|
|
"error",
|
|
{
|
|
default: "array",
|
|
},
|
|
],
|
|
"@typescript-eslint/consistent-generic-constructors": [
|
|
"error",
|
|
"constructor",
|
|
],
|
|
"@typescript-eslint/no-unsafe-type-assertion": "error",
|
|
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
"error",
|
|
{
|
|
requireDefaultForNonUnion: true,
|
|
considerDefaultExhaustiveForUnions: true,
|
|
},
|
|
],
|
|
"no-extra-boolean-cast": "off",
|
|
"no-fallthrough": [
|
|
"error",
|
|
{
|
|
reportUnusedFallthroughComment: true,
|
|
},
|
|
],
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
varsIgnorePattern: "^_",
|
|
reportUsedIgnorePattern: true,
|
|
},
|
|
],
|
|
"@typescript-eslint/no-namespace": "off",
|
|
},
|
|
languageOptions: {
|
|
parserOptions: {
|
|
projectService: true,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ignores: ["tests"],
|
|
extends: [tseslint.configs.base],
|
|
rules: {
|
|
"@typescript-eslint/no-restricted-imports": [
|
|
"error",
|
|
{
|
|
paths: [
|
|
{
|
|
name: "vitest",
|
|
message: "Use import.meta.vitest instead",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
]);
|