New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearXNG JavaScript Style Guide #538
Conversation
FYI: in commit 4c159f7 I added the SearXNG JavaScript Style Guide as one quality gate in the build chain. This ensures that we have a consistent quality of JS sources (simple theme), similar to what we do with pylint for python. See github CI: https://github.com/searxng/searxng/runs/4326586917?check_suite_focus=true#step:5:461 |
@dalf what do you think, can we force this "SearXNG JavaScript Style Guide"? If so I will rebase this PR. |
we can merge this PR once rebased, and indent with 2 spaces are fine. |
In JS + JSON we use indentation of 4. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
automatically fix some of the problems reported by eslint rules:: $ ./manage nvm.bash nvm-env$ npm --prefix searx/static/themes/simple run eslint-fix Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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 0ee316f Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
done .. thanks for taking the time to review! |
What does this PR do?
Define a SearXNG JavaScript Style Guide
The SearXNG JavaScript Style Guide is a set of eslint rules [1] based on the
eslint:recommended [2] rules.
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
The first three commits do fix small issues in preparation
Why is this change important?
consistent code quality