openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

Add standardx to enforce consistent codestyle #107

Closed florian-h05 closed 2 years ago

florian-h05 commented 2 years ago

Add standardx to enforce consistent codestyle

Description

This PR adds standardx (you might also know the JavaScript standard or semistandard libraries) to enforce a consistent codestyle. I decided for standardx as it is based on standard, which is widely used, and is also highly customizable as it is based on eslint. The codestyle is checked every time npm test runs, therefore it would also apply to the jobs that run on a PR.

My motivation for this was, that the codestyle here often differs, e.g. the intendation. I have applied the codestyle to all JavaScript files.

Testing

I have never experienced any problems with the automated fix function of StandardJS and currently I am testing this PR on my system. But as I do not use everything the library provides, maybe somebody could also test it.

You can find the packed tarball here: https://1drv.ms/u/s!Al8cKKxosMjV7goODVlLcCvpB-aM?e=lDM9PJ

@digitaldan Please let me know what you think about that addition / change.

digitaldan commented 2 years ago

Thanks florian, i think this is a great idea. If you can update the PR to resolve conflicts I'll take a look at it locally.

florian-h05 commented 2 years ago

@digitaldan All conflicts are resolved!

florian-h05 commented 2 years ago

@digitaldan Have you had a look at it yet?

digitaldan commented 2 years ago

Hey @florian-h05 i'm looking at oh stuff today, i'll give this a spin today.

digitaldan commented 2 years ago

So this looks good to me! Lets get #99 and #101 merged fist so we don't have conflicts and then we can merge this one.

florian-h05 commented 2 years ago

@digitaldan Before this gets merged, I will rebase from main and re-apply the code formatting to resolve all conflicts.

digitaldan commented 2 years ago

Ok, i think we are ready if you want to rebase and re-apply.

florian-h05 commented 2 years ago

@digitaldan I rebased and reapplied the linting, ready to go now!

digitaldan commented 2 years ago

👍