summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-04-07 11:27:21 +0530
committerDennis Francis <dennisfrancis.in@gmail.com>2021-04-07 14:03:42 +0530
commit40ff6989feb8b0f0309d8f86d734ae6b655090c6 (patch)
tree138de12c7f5c1000435d807170c980bea49c05c3
parenttest: calc has 0-alpha empty tiles which are not black (diff)
downloadonline-40ff6989feb8b0f0309d8f86d734ae6b655090c6.tar.gz
online-40ff6989feb8b0f0309d8f86d734ae6b655090c6.zip
lint typescript files too
Fix some issues it found and disable the following checks for now. Some of them needs module support to work and some of them needs project compilation using tsc rather than per file compilation. cypress_test/ extends loleaflet's eslintrc so, its package.json needs to have the typescript lint plugin as well. Disabled checks: @typescript-eslint/no-unused-vars // This can be enabled after fixing all places it finds. @typescript-eslint/no-inferrable-types // Lets do explicit typing whenever we can. no-var // This needs a lot of conversion of var to let. @typescript-eslint/no-explicit-any @typescript-eslint/no-namespace // ES5 has no module support no-inner-declarations // ,, no-constant-condition // This is sometimes useful @typescript-eslint/triple-slash-reference // ES5 no module support. Signed-off-by: Dennis Francis <dennis.francis@collabora.com> Change-Id: Ib4fd8b4fcee42216d4322fd043a1873302db375a
-rw-r--r--cypress_test/package.json3
-rw-r--r--loleaflet/.eslintignore3
-rw-r--r--loleaflet/.eslintrc24
-rw-r--r--loleaflet/package.json6
-rw-r--r--loleaflet/src/layer/vector/CLineUtil.ts6
5 files changed, 36 insertions, 6 deletions
diff --git a/cypress_test/package.json b/cypress_test/package.json
index f613dac84c..8956f6df7e 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -11,6 +11,9 @@
"cypress-select-tests": "1.5.9",
"cypress-wait-until": "1.7.1",
"eslint": "7.19.0",
+ "typescript": "3.9.5",
+ "@typescript-eslint/eslint-plugin": "^4.21.0",
+ "@typescript-eslint/parser": "^4.21.0",
"eslint-plugin-cypress-rules": "file:eslint_plugin",
"get-port-cli": "2.0.0",
"wait-on": "5.2.1"
diff --git a/loleaflet/.eslintignore b/loleaflet/.eslintignore
index 4b278ea867..062f4dfa1e 100644
--- a/loleaflet/.eslintignore
+++ b/loleaflet/.eslintignore
@@ -8,4 +8,5 @@
**/js/w2ui-1.5.rc1.js
**/src/unocommands.js
**/js/viamapi-client.js
-# \ No newline at end of file
+node_modules
+dist/src \ No newline at end of file
diff --git a/loleaflet/.eslintrc b/loleaflet/.eslintrc
index dbd7454a34..42215ce064 100644
--- a/loleaflet/.eslintrc
+++ b/loleaflet/.eslintrc
@@ -30,4 +30,28 @@
"env": {
"browser": true
},
+ "overrides": [
+ {
+ "files": ["**/*.ts"],
+ "parser": "@typescript-eslint/parser",
+ "plugins": [
+ "@typescript-eslint"
+ ],
+ "extends": [
+ "eslint:recommended",
+ "plugin:@typescript-eslint/eslint-recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@typescript-eslint/no-unused-vars": "off",
+ "@typescript-eslint/no-inferrable-types": "off",
+ "no-var": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-namespace": "off",
+ "no-inner-declarations": "off",
+ "no-constant-condition": "off",
+ "@typescript-eslint/triple-slash-reference": "off"
+ }
+ }
+ ]
}
diff --git a/loleaflet/package.json b/loleaflet/package.json
index 101ad60006..d67acfe174 100644
--- a/loleaflet/package.json
+++ b/loleaflet/package.json
@@ -4,6 +4,10 @@
"description": "Collabora Online front-end",
"devDependencies": {
"@braintree/sanitize-url": "4.0.1",
+ "@types/mocha": "8.2.0",
+ "@types/node": "14.14.25",
+ "@typescript-eslint/eslint-plugin": "^4.21.0",
+ "@typescript-eslint/parser": "^4.21.0",
"autolinker": "3.14.1",
"browserify": "16.5.1",
"browserify-css": "0.15.0",
@@ -22,8 +26,6 @@
"smartmenus": "1.0.0",
"stylelint": "13.7.0",
"stylelint-config-standard": "20.0.0",
- "@types/mocha": "8.2.0",
- "@types/node": "14.14.25",
"typescript": "3.9.5",
"uglify-js": "3.9.4",
"uglifycss": "0.0.29",
diff --git a/loleaflet/src/layer/vector/CLineUtil.ts b/loleaflet/src/layer/vector/CLineUtil.ts
index 7900a7c65f..4574f58f05 100644
--- a/loleaflet/src/layer/vector/CLineUtil.ts
+++ b/loleaflet/src/layer/vector/CLineUtil.ts
@@ -101,7 +101,7 @@ namespace CLineUtil {
var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds);
var codeB = _getBitCode(b, bounds);
var codeOut: number;
- var p: CPoint
+ var p: CPoint;
var newCode: number;
// save 2nd code to avoid calculating it on the next segment
@@ -179,8 +179,8 @@ namespace CLineUtil {
// square distance (to avoid unnecessary Math.sqrt calls)
function _sqDist(p1: CPoint, p2: CPoint): number {
- var dx = p2.x - p1.x,
- dy = p2.y - p1.y;
+ var dx = p2.x - p1.x;
+ var dy = p2.y - p1.y;
return dx * dx + dy * dy;
}