photoprism/frontend/eslint.config.mjs
Michael Mayer 7ba4dc1bf6 Frontend: Tune lightbox theme for face markers, retire ESLint-Prettier glue #4966
- Refactor `meta.css` face-marker palette to consume theme tokens (Path A):
  default rect → `on-surface`; named-marker stroke → `primary`; draft →
  `accent`; hover → `primary-darken-1`; handle → `primary-darken-1` fill +
  `primary` stroke; Confirm pill → `primary-darken-2`; Cancel pill →
  `highlight-lighten-1`; Remove pill → `remove`; Back button → `surface`.
- Retune the `lightbox` theme block to support the rebind: `primary
  #F2F3F3 → #9E8FC9` (muted purple), `accent #2D2E2E → #BDAFE4` (lavender),
  `surface #151515 → #181818`, `surface-bright → #1c1c1c`, `button →
  #242424`, `highlight #424041 → #3c3c3c`, `remove → #cd4645`. Effectively
  reverts the `surface-variant ↔ on-surface-variant` swap and re-introduces
  an explicit `.v-tooltip.v-theme--lightbox` override in `lightbox.css`.
- Bump `variations.darken` to 2 so `--v-theme-primary-darken-2` resolves.
- Swap the in-template button order in `markers.vue` to Cancel-left /
  Confirm-right for both the pending-add and remove-confirm popovers.
- Add inline comments to the `default.add` and updated `lightbox`
  entries so each color's purpose stays documented at the source.
- Drop `eslint-plugin-prettier` (its `prettier/prettier` rule was already
  `"off"`, making the plugin inert). Replace `plugin:prettier/recommended`
  with a direct `eslint-config-prettier` extend; keep ESLint's own
  `indent` / `quotes` / `brace-style` rules as the JS formatter.
- Tell ESLint to ignore `*.{css,scss,sass}` so Prettier owns CSS
  unambiguously; wire `npm run fmt-css` / `npm run lint-css` Prettier
  passes into `npm run fmt` / `npm run lint` so `make fmt-js` and
  `make lint-js` cover stylesheets too.
- Drop `eslint-plugin-prettier` from the dev-container global install
  list and the `frontend/tests/README.md` dependency table; regenerate
  `NOTICE` files.
2026-05-19 09:56:09 +00:00

118 lines
3.6 KiB
JavaScript

import { defineConfig, globalIgnores } from "eslint/config";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import pluginVue from "eslint-plugin-vue";
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 defineConfig([
globalIgnores([
"**/coverage/",
"**/node_modules/",
"tests/screenshots/",
"tests/acceptance/screenshots/",
"tests/upload-files/",
"**/*.html",
// CSS/SCSS/SASS are owned by Prettier (see `frontend/.prettierrc.json` overrides).
// Ignored here to avoid the "no matching configuration" warning and any
// accidental formatter jitter from a future ESLint CSS plugin.
"**/*.css",
"**/*.scss",
"**/*.sass",
"**/.idea",
"**/.codex",
"**/.env",
"**/.venv",
"**/.github",
"**/.tmp",
"**/.local",
"**/.cache",
"**/.gocache",
"**/.var",
]),
...pluginVue.configs["flat/recommended"],
{
extends: compat.extends("eslint:recommended", "eslint-config-prettier", "plugin:vuetify/base"),
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.node,
...globals.mocha,
},
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
// Match what Prettier was producing: 2-space indent (4 for CSS lives in .prettierrc), switch
// cases nested one level, method-chain continuations indented one level.
"indent": ["warn", 2, { SwitchCase: 1, MemberExpression: 1 }],
"linebreak-style": ["error", "unix"],
"quotes": [
"warn",
"double",
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
"semi": ["warn", "always"],
"curly": ["warn", "all"],
// Forces braced bodies onto their own line so curly's autofix produces
// multi-line `if (x) {\n return;\n}` instead of `if (x) {return;}`.
// Deprecated in favor of @stylistic/brace-style; still functional in ESLint 9.
"brace-style": ["warn", "1tbs", { allowSingleLine: false }],
"no-unused-vars": ["warn"],
"no-console": 0,
"no-case-declarations": 0,
"no-prototype-builtins": 0,
"vue/no-v-text-v-html-on-component": 0,
"vue/no-v-model-argument": 0,
"vue/valid-model-definition": 0,
"vue/valid-attribute-name": 0,
"vue/singleline-html-element-content-newline": [
"off",
{
ignoreWhenNoAttributes: true,
ignoreWhenEmpty: true,
ignores: [
"pre",
"textarea",
"span",
"translate",
"a",
"v-icon",
"v-text-field",
"v-input",
"v-select",
"v-switch",
"v-checkbox",
"v-img",
],
externalIgnores: [],
},
],
"vue/first-attribute-linebreak": [
"warn",
{
singleline: "ignore",
multiline: "ignore",
},
],
// Note: Prettier is no longer invoked by ESLint. The `eslint-config-prettier` extends
// above still disables ESLint stylistic rules that would conflict with hand-run Prettier
// formatting on CSS/SCSS/SASS. Run `prettier --write src/**/*.{css,scss,sass}` (or use
// the `fmt-css` / `lint-css` npm scripts) to format stylesheets.
},
},
]);