Files
thrilltrack-explorer/eslint.config.js
2025-11-03 17:08:36 +00:00

67 lines
2.5 KiB
JavaScript

import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
export default tseslint.config(
{ ignores: ["dist"] },
// Frontend configuration with type-aware rules
{
extends: [js.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
files: ["src/**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
// Console statement prevention (P0 #2 - Security Critical)
"no-console": "error", // Block ALL console statements
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"@typescript-eslint/require-await": "warn",
},
},
// API configuration without type-aware rules for better performance
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["api/**/*.ts"],
languageOptions: {
ecmaVersion: 2022,
globals: globals.node,
},
rules: {
// Console statement prevention (P0 #2 - Security Critical)
"no-console": "error", // Block ALL console statements
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
}],
},
},
);