xref: /openbmc/webui-vue/docs/guide/coding-standards/readme.md (revision 7385e139b0c9efca7430458cee982e63e282f4ae)
19a25c805SDerick Montague# JavaScript and SASS
2*7385e139SPatrick Williams
349287562SDerick MontagueThis project uses the following libraries to determine the best practices and
449287562SDerick Montagueguidelines for both SCSS and JavaScript syntax.
5*7385e139SPatrick Williams
6736f2a4bSDerick Montague- [ESLint](https://eslint.org/)
7736f2a4bSDerick Montague- [Prettier](https://prettier.io/)
8736f2a4bSDerick Montague- [ESLint Plugin for Vue](https://eslint.vuejs.org/)
9736f2a4bSDerick Montague
10736f2a4bSDerick MontagueThe guidelines we are following are:
11*7385e139SPatrick Williams
12*7385e139SPatrick Williams- [Vue Recommended](https://eslint.vuejs.org/rules/#priority-c-recommended-minimizing-arbitrary-choices-and-cognitive-overhead-for-vue-js-3-x)
13736f2a4bSDerick Montague- [ESLint Recommended](https://eslint.org/docs/rules/)
14736f2a4bSDerick Montague- [Prettier](https://prettier.io/docs/en/options.html)
15736f2a4bSDerick Montague
16736f2a4bSDerick MontagueThe rules are applied in the following order:
17*7385e139SPatrick Williams
18736f2a4bSDerick Montague1. Vue rules
19736f2a4bSDerick Montague1. ESLint recommended
20736f2a4bSDerick Montague1. Prettier
21736f2a4bSDerick Montague
22736f2a4bSDerick Montague## Overrides
23*7385e139SPatrick Williams
2449287562SDerick MontagueAny overrides to a rule are located in the ESLint configuration file,
2549287562SDerick Montague`.eslintrc.js`, located in the root directory.
26736f2a4bSDerick Montague
27736f2a4bSDerick Montague## Running the lint test
28*7385e139SPatrick Williams
2949287562SDerick MontagueTo test all files for linting, run `npm run lint`. This command will evaluate
3049287562SDerick Montaguethe syntax of all files and update any code that that does not require manual
3149287562SDerick Montaguereview.
32736f2a4bSDerick Montague
3349287562SDerick MontagueThe linting script runs when code is committed, during pre-commit, and when the
3449287562SDerick MontagueCI tool runs after a push to Gerrit. There is a shell script named
3549287562SDerick Montague`format-code.sh` that installs node package dependencies and runs the test
3649287562SDerick Montaguescript in your CI.
37