feat: additional linting configs, formatting configs

This commit is contained in:
Matt Pumarlo
2026-06-24 15:28:10 -05:00
parent b4defbd16b
commit d1ca40a539
4 changed files with 1183 additions and 16 deletions

11
.prettierrc.json Normal file
View File

@@ -0,0 +1,11 @@
{
"jsonRecursiveSort": false,
"jsonSortOrder": "{\"/.*/\": \"lexical\"}",
"plugins": ["prettier-plugin-sort-json"],
"printWidth": 100,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}

30
eslint.config.js Normal file
View File

@@ -0,0 +1,30 @@
import js from "@eslint/js";
import globals from "globals";
import prettier from "eslint-config-prettier";
export default [
{
ignores: ["node_modules/**", "data/**", "releases/**", "android/**", "web/translations/**"],
},
js.configs.recommended,
{
// Browser-side single-page app served by the bridge. Loaded as a classic
// (non-module) script, so all top-level functions/vars share one global scope.
files: ["web/**/*.js"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "script",
globals: {
...globals.browser,
},
},
rules: {
// Top-level functions/vars are intentional globals invoked from inline
// HTML handlers, so only flag unused *local* bindings, not globals.
"no-unused-vars": ["warn", { vars: "local", args: "none" }],
// Empty catch blocks are used intentionally to swallow non-critical errors.
"no-empty": ["error", { allowEmptyCatch: true }],
},
},
prettier,
];

1133
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,22 @@
{
"name": "kx-bridge",
"version": "0.9.27",
"version": "0.9.0",
"description": "Moonraker-compatible bridge for Anycubic Kobra X",
"type": "module",
"devDependencies": {
"prettier": "^3.0.0"
"@eslint/js": "^9.0.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.0.0",
"prettier": "^3.0.0",
"prettier-plugin-sort-json": "^4.2.0"
},
"scripts": {
"format:js": "prettier --write 'web/**/*.js' '*.js'",
"format:json": "prettier --write '*.json' 'web/**/*.json'",
"format:web": "prettier --write 'web/**/*.{js,json,html,css,yml,yaml,md}'",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format:js": "prettier --write \"web/**/*.js\" \"*.js\"",
"format:json": "prettier --write \"*.json\" \"web/**/*.json\"",
"format:web": "prettier --write \"web/**/*.{js,json,html,css,yml,yaml,md}\"",
"format": "npm run format:web"
},
"prettier": {
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"printWidth": 100,
"tabWidth": 2,
"useTabs": false
}
}