Skip to content

Commit

Permalink
[IMP] pre-commmit: Run prettier and eslint as local hooks and update …
Browse files Browse the repository at this point in the history
…versions in v18
  • Loading branch information
PabloEForgeFlow committed Oct 9, 2024
1 parent 37c9cd7 commit 046aab0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.yml
32 changes: 19 additions & 13 deletions src/.pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- if odoo_version < 15 %}
{%- set repo_rev.autoflake = "v1.4" %}
{%- set repo_rev.black = "22.3.0" %}
{%- set repo_rev.eslint = "v7.8.1" %}
{%- set repo_rev.eslint = "7.8.1" %}
{%- set repo_rev.flake8 = "3.8.3" %}
{%- set repo_rev.flake8_bugbear = "20.1.4" %}
{%- set repo_rev.isort = "5.12.0" %}
Expand All @@ -23,7 +23,7 @@
{%- elif odoo_version < 16 %}
{%- set repo_rev.autoflake = "v1.4" %}
{%- set repo_rev.black = "22.3.0" %}
{%- set repo_rev.eslint = "v7.32.0" %}
{%- set repo_rev.eslint = "7.32.0" %}
{%- set repo_rev.flake8 = "3.9.2" %}
{%- set repo_rev.flake8_bugbear = "21.9.2" %}
{%- set repo_rev.isort = "5.12.0" %}
Expand All @@ -41,7 +41,7 @@
{%- elif odoo_version < 18 %}
{%- set repo_rev.autoflake = "v1.6.1" %}
{%- set repo_rev.black = "22.8.0" %}
{%- set repo_rev.eslint = "v8.24.0" %}
{%- set repo_rev.eslint = "8.24.0" %}
{%- set repo_rev.flake8 = "3.9.2" %}
{%- set repo_rev.flake8_bugbear = "21.9.2" %}
{%- set repo_rev.isort = "5.12.0" %}
Expand All @@ -58,16 +58,16 @@
{%- else %}
{%- set repo_rev.autoflake = "v1.6.1" %}
{%- set repo_rev.black = "22.8.0" %}
{%- set repo_rev.eslint = "v8.24.0" %}
{%- set repo_rev.eslint = "9.12.0" %}
{%- set repo_rev.flake8 = "3.9.2" %}
{%- set repo_rev.flake8_bugbear = "21.9.2" %}
{%- set repo_rev.isort = "5.12.0" %}
{%- set repo_rev.maintainer_tools = "bf9ecb9938b6a5deca0ff3d870fbd3f33341fded" %}
{%- set repo_rev.nodejs = "16.17.0" %}
{%- set repo_rev.odoo_pre_commit_hooks = "v0.0.33" %}
{%- set repo_rev.pre_commit_hooks = "v4.6.0" %}
{%- set repo_rev.prettier = "2.7.1" %}
{%- set repo_rev.prettier_xml = "2.2.0" %}
{%- set repo_rev.prettier = "3.3.3" %}
{%- set repo_rev.prettier_xml = "3.4.1" %}
{%- set repo_rev.pylint_odoo = "v9.1.2" %}
{%- set repo_rev.pyupgrade = "v2.38.2" %}
{%- set repo_rev.ruff = "v0.6.8" %}
Expand Down Expand Up @@ -178,25 +178,31 @@ repos:
hooks:
- id: black
{%- endif %}
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v{{ repo_rev.prettier }}
- repo: local
hooks:
- id: prettier
name: prettier (with plugin-xml)
additional_dependencies:
- "prettier@{{ repo_rev.prettier }}"
- "@prettier/plugin-xml@{{ repo_rev.prettier_xml }}"
entry: prettier --write --list-different --ignore-unknown
language: node
types: [text]
args:
- --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: {{ repo_rev.eslint }}
additional_dependencies:
- "prettier@{{ repo_rev.prettier }}"
- "@prettier/plugin-xml@{{ repo_rev.prettier_xml }}"
- repo: local
hooks:
- id: eslint
name: eslint
entry: eslint
language: node
types: [javascript]
verbose: true
args:
- --color
- --fix
additional_dependencies: ["eslint@{{ repo_rev.eslint }}"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: {{ repo_rev.pre_commit_hooks }}
hooks:
Expand Down
12 changes: 12 additions & 0 deletions src/{% if odoo_version >= 18 %}.prettierrc.cjs{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('prettier').Config} */
const config = {
plugins: [require.resolve("@prettier/plugin-xml")],
bracketSpacing: false,
printWidth: 88,
proseWrap: "always",
semi: true,
trailingComma: "es5",
xmlWhitespaceSensitivity: "preserve",
};

module.exports = config;

0 comments on commit 046aab0

Please sign in to comment.