mirror of
https://github.com/sbuffkin/hexmaker.git
synced 2026-07-22 06:14:01 +00:00
Five separate categories the upstream obsidianmd reviewer flagged on
the 1.4.x diff, plus enforcement to catch them earlier.
- **no-static-styles-assignment** (5 sites in HexMapView.ts):
Replace every direct `transform`/`transform-origin`/`opacity` write
with CSS custom properties on the relevant container. Static rules
in styles.css now reference them via
`transform: translate(var(--duckmage-bg-tx, 0px), …) scale(...)`
with identity-default fallbacks. JS writes only the values via
`setCssProps({ "--duckmage-bg-tx": ... })`. Applies to the bg image
layer, the hex grid container, AND the viewport itself. Two small
helpers `applyBgLayerVars` / `applyGridLayerVars` centralise the
variable plumbing and replace ad-hoc transform-string assembly at
the drag / wheel / arrow-key / bake / shiftForGridGrowth call sites.
- **document → activeDocument** (4 sites in overlayPatternControls.ts):
swap for popout-window compatibility.
- **setDynamicTooltip removal** (5 sites): the API is deprecated; the
value is shown inline now.
- **Lint enforcement**: `obsidianmd/no-static-styles-assignment`
promoted from default to error, so a regression breaks the local
lint instead of waiting for the upstream reviewer. The other two
patterns aren't shipped as eslint rules upstream — documented in
CLAUDE.md under "Obsidian reviewer-bot conventions" so the next
pass-through audits them by hand.
Sandbox regression check (dev/snapshot-bg-hex-alignment.mjs) still
PASSes — the CSS-var refactor doesn't disturb the bg-image / grid
alignment math from 1.4.1.
47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
import tsparser from "@typescript-eslint/parser";
|
|
import { defineConfig } from "eslint/config";
|
|
import obsidianmd from "eslint-plugin-obsidianmd";
|
|
import globals from "globals";
|
|
|
|
export default defineConfig([
|
|
{ ignores: ["**/tests/**", "node_modules/", "*.mjs", "main.js", "dev/**"] },
|
|
|
|
...obsidianmd.configs.recommended,
|
|
|
|
{
|
|
files: ["**/*.{js,ts}"],
|
|
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
// Obsidian-injected globals for popout-window-aware code
|
|
activeDocument: "readonly",
|
|
activeWindow: "readonly",
|
|
},
|
|
parser: tsparser,
|
|
parserOptions: { project: "./tsconfig.json" },
|
|
},
|
|
plugins: {
|
|
obsidianmd, // Explicitly include the plugin
|
|
},
|
|
// You can add your own configuration to override or add rules
|
|
rules: {
|
|
"obsidianmd/sample-names": "off",
|
|
"obsidianmd/ui/sentence-case": ["warn", { allowAutoFix: true }],
|
|
// Allow console.warn/error for genuine error reporting; block debug console.log
|
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
// Enforce no-static-styles-assignment as an error so the local lint
|
|
// breaks instead of waiting for the upstream obsidianmd reviewer bot
|
|
// to catch it. The rule means: no direct `.style.foo = ...` and no
|
|
// `setCssProps({ transform: ... })` for arbitrary CSS properties.
|
|
// Set CSS custom properties (`--duckmage-...`) via setCssProps and
|
|
// reference them from CSS rules instead.
|
|
//
|
|
// The other patterns the obsidianmd reviewer flags but that don't
|
|
// have shipped rules in eslint-plugin-obsidianmd yet — `document` →
|
|
// `activeDocument`, deprecated `setDynamicTooltip` — are documented
|
|
// as conventions in CLAUDE.md and audited manually.
|
|
"obsidianmd/no-static-styles-assignment": "error",
|
|
},
|
|
},
|
|
]);
|