readme.md
1# JavaScript and SASS
2
3This project uses the following libraries to determine the best practices and
4guidelines for both SCSS and JavaScript syntax.
5
6- [ESLint](https://eslint.org/)
7- [Prettier](https://prettier.io/)
8- [ESLint Plugin for Vue](https://eslint.vuejs.org/)
9
10The guidelines we are following are:
11
12- [Vue Recommended](https://eslint.vuejs.org/rules/#priority-c-recommended-minimizing-arbitrary-choices-and-cognitive-overhead-for-vue-js-3-x)
13- [ESLint Recommended](https://eslint.org/docs/rules/)
14- [Prettier](https://prettier.io/docs/en/options.html)
15
16The rules are applied in the following order:
17
181. Vue rules
191. ESLint recommended
201. Prettier
21
22## Overrides
23
24Any overrides to a rule are located in the ESLint configuration file,
25`.eslintrc.cjs`, located in the root directory.
26
27## Prettier Configuration
28
29Prettier settings are defined in `.prettierrc.yaml` in the root directory. This
30configuration is used for formatting markdown, JSON, and YAML files. JavaScript
31and Vue files use the prettier settings defined in the ESLint configuration.
32
33## Running the lint test
34
35To test all files for linting, run `npm run lint`. This command will evaluate
36the syntax of all files and update any code that does not require manual review.
37
38## Pre-commit Hooks
39
40The project uses `simple-git-hooks` and `lint-staged` to automatically run
41linting before each commit:
42
43- JavaScript and Vue files are checked with `eslint --fix`
44- Markdown files are formatted with `prettier --write`
45
46Hooks are automatically installed when you run `npm install`. If you need to
47reinstall them manually, run `npm run prepare`.
48
49## CI Validation
50
51The CI tool runs additional validation after a push to Gerrit using the
52`format-code.sh` script, which checks formatting for JavaScript, Vue, markdown,
53JSON, and YAML files.
54