summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json28
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--res/qml/Mixxx/MathUtils.mjs8
3 files changed, 30 insertions, 8 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 1c77f95525..84911dce95 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -62,11 +62,25 @@
"yoda": "warn"
},
"globals": {
- "console": "writable",
- "svg": "writable",
- "HIDController": "writable",
- "HIDDebug": "writable",
- "HIDPacket": "writable",
- "controller": "writable"
- }
+ "console": "readable"
+ },
+ "overrides": [
+ {
+ "files": ["**/*.mjs"],
+ "parserOptions": {
+ "sourceType": "module"
+ }
+ },
+ {
+ "files": ["res/controllers/*.js"],
+ "globals": {
+ "console": "readable",
+ "svg": "writable",
+ "HIDController": "writable",
+ "HIDDebug": "writable",
+ "HIDPacket": "writable",
+ "controller": "writable"
+ }
+ }
+ ]
}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2b52d0fac2..468bfbaf32 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -67,6 +67,8 @@ repos:
hooks:
- id: eslint
args: [--fix, --report-unused-disable-directives]
+ files: \.m?js$
+ types: [file]
stages:
- commit
- manual
diff --git a/res/qml/Mixxx/MathUtils.mjs b/res/qml/Mixxx/MathUtils.mjs
index e399e23b87..e7b500b7b4 100644
--- a/res/qml/Mixxx/MathUtils.mjs
+++ b/res/qml/Mixxx/MathUtils.mjs
@@ -1,3 +1,9 @@
-export function clamp(value, min, max) {
+/**
+ * @param {number} value Value
+ * @param {number} min Lower bound
+ * @param {number} max Upper bound
+ * @returns {number} Value clamped between min and max
+ */
+export const clamp = function(value, min, max) {
return Math.max(Math.min(value, max), min);
};