summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-08-01 16:04:19 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-08-31 12:20:23 +0200
commit2948a99b6e51c42039025b049d8f92e92b1b7d2c (patch)
tree1c3bb3d7a763d71db1abaec6a14a219735879c7e
parent1e942435be5f8dbf30be7296466ca674b69b7c70 (diff)
downloadsearxng-2948a99b6e51c42039025b049d8f92e92b1b7d2c.tar.gz
searxng-2948a99b6e51c42039025b049d8f92e92b1b7d2c.zip
[mod] simple theme - add ESLint
[1] https://eslint.org/ [2] https://eslint.org/docs/user-guide/configuring/ [3] https://eslint.org/docs/user-guide/command-line-interface Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--.dir-locals.el6
-rwxr-xr-xmanage2
-rw-r--r--searx/static/themes/simple/.eslintrc.json13
-rw-r--r--searx/static/themes/simple/gruntfile.js12
-rw-r--r--searx/static/themes/simple/package.json3
5 files changed, 33 insertions, 3 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
index 92ff6788b..b8f7ecc76 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -91,9 +91,9 @@
(js-mode
. ((eval . (progn
(setq-local js-indent-level 2)
- ;; flycheck should use the jshint checker from simple theme
- (setq-local flycheck-javascript-jshint-executable
- (expand-file-name "searx/static/themes/simple/node_modules/.bin/jshint" prj-root))
+ ;; flycheck should use the eslint checker from simple theme
+ (setq-local flycheck-javascript-eslint-executable
+ (expand-file-name "searx/static/themes/simple/node_modules/.bin/eslint" prj-root))
(flycheck-mode)
))))
diff --git a/manage b/manage
index a855512f5..31abd8a3e 100755
--- a/manage
+++ b/manage
@@ -665,6 +665,8 @@ themes.oscar() {
themes.simple() {
build_msg GRUNT "theme: simple"
npm --prefix searx/static/themes/simple run build
+ # just report eslint issues but do not break the build (--force)
+ npm --prefix searx/static/themes/simple run eslint --force
dump_return $?
}
diff --git a/searx/static/themes/simple/.eslintrc.json b/searx/static/themes/simple/.eslintrc.json
new file mode 100644
index 000000000..cfe1e0b3a
--- /dev/null
+++ b/searx/static/themes/simple/.eslintrc.json
@@ -0,0 +1,13 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true
+ },
+ "extends": "eslint:recommended",
+ "parserOptions": {
+ "ecmaVersion": 12,
+ "sourceType": "module"
+ },
+ "rules": {
+ }
+}
diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js
index 7e5ad5466..049e21fca 100644
--- a/searx/static/themes/simple/gruntfile.js
+++ b/searx/static/themes/simple/gruntfile.js
@@ -15,6 +15,16 @@ module.exports = function(grunt) {
jshint: {
files: ['src/js/main/*.js', 'src/js/head/*.js', '../__common__/js/*.js'],
},
+ eslint: {
+ options: {
+ configFile: '.eslintrc.json'
+ },
+ target: [
+ 'src/js/main/*.js',
+ 'src/js/head/*.js',
+ '../__common__/js/*.js'
+ ],
+ },
stylelint: {
options: {
formatter: 'unix',
@@ -189,10 +199,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-webfont');
grunt.loadNpmTasks('grunt-stylelint');
+ grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('test', ['jshint']);
grunt.registerTask('default', [
+ // 'eslint',
'jshint',
'stylelint',
'copy',
diff --git a/searx/static/themes/simple/package.json b/searx/static/themes/simple/package.json
index 89e9008be..e36181001 100644
--- a/searx/static/themes/simple/package.json
+++ b/searx/static/themes/simple/package.json
@@ -1,5 +1,6 @@
{
"devDependencies": {
+ "eslint": "^7.32.0",
"grunt-cli": "^1.4.3",
"grunt": "~1.4.1",
"grunt-contrib-copy": "^1.0.0",
@@ -10,6 +11,7 @@
"grunt-contrib-uglify": "~5.0.1",
"grunt-contrib-watch": "~1.1.0",
"grunt-stylelint": "^0.16.0",
+ "grunt-eslint": "^23.0.0",
"grunt-webfont": "^1.7.2",
"ionicons-npm": "^2.0.1",
"jslint": "^0.12.1",
@@ -26,6 +28,7 @@
"scripts": {
"all": "npm install && grunt",
"build": "grunt",
+ "eslint": "grunt eslint",
"watch": "grunt watch",
"webfont": "grunt webfont",
"clean": "rm -Rf node_modules package-lock.json ion.less",