Skip to content
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

Merged
merged 5 commits into from Dec 14, 2021
Merged

SearXNG JavaScript Style Guide #538

merged 5 commits into from Dec 14, 2021

Conversation

return42
Copy link
Member

@return42 return42 commented Nov 23, 2021

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.

"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

The first three commits do fix small issues in preparation

Why is this change important?

consistent code quality

@return42 return42 marked this pull request as draft November 23, 2021 20:50
@return42 return42 changed the title automatically fix some of the problems reported by eslint rules SearXNG JavaScript Style Guide Nov 24, 2021
@return42 return42 marked this pull request as ready for review November 24, 2021 00:11
@return42 return42 requested a review from dalf November 24, 2021 00:11
@return42
Copy link
Member Author

return42 commented Nov 25, 2021

FYI: in commit 4c159f7 [simple theme] activate - SearXNG JavaScript Style Guide

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

@return42
Copy link
Member Author

@dalf what do you think, can we force this "SearXNG JavaScript Style Guide"?

If so I will rebase this PR.

@dalf
Copy link
Member

dalf commented Dec 13, 2021

what do you think, can we force this "SearXNG JavaScript Style Guide"?

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>
@return42
Copy link
Member Author

we can merge this PR once rebased, and indent with 2 spaces are fine.

done .. thanks for taking the time to review!

@return42 return42 deleted the eslint branch December 14, 2021 07:08
@dalf dalf moved this from To do to Done in Simple theme tasks Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants