Commit Graph
8 Commits
Author SHA1 Message Date
Simon Genin (ges) f5c5e51917 [FIX] web: tooling: fix support for older tooling
Older tooling used prettier config files. The issue was that the
disable command of the tooling was also changed to not remove those
files as they shouldn't exist anymore.
But changing from 16 to master without manually triggering a tooling
"disable" would then left the prettier config and mess with the addons
eslint whitelist.

closes odoo/odoo#110582

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-01-26 14:19:06 +01:00
Pierre Paridans bc325631b3 [FIX] web: lint tooling - exit script if cd fails
Ref:
- https://www.shellcheck.net/wiki/SC2164

closes odoo/odoo#107937

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-12-14 17:17:57 +01:00
Pierre Paridans 591c091c7a [FIX] web: lint tooling scripts - Double quote to prevent globbing
Double quote to prevent globbing and word splitting.

Ref.
- https://www.shellcheck.net/wiki/SC2086

Part-of: odoo/odoo#107937
2022-12-14 17:17:57 +01:00
Simon Genin (ges) 729647493f [IMP] dx: tooling js: improvements and preparation for runbot lint
- Use of jsconfig instead of tsconfig
- jsconfig deployed with tooling, no need for CLI
- ecmascript bumped to version es2022 (static properties)
- prettierrc merged inside the eslintrc
- add a few globals
- cleanup package.json scripts
- add script to lint/format only the diff (opposed to staged files)
- bump up node packages versions
- use eslint as cli instead of prettier-eslint, as eslint does provide
parsable output for runbot.
- add the typescrit types of libs as dependencies + main.d.ts to
improve autompletion.

This upgrade makes it easier to deploy and use the js tooling, as it is
expected more and more people will use it if a lint check is added to
the runbot.

About the runbot:
The commit gets the code ready to enable the lint on the runbot.
It will lint the code with the same rules and same ignore file.
The only difference is the runbot will check only the diff and not the
entire commited file.
The goal will be to progressively (and aggressively) whitelist modules
to converge to a nice formatted codebase.

closes odoo/odoo#105165

Related: odoo/enterprise#34048
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-11-17 13:57:19 +01:00
Pierre Rousseau 9e65c6a00b [FIX] web: fix tooling for enterprise repo
Since fcf2e2210a639adfcdb9236c24cfb31046b6dead, the path of enterprise
is derived from the tooling path instead of the community path.

X-original-commit: 4ff8f62aa1e10d27189ebbdd22a01711c700ea32
Part-of: odoo/odoo#90522
2022-05-04 19:17:44 +02:00
Samuel Degueldre 92497ed4f1 [FIX] web: fix tooling failing to run due to bash-specific syntax
In #86163 we added a check on the branch name to avoid running the
tooling on stable branches, however this check used bash-specific
syntax. While the hashbang in the pre-commit hook specifies that the
hook should be run using bash, we were using the npm module "husky" to
manage git hooks, which would ignore this hashbang and always run the
hook using sh, causing the hook to fail in all cases.

After some consideration, we have decided to stop using husky, as its
main purpose is to make hook management easier in npm-based projects.
Since we already need a script to enable the tooling, we can do
essentially the same thing that husky is doing but with more control
over the process with no drawbacks.

closes odoo/odoo#87436

X-original-commit: 3104ab16ecf88d4f7b1618db4d62e7f57df34e6c
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-03-29 12:00:11 +02:00
Simon Genin (ges) 9583c74e5f [FIX] web: make js tooling safe with paths with spaces
If $basepath in the tooling contained spaces, it could have dramatic
consequences on the rm -rf command.
We simply escape everything to avoid the problem.

closes odoo/odoo#73222

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-05 13:07:48 +00:00
Simon Genin (ges) 8d57a5cde9 [ADD] web: prettier and eslint tooling
Provide an opt in js tooling system by adding a node env with prettier and eslint configured.
3 bash scripts are provided: enable.sh, disable.sh and reload.sh.

Enable.sh: add to the community root (and optionaly to the enterprise root) the env.
Disable.sh: remove the env.
Reload.sh: disable then enable.
2021-06-18 21:31:27 +02:00