# HG changeset patch # User Mads Kiilerich # Date 1581815568 -3600 # Node ID 4d36432bf705aad621a6af09e64332e2b909c540 # Parent f4e158ed49b105313c1eb3152367934797cc7d70 eslint: install eslint with front-end so it can be run manually eslint can be run manually on the main .js files with: ./node_modules/.bin/eslint kallithea/public/js/base.js kallithea/public/js/codemirror_loadmode.js kallithea/public/js/graph.js - but it is quite noisy. Some problems do however stand out as relevant to fix. Script sections in HTML files can also be checked after removing mako markup: hg up -cr. sed -i -e 's/\${[^{}]*\({[^{}]*}[^{}]*\)*}/""/g' -e 's/%\(if\|else\|endif\|for\|endfor\)\>.*//g' -e 's/##.*//g' $(hg loc 'kallithea/templates/**.html') vim kallithea/templates/pullrequests/pullrequest.html +139 # blank out the multi line 'var url = ${}' ./node_modules/.bin/eslint $(hg loc 'kallithea/templates/**.html') hg up -Cr. - but that is even more noisy. The noise is mainly due to eslint not knowing that everything runs together, with kallithea/templates/base/root.html defining global variables, kallithea/public/js/base.js using these and defining functions, which then is used "everywhere". There might be solutions to that - this is a starting point. diff -r f4e158ed49b1 -r 4d36432bf705 .eslintrc.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.eslintrc.js Sun Feb 16 02:12:48 2020 +0100 @@ -0,0 +1,21 @@ +module.exports = { + "env": { + "browser": true, + "es6": true, + "jquery": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "html" + ], + "rules": { + } +}; diff -r f4e158ed49b1 -r 4d36432bf705 kallithea/front-end/package.json --- a/kallithea/front-end/package.json Thu Jan 09 23:40:42 2020 +0100 +++ b/kallithea/front-end/package.json Sun Feb 16 02:12:48 2020 +0100 @@ -7,6 +7,7 @@ "codemirror": "5.49.0", "datatables.net": "1.10.20", "datatables.net-bs": "1.10.20", + "eslint": "6.8.0", "jquery": "3.4.1", "jquery.caret": "0.3.1", "jquery.flot": "0.8.3",