56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
import js from "@eslint/js";
|
|
import tseslint from "@typescript-eslint/eslint-plugin";
|
|
import tsparser from "@typescript-eslint/parser";
|
|
import prettier from "eslint-config-prettier";
|
|
import globals from "globals";
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
{
|
|
files: ["**/*.ts", "**/*.tsx"],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: "module",
|
|
},
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
plugins: {
|
|
"@typescript-eslint": tseslint,
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
"no-undef": "off", // TypeScript handles this; no-undef doesn't understand TS types like NodeJS
|
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.ts", "**/*.tsx"],
|
|
rules: prettier.rules,
|
|
},
|
|
{
|
|
files: ["**/*.test.ts", "**/*.test.tsx", "**/tests/**/*.ts"],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.jest, // vitest globals are the same names
|
|
},
|
|
},
|
|
},
|
|
{
|
|
files: ["scripts/**/*.mjs"],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ignores: ["dist/**", "node_modules/**"],
|
|
},
|
|
];
|