Replace the old Lisp-like array expression representation (["AND", ["PARAM", ...], ...]) with a class hierarchy rooted in an abstract Expression class (Literal, Parameter, Binary, Unary, FunctionCall, Conditional). This gives compile-time type safety to expression construction, evaluation, and pattern matching. Key changes: - New lib/common/expression.ts defines the class hierarchy with map/evaluate/toString methods - Rewrite parser as hand-rolled recursive descent, removing the parsimmon dependency - Extend Path with a colon separator to unify parameter identity and attributes into a single address space (e.g. "Device.WiFi.SSID.1.Name:writable"). The colon field tracks how many trailing segments are attribute qualifiers. PathSet rewritten with separate param/attr segment indexes - Flatten device attribute representation in the UI to colon-delimited keys mirroring the new path syntax
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
import { defineConfig } from "@eslint/config-helpers";
|
|
import eslint from "@eslint/js";
|
|
import tseslint from "typescript-eslint";
|
|
import eslintConfigPrettier from "eslint-config-prettier";
|
|
import globals from "globals";
|
|
|
|
export default defineConfig(
|
|
{
|
|
ignores: ["dist/", "test/*.js"],
|
|
},
|
|
eslint.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
eslintConfigPrettier,
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.es2022,
|
|
...globals.node,
|
|
},
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
rules: {
|
|
"@typescript-eslint/no-shadow": ["error", { allow: ["err"] }],
|
|
"handle-callback-err": "error",
|
|
"prefer-arrow-callback": "error",
|
|
"no-buffer-constructor": "error",
|
|
"prefer-const": ["error", { destructuring: "all" }],
|
|
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
"@typescript-eslint/no-use-before-define": [
|
|
"error",
|
|
{ functions: false },
|
|
],
|
|
"@typescript-eslint/explicit-function-return-type": [
|
|
"error",
|
|
{ allowExpressions: true },
|
|
],
|
|
"@typescript-eslint/no-floating-promises": "error",
|
|
"@typescript-eslint/no-misused-promises": "error",
|
|
"no-prototype-builtins": "off",
|
|
},
|
|
},
|
|
{
|
|
files: ["ui/**/*.ts", "ui/**/*.tsx"],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
},
|
|
);
|