strava-frontend/eslint.config.mjs

68 lines
2.2 KiB
JavaScript

import globals from "globals";
import tseslintPkg from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
const tseslint = tseslintPkg;
const tsParser = tseslintPkg.parser;
export default [
{ languageOptions: { globals: globals.browser } },
...tseslint.configs.recommended,
...pluginVue.configs["flat/essential"],
{
rules: {
// `_`-prefixed unused parameters (.catch((_) => {}), etc.) are
// intentional; everything else stays strict.
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
},
},
{
// Vue SFC: the flat presets above do not attach the TypeScript parser to
// .vue files, so <script lang="ts"> blocks fall back to espree and fail
// to parse TS syntax. The vue flat config already sets the SFC parser;
// here we only swap the inner script parser to TS.
files: ["**/*.vue"],
languageOptions: {
parserOptions: { parser: tsParser },
},
},
{
// Known exception (documented in .roo rules): the axios interceptors in
// main.ts are intentionally loosely typed (any) — pre-existing debt.
files: ["src/main.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
{
// Route-level page components are single-word by design (component name =
// page name, e.g. Feed, Settings, Login); renaming would break the router
// and public component names.
files: ["src/pages/**/*.vue"],
rules: {
"vue/multi-word-component-names": "off",
},
},
{
// The component mutates the workoutItem prop object in place (checkbox /
// name edits are patched to the API right away; the parent shares the same
// reference and does not re-render those fields). Extracting a local copy
// would be a state-management change out of scope for the lint wave.
files: ["src/pages/workouts/components/WorkoutItem.vue"],
rules: {
"vue/no-mutating-props": "off",
},
},
{
// Logout page renders nothing on purpose (redirect-only screen).
files: ["src/pages/auth/Logout.vue"],
rules: {
"vue/valid-template-root": "off",
},
},
];