forked from zaclys/searxng
Merge pull request #538 from return42/eslint
SearXNG JavaScript Style Guide
This commit is contained in:
commit
4f22615259
|
@ -91,7 +91,7 @@
|
|||
|
||||
(json-mode
|
||||
. ((eval . (progn
|
||||
(setq-local js-indent-level 2)
|
||||
(setq-local js-indent-level 4)
|
||||
(flycheck-checker . json-python-json)))))
|
||||
|
||||
(js-mode
|
||||
|
|
2
Makefile
2
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
|
||||
|
||||
|
|
11
manage
11
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")
|
||||
|
|
|
@ -9,5 +9,21 @@
|
|||
"ecmaVersion": 12
|
||||
},
|
||||
"rules": {
|
||||
"indent": ["error", 2],
|
||||
"keyword-spacing": ["error", { "before": true, "after": true }],
|
||||
"no-trailing-spaces": 2,
|
||||
"space-before-function-paren": ["error", "always"],
|
||||
"space-infix-ops": "error",
|
||||
"comma-spacing": ["error", { "before": false, "after": true }],
|
||||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
||||
"curly": ["error", "multi-line"],
|
||||
"block-spacing": ["error", "always"],
|
||||
"comma-spacing": ["error", { "before": false, "after": true }],
|
||||
"dot-location": ["error", "property"],
|
||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
|
||||
"spaced-comment": ["error", "always", {
|
||||
"line": { "markers": ["*package", "!", "/", ",", "="] },
|
||||
"block": { "balanced": true, "markers": ["*package", "!", ",", ":", "::", "flow-include"], "exceptions": ["*"] }
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint esversion: 6 */
|
||||
/* SPDX-License-Identifier: AGPL-3.0-or-later */
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
|
@ -27,9 +27,11 @@ module.exports = function(grunt) {
|
|||
eslint: {
|
||||
options: {
|
||||
overrideConfigFile: '.eslintrc.json',
|
||||
failOnError: false
|
||||
failOnError: true,
|
||||
fix: grunt.option('fix')
|
||||
},
|
||||
target: [
|
||||
'gruntfile.js',
|
||||
'svg4web.svgo.js',
|
||||
'src/js/main/*.js',
|
||||
'src/js/head/*.js',
|
||||
|
@ -266,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',
|
||||
|
|
|
@ -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,7 +28,9 @@
|
|||
"scripts": {
|
||||
"all": "npm install && grunt",
|
||||
"build": "grunt",
|
||||
"test": "grunt test",
|
||||
"eslint": "grunt eslint",
|
||||
"eslint-fix": "grunt eslint --fix",
|
||||
"watch": "grunt watch",
|
||||
"webfont": "grunt webfont",
|
||||
"clean": "rm -Rf node_modules package-lock.json ion.less",
|
||||
|
|
Loading…
Reference in New Issue