[mod] SearXNG JavaScript Style Guide (eslint:recommended)

The SearXNG JavaScript Style Guide is a set of eslint rules [1] based on the
eslint:recommended [2] rules.

    "extends": "eslint:recommended"

The additional rules adopted from the JavaScript Standard Style [3][4].

[1] https://eslint.org/docs/rules/
[2] https://github.com/kunalgolani/eslint-config/tree/master/packages/recommended
[3] https://standardjs.com/rules.html#javascript-standard-style
[4] https://github.com/standard/eslint-config-standard/blob/master/.eslintrc.json

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-11-23 18:16:23 +01:00
parent 07e9d952cf
commit 06730588a6
3 changed files with 19 additions and 1 deletions

View File

@ -9,5 +9,21 @@
"ecmaVersion": 12 "ecmaVersion": 12
}, },
"rules": { "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": ["*"] }
}]
} }
} }

View File

@ -27,7 +27,8 @@ module.exports = function(grunt) {
eslint: { eslint: {
options: { options: {
overrideConfigFile: '.eslintrc.json', overrideConfigFile: '.eslintrc.json',
failOnError: false failOnError: false,
fix: grunt.option('fix')
}, },
target: [ target: [
'svg4web.svgo.js', 'svg4web.svgo.js',

View File

@ -30,6 +30,7 @@
"all": "npm install && grunt", "all": "npm install && grunt",
"build": "grunt", "build": "grunt",
"eslint": "grunt eslint", "eslint": "grunt eslint",
"eslint-fix": "grunt eslint --fix",
"watch": "grunt watch", "watch": "grunt watch",
"webfont": "grunt webfont", "webfont": "grunt webfont",
"clean": "rm -Rf node_modules package-lock.json ion.less", "clean": "rm -Rf node_modules package-lock.json ion.less",