From f287787c44956a6584f78fdd9d6bf423384d1643 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 14 Dec 2021 07:50:53 +0100 Subject: [PATCH] [simple theme] activate - SearXNG JavaScript Style Guide Add the 'SearXNG JavaScript Style Guide' as one quality gate in the build chain of the simple theme:: make themes.simple make themes.simple.test In the github CI the `themes.all` target enforce a `themes.simple`. BTW: Remove 'jshint' left overs from 0ee316f3d Signed-off-by: Markus Heiser --- Makefile | 2 +- manage | 11 +++++++++++ searx/static/themes/simple/gruntfile.js | 7 +++---- searx/static/themes/simple/package.json | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 87472ee41..89e32ec90 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ MANAGE += py.build py.clean MANAGE += pyenv pyenv.install pyenv.uninstall MANAGE += pypi.upload pypi.upload.test MANAGE += test.yamllint test.pylint test.pep8 test.unit test.coverage test.robot test.clean -MANAGE += themes.all themes.oscar themes.simple pygments.less +MANAGE += themes.all themes.oscar themes.simple themes.simple.test pygments.less MANAGE += static.build.commit static.build.drop static.build.restore MANAGE += nvm.install nvm.clean nvm.status nvm.nodejs diff --git a/manage b/manage index 1236cb31c..736a479b5 100755 --- a/manage +++ b/manage @@ -714,6 +714,17 @@ themes.simple() { dump_return $? } +themes.simple.test() { + build_msg TEST "theme: simple" + if ! nvm.min_node "${NODE_MINIMUM_VERSION}"; then + info_msg "install Node.js by NVM" + nvm.nodejs + fi + npm --prefix searx/static/themes/simple install + npm --prefix searx/static/themes/simple run test + dump_return $? +} + PYLINT_FILES=() while IFS= read -r line; do PYLINT_FILES+=("$line") diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index aac1217ea..46ab657e0 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -1,4 +1,4 @@ -/* jshint esversion: 6 */ +/* SPDX-License-Identifier: AGPL-3.0-or-later */ module.exports = function (grunt) { @@ -27,7 +27,7 @@ module.exports = function (grunt) { eslint: { options: { overrideConfigFile: '.eslintrc.json', - failOnError: false, + failOnError: true, fix: grunt.option('fix') }, target: [ @@ -268,13 +268,12 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-image'); - grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-stylelint'); grunt.loadNpmTasks('grunt-eslint'); - grunt.registerTask('test', ['jshint']); + grunt.registerTask('test', ['eslint']); grunt.registerTask('default', [ 'eslint', diff --git a/searx/static/themes/simple/package.json b/searx/static/themes/simple/package.json index 321d44556..b90d6de70 100644 --- a/searx/static/themes/simple/package.json +++ b/searx/static/themes/simple/package.json @@ -4,7 +4,6 @@ "grunt": "~1.4.1", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-cssmin": "^4.0.0", - "grunt-contrib-jshint": "~3.1.1", "grunt-contrib-less": "~3.0.0", "grunt-contrib-uglify": "~5.0.1", "grunt-xmlmin": "~0.1.8", @@ -29,6 +28,7 @@ "scripts": { "all": "npm install && grunt", "build": "grunt", + "test": "grunt test", "eslint": "grunt eslint", "eslint-fix": "grunt eslint --fix", "watch": "grunt watch",