tileserver-gl
tileserver-gl copied to clipboard
style: fix lint issues in code 🕺
- [x] Fixes issue with code styling in the repo. Linted the code via prettier. I plan to add
eslint
as well to identify security vulnerabilities.. in coming PRs
Thoughts on this @petrsloup ?
I would have this skip public/resources/ , since those are releases from outside this project
I get the feeling looking at this that maybe it is overly complex. You mentioned a plan to use eslint eventually. couldn't that do most of this beautifying/formatting by itself? I feel like in my testing, eslint got the majority the formatting issues.
Edit: For example, I feel like this was pretty close with just .eslintrc.yml and running eslint ** --fix
env:
browser: false
es2021: true
extends: google
overrides: []
parserOptions:
ecmaVersion: latest
sourceType: module
ignorePatterns:
- /public/resources
rules:
comma-dangle:
- error
- never
I get the feeling looking at this that maybe it is overly complex. You mentioned a plan to use eslint eventually. couldn't that do most of this beautifying/formatting by itself? I feel like in my testing, eslint got the majority the formatting issues.
Edit: For example, I feel like this was pretty close with just .eslintrc.yml and running eslint ** --fix
env: browser: false es2021: true extends: google overrides: [] parserOptions: ecmaVersion: latest sourceType: module ignorePatterns: - /public/resources rules: comma-dangle: - error - never
https://github.com/vinayakkulkarni/tileserver-gl/blob/main/.eslintrc.cjs
added the newer version of .eslintrc
since eslint themselves prefer using .cjs
or .js
file instead of .yml
also, why extend google
when there are much better configs available. :( ?
> eslint "{,!(node_modules|dist|static|public)/**/}*.{js,ts,cjs,mjs}" --ignore-path .gitignore
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/publish.js
14:1 warning Found require("child_process") security/detect-child-process
14:1 error Require statement not part of import statement @typescript-eslint/no-var-requires
22:10 error Require statement not part of import statement @typescript-eslint/no-var-requires
23:19 error Require statement not part of import statement @typescript-eslint/no-var-requires
51:1 warning Found require("child_process") security/detect-child-process
51:1 error Require statement not part of import statement @typescript-eslint/no-var-requires
56:1 warning Found require("child_process") security/detect-child-process
56:1 error Require statement not part of import statement @typescript-eslint/no-var-requires
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/main.js
5:11 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
8:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
9:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
11:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
13:21 error Require statement not part of import statement @typescript-eslint/no-var-requires
20:21 error Require statement not part of import statement @typescript-eslint/no-var-requires
59:10 error Require statement not part of import statement @typescript-eslint/no-var-requires
82:24 warning Found fs.statSync with non literal argument at index 0 security/detect-non-literal-fs-filename
132:24 warning Found fs.readdirSync with non literal argument at index 0 security/detect-non-literal-fs-filename
136:15 warning Found fs.existsSync with non literal argument at index 0 security/detect-non-literal-fs-filename
137:13 warning Generic Object Injection Sink security/detect-object-injection
170:1 warning Found fs.stat with non literal argument at index 0 security/detect-non-literal-fs-filename
175:21 warning Found fs.readdirSync with non literal argument at index 0 security/detect-non-literal-fs-filename
178:32 warning Found fs.statSync with non literal argument at index 0 security/detect-non-literal-fs-filename
192:24 warning Found fs.createWriteStream with non literal argument at index 0 security/detect-non-literal-fs-filename
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/serve_data.js
3:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
4:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
5:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
8:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
9:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
10:13 error Require statement not part of import statement @typescript-eslint/no-var-requires
11:20 error Require statement not part of import statement @typescript-eslint/no-var-requires
13:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
21:18 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
90:33 warning Variable Assigned to Object Injection Sink security/detect-object-injection
116:37 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
143:30 warning Found fs.statSync with non literal argument at index 0 security/detect-non-literal-fs-filename
181:7 warning Generic Object Injection Sink security/detect-object-injection
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/serve_font.js
3:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
4:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
5:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
18:5 warning Found fs.readdir with non literal argument at index 0 security/detect-non-literal-fs-filename
24:9 warning Found fs.stat with non literal argument at index 0 security/detect-non-literal-fs-filename
31:13 warning Found fs.existsSync with non literal argument at index 0 security/detect-non-literal-fs-filename
41:69 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
63:37 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/serve_rendered.js
3:22 error Require statement not part of import statement @typescript-eslint/no-var-requires
4:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
5:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
6:13 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
8:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
12:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
14:26 error Require statement not part of import statement @typescript-eslint/no-var-requires
16:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
17:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
18:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
19:23 error Require statement not part of import statement @typescript-eslint/no-var-requires
20:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
21:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
22:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
23:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
25:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
28:20 warning Unsafe Regular Expression security/detect-unsafe-regex
57:1 warning There must be a newline after the description of the JSDoc block jsdoc/newline-after-description
76:16 warning Variable Assigned to Object Injection Sink security/detect-object-injection
94:29 warning 'info' is defined but never used @typescript-eslint/no-unused-vars
96:9 warning Generic Object Injection Sink security/detect-object-injection
205:7 warning Found fs.readdir with non literal argument at index 0 security/detect-non-literal-fs-filename
211:11 warning Found fs.stat with non literal argument at index 0 security/detect-non-literal-fs-filename
275:16 warning Generic Object Injection Sink security/detect-object-injection
277:16 warning Generic Object Injection Sink security/detect-object-injection
313:15 warning Generic Object Injection Sink security/detect-object-injection
317:15 warning Generic Object Injection Sink security/detect-object-injection
317:25 warning Generic Object Injection Sink security/detect-object-injection
332:20 warning '_' is assigned a value but never used @typescript-eslint/no-unused-vars
367:33 warning Variable Assigned to Object Injection Sink security/detect-object-injection
376:40 warning 'info' is defined but never used @typescript-eslint/no-unused-vars
603:42 warning Generic Object Injection Sink security/detect-object-injection
697:37 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
732:27 warning Variable Assigned to Object Injection Sink security/detect-object-injection
734:15 warning Found fs.readFile with non literal argument at index 0 security/detect-non-literal-fs-filename
744:19 warning Function Call Object Injection Sink security/detect-object-injection
760:30 warning Variable Assigned to Object Injection Sink security/detect-object-injection
761:34 warning Variable Assigned to Object Injection Sink security/detect-object-injection
821:34 warning Generic Object Injection Sink security/detect-object-injection
862:30 warning Found fs.readFileSync with non literal argument at index 0 security/detect-non-literal-fs-filename
909:5 warning Generic Object Injection Sink security/detect-object-injection
920:20 warning Variable Assigned to Object Injection Sink security/detect-object-injection
933:26 warning Variable Assigned to Object Injection Sink security/detect-object-injection
945:33 warning 'reject' is defined but never used @typescript-eslint/no-unused-vars
947:38 warning Found fs.statSync with non literal argument at index 0 security/detect-non-literal-fs-filename
951:13 warning Generic Object Injection Sink security/detect-object-injection
951:72 warning 'err' is defined but never used @typescript-eslint/no-unused-vars
952:15 warning Generic Object Injection Sink security/detect-object-injection
958:22 warning Generic Object Injection Sink security/detect-object-injection
962:19 warning Generic Object Injection Sink security/detect-object-injection
1006:29 warning Variable Assigned to Object Injection Sink security/detect-object-injection
1007:51 warning Function Call Object Injection Sink security/detect-object-injection
1008:9 warning Generic Object Injection Sink security/detect-object-injection
1009:9 warning Generic Object Injection Sink security/detect-object-injection
1021:16 warning Variable Assigned to Object Injection Sink security/detect-object-injection
1030:12 warning Generic Object Injection Sink security/detect-object-injection
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/serve_style.js
3:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
4:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
6:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
10:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
12:20 warning Unsafe Regular Expression security/detect-unsafe-regex
33:43 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
40:24 warning Variable Assigned to Object Injection Sink security/detect-object-injection
63:70 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
71:14 warning Found fs.readFile with non literal argument at index 0 security/detect-non-literal-fs-filename
86:12 warning Generic Object Injection Sink security/detect-object-injection
93:23 warning Found fs.readFileSync with non literal argument at index 0 security/detect-non-literal-fs-filename
112:22 warning Variable Assigned to Object Injection Sink security/detect-object-injection
121:26 warning Variable Assigned to Object Injection Sink security/detect-object-injection
164:5 warning Generic Object Injection Sink security/detect-object-injection
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/server.js
5:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
8:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
9:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
11:18 error Require statement not part of import statement @typescript-eslint/no-var-requires
12:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
13:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
14:24 error Require statement not part of import statement @typescript-eslint/no-var-requires
15:17 error Require statement not part of import statement @typescript-eslint/no-var-requires
16:20 error Require statement not part of import statement @typescript-eslint/no-var-requires
17:23 error Require statement not part of import statement @typescript-eslint/no-var-requires
18:16 error Require statement not part of import statement @typescript-eslint/no-var-requires
20:21 error Require statement not part of import statement @typescript-eslint/no-var-requires
21:20 error Require statement not part of import statement @typescript-eslint/no-var-requires
22:21 error Require statement not part of import statement @typescript-eslint/no-var-requires
23:20 error Require statement not part of import statement @typescript-eslint/no-var-requires
24:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
33:1 warning Missing JSDoc comment jsdoc/require-jsdoc
53:13 warning Found fs.createWriteStream with non literal argument at index 0 security/detect-non-literal-fs-filename
66:22 warning Found non-literal argument in require security/detect-non-literal-require
66:22 error Require statement not part of import statement @typescript-eslint/no-var-requires
93:10 warning Found fs.existsSync with non literal argument at index 0 security/detect-non-literal-fs-filename
93:24 warning Function Call Object Injection Sink security/detect-object-injection
95:61 warning Generic Object Injection Sink security/detect-object-injection
107:35 warning Found non-literal argument in require security/detect-non-literal-require
147:19 warning Generic Object Injection Sink security/detect-object-injection
163:22 warning Generic Object Injection Sink security/detect-object-injection
164:15 warning Generic Object Injection Sink security/detect-object-injection
173:13 warning Generic Object Injection Sink security/detect-object-injection
191:33 warning Generic Object Injection Sink security/detect-object-injection
205:18 warning Variable Assigned to Object Injection Sink security/detect-object-injection
221:18 warning Variable Assigned to Object Injection Sink security/detect-object-injection
233:5 warning Found fs.readdir with non literal argument at index 0 security/detect-non-literal-fs-filename
248:21 warning Found fs.watch with non literal argument at index 0 security/detect-non-literal-fs-filename
272:38 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
278:25 warning Generic Object Injection Sink security/detect-object-injection
293:34 warning Function Call Object Injection Sink security/detect-object-injection
294:26 warning Generic Object Injection Sink security/detect-object-injection
294:26 warning Generic Object Injection Sink security/detect-object-injection
316:40 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
319:36 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
322:37 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
345:9 warning Found fs.readFile with non literal argument at index 0 security/detect-non-literal-fs-filename
353:39 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
384:21 warning Variable Assigned to Object Injection Sink security/detect-object-injection
385:21 warning Generic Object Injection Sink security/detect-object-injection
385:43 warning Generic Object Injection Sink security/detect-object-injection
386:28 warning Generic Object Injection Sink security/detect-object-injection
387:32 warning Generic Object Injection Sink security/detect-object-injection
412:21 warning Variable Assigned to Object Injection Sink security/detect-object-injection
413:24 warning Generic Object Injection Sink security/detect-object-injection
462:26 warning Generic Object Injection Sink security/detect-object-injection
467:19 warning Generic Object Injection Sink security/detect-object-injection
467:41 warning Generic Object Injection Sink security/detect-object-injection
468:26 warning Generic Object Injection Sink security/detect-object-injection
469:30 warning Generic Object Injection Sink security/detect-object-injection
480:24 warning Function Call Object Injection Sink security/detect-object-injection
488:18 warning Generic Object Injection Sink security/detect-object-injection
488:40 warning Generic Object Injection Sink security/detect-object-injection
499:24 warning Function Call Object Injection Sink security/detect-object-injection
513:33 warning 'next' is defined but never used @typescript-eslint/no-unused-vars
560:16 warning Generic Object Injection Sink security/detect-object-injection
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/src/utils.js
3:14 error Require statement not part of import statement @typescript-eslint/no-var-requires
4:12 error Require statement not part of import statement @typescript-eslint/no-var-requires
6:15 error Require statement not part of import statement @typescript-eslint/no-var-requires
7:22 error Require statement not part of import statement @typescript-eslint/no-var-requires
28:8 warning Unsafe Regular Expression security/detect-unsafe-regex
47:9 warning 'key' is assigned a value but never used @typescript-eslint/no-unused-vars
57:18 warning Generic Object Injection Sink security/detect-object-injection
58:14 warning Generic Object Injection Sink security/detect-object-injection
92:27 warning Generic Object Injection Sink security/detect-object-injection
97:14 warning Generic Object Injection Sink security/detect-object-injection
98:7 warning Found fs.readFile with non literal argument at index 0 security/detect-non-literal-fs-filename
109:18 warning Generic Object Injection Sink security/detect-object-injection
111:20 warning Generic Object Injection Sink security/detect-object-injection
117:20 warning Generic Object Injection Sink security/detect-object-injection
/Users/vinayakkulkarni/dev/personal/map/tileserver-gl/test/setup.js
6:11 error Require statement not part of import statement @typescript-eslint/no-var-requires
11:17 error Require statement not part of import statement @typescript-eslint/no-var-requires

I'll try and fix all the security issues on priority.