Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: local
hooks:
- id: eslint
name: eslint
entry: bash -c "cd refl1d/webview/client && npm run lint"
- id: frontend-lint
name: frontend-lint
entry: bash -c 'cd refl1d/webview/client && if command -v bun >/dev/null 2>&1; then bun run lint; elif command -v npm >/dev/null 2>&1; then npm run lint; else echo "Need bun or npm to run lint" >&2; exit 1; fi'
language: system
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand All @@ -16,12 +16,12 @@ repos:
# - id: end-of-file-fixer
# - id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.7
rev: v0.14.8
hooks:
# - id: ruff
# args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

ci:
autoupdate_schedule: monthly
skip: [eslint]
skip: [frontend-lint]
6 changes: 6 additions & 0 deletions refl1d/webview/client/.oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"__note__": "This is the configuration file for oxfmt. See oxc.rs/docs/guide/usage/formatter/config-file-reference.html",
"printWidth": 120,
"trailingComma": "es5"
}
9 changes: 9 additions & 0 deletions refl1d/webview/client/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": [
"oxlint/recommended",
"oxlint/typescript",
"oxlint/vue"
],
"files": ["src/**/*.{js,mjs,ts,tsx,vue}"]
}
59 changes: 0 additions & 59 deletions refl1d/webview/client/eslint.config.js

This file was deleted.

47 changes: 19 additions & 28 deletions refl1d/webview/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "refl1d-webview-client",
"version": "0.1.26",
"version": "0.1.27",
"type": "module",
"repository": {
"type": "git",
Expand All @@ -12,44 +12,35 @@
"build": "vite build --emptyOutDir -m development",
"build_prod": "vite build --emptyOutDir -m production",
"preview": "vite preview --port 4173",
"format": "prettier --write src",
"lint": "eslint src --fix",
"test:lint": "eslint src",
"format": "oxfmt src",
"lint": "oxlint src --fix",
"test:lint": "oxlint src",
"test:types": "vue-tsc --noEmit --skipLibCheck -p tsconfig.json --composite false"
},
"dependencies": {
"@msgpack/msgpack": "^3.1.2",
"bootstrap": "^5.3.7",
"bootstrap": "^5.3.8",
"date-fns": "^4.1.0",
"json-difference": "^1.16.1",
"mpld3": "^0.5.10",
"plotly.js": "^3.0.1",
"mpld3": "^0.5.11",
"plotly.js": "^3.1.2",
"socket.io-client": "^4.8.1",
"uuid": "^11.1.0",
"vue": "^3.5.17",
"vue-json-pretty": "^2.5.0"
"vue": "^3.5.22",
"vue-json-pretty": "^2.6.0"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
"@tsconfig/node-lts": "^22.0.2",
"@types/node": "^24.5.2",
"@types/plotly.js": "^2.35.1",
"@types/uuid": "^10.0.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/eslint-config-prettier": "10.1.0",
"@vue/eslint-config-typescript": "^14.2.0",
"@vue/tsconfig": "^0.7.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.32.0",
"eslint-plugin-vuejs-accessibility": "^2.4.1",
"prettier": "^3.4.2",
"prettier-plugin-css-order": "^2.1.2",
"prettier-plugin-jsdoc": "^1.3.2",
"typescript": "^5.7.3",
"vite": "^6.0.7",
"@types/node": "^24.9.2",
"@types/plotly.js": "^3.0.8",
"@types/uuid": "^11.0.0",
"@vitejs/plugin-vue": "^6.0.1",
"@vue/tsconfig": "^0.8.1",
"oxlint": "^1.31.0",
"oxfmt": "^0.16.0",
"typescript": "^5.9.3",
"vite": "^7.1.12",
"vite-svg-loader": "5.1.0",
"vue-tsc": "^2.2.0"
"vue-tsc": "^3.1.2"
}
}
48 changes: 0 additions & 48 deletions refl1d/webview/client/prettier.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function get_csv_data() {
});
}
const n = values[0].length;
const lines = new Array(n + 1);
const lines = Array.from({ length: n + 1 });
lines[0] = headers.join(",");
for (let i = 0; i < n; i++) {
lines[i + 1] = values.map((v) => v[i].toPrecision(6)).join(",");
Expand Down
12 changes: 6 additions & 6 deletions refl1d/webview/client/src/panels.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { shared_state } from "bumps-webview-client/src/app_state";
import { panels as bumps_panels, type Panel } from "bumps-webview-client/src/panels";
import DataView from "./components/DataView.vue";
import ModelView from "./components/ModelView.vue";
import ProfileUncertaintyView from "./components/ProfileUncertaintyView.vue";
import SimpleBuilder from "./components/SimpleBuilder.vue";
import DataView from "@/components/DataView.vue";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little surprised by this suggested change - it doesn't seem better to me. What is the benefit of using the special @ construction?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked up this suggestion online... I can see the logic. Since we're already loading a resolver and aliases, it might be a good idea to simplify the bumps imports too from bumps-webview-client/src/... to @bumps/...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the worst idea. do you want me to test that out in this PR or do it separately?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if you want to do it here that's fine!

import ModelView from "@/components/ModelView.vue";
import ProfileUncertaintyView from "@/components/ProfileUncertaintyView.vue";
import SimpleBuilder from "@/components/SimpleBuilder.vue";

const refl1dPanels: Panel[] = [
{ title: "Reflectivity", component: DataView },
Expand Down Expand Up @@ -34,7 +34,7 @@ function replace_panel(
) {
const index = panels.findIndex((p) => p.title === replaced_title);
const replacement_index = replacement_panels.findIndex((p) => p.title === replacement_title);
if (index >= 0 && replacement_index >= 0) {
if (index >= 0 && replacement_index >= 0 && replacement_panels[replacement_index]) {
panels.splice(index, 1, replacement_panels[replacement_index]);
}
}
Expand All @@ -46,7 +46,7 @@ function insert_panel(panels: Panel[], insertion_panels: Panel[], title: string,
index = panels.length - 1;
}
const insertion_index = insertion_panels.findIndex((p) => p.title === title);
if (insertion_index >= 0) {
if (insertion_index >= 0 && insertion_panels[insertion_index]) {
panels.splice(index + 1, 0, insertion_panels[insertion_index]);
}
}
Expand Down
6 changes: 6 additions & 0 deletions refl1d/webview/client/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/// <reference types="bumps-webview-client/src/types/mpld3" />

declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<{}, {}, any>;
export default component;
}
2 changes: 0 additions & 2 deletions refl1d/webview/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
],
"compilerOptions": {
"noErrorTruncation": true,
// "composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
Expand All @@ -19,6 +18,5 @@
"moduleResolution": "Bundler",
"target": "ES6",
"types": ["node"],
// "allowJs": true
}
}
6 changes: 6 additions & 0 deletions refl1d/webview/client/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "vite";
import { fileURLToPath, URL } from "node:url";
import svgLoader from "vite-svg-loader";
import vue from "@vitejs/plugin-vue";

Expand All @@ -14,4 +15,9 @@ export default defineConfig({
optimizeDeps: {
include: ["plotly.js/lib/core", "plotly.js/lib/heatmap", "plotly.js/lib/bar", "json-difference"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
}
}
});
Loading