diff --git a/.vscode/settings.json b/.vscode/settings.json index 61ab0e239..760c44b5c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -59,8 +59,11 @@ "netlify.toml": "runtime.txt", "README.md": "LICENSE, SECURITY.md" }, + "[typescript]": { + "editor.formatOnSave": true + }, "[vue]": { - "editor.formatOnSave": false + "editor.formatOnSave": true }, "[python]": { "editor.formatOnSave": true, diff --git a/dev/code-generation/gen_py_pytest_data_paths.py b/dev/code-generation/gen_py_pytest_data_paths.py index 02313d819..53a75fee5 100644 --- a/dev/code-generation/gen_py_pytest_data_paths.py +++ b/dev/code-generation/gen_py_pytest_data_paths.py @@ -1,3 +1,4 @@ +import subprocess from dataclasses import dataclass from pathlib import Path @@ -105,12 +106,16 @@ def main(): # Flatten list of lists all_children = [item for sublist in all_children for item in sublist] + out_path = GENERATED / "__init__.py" render_python_template( TEMPLATE, - GENERATED / "__init__.py", + out_path, {"children": all_children}, ) + subprocess.run(["poetry", "run", "ruff", "check", str(out_path), "--fix"]) + subprocess.run(["poetry", "run", "ruff", "format", str(out_path)]) + if __name__ == "__main__": main() diff --git a/dev/code-generation/gen_py_schema_exports.py b/dev/code-generation/gen_py_schema_exports.py index 20da4a523..e7eb6c3ae 100644 --- a/dev/code-generation/gen_py_schema_exports.py +++ b/dev/code-generation/gen_py_schema_exports.py @@ -1,5 +1,6 @@ import pathlib import re +import subprocess from dataclasses import dataclass, field from utils import PROJECT_DIR, log, render_python_template @@ -84,16 +85,23 @@ def find_modules(root: pathlib.Path) -> list[Modules]: return modules -def main(): +def main() -> None: modules = find_modules(SCHEMA_PATH) + template_paths: list[pathlib.Path] = [] for module in modules: log.debug(f"Module: {module.directory.name}") for file in module.files: log.debug(f" File: {file.import_path}") log.debug(f" Classes: [{', '.join(file.classes)}]") - render_python_template(template, module.directory / "__init__.py", {"module": module}) + template_path = module.directory / "__init__.py" + template_paths.append(template_path) + render_python_template(template, template_path, {"module": module}) + + path_args = (str(p) for p in template_paths) + subprocess.run(["poetry", "run", "ruff", "check", *path_args, "--fix"]) + subprocess.run(["poetry", "run", "ruff", "format", *path_args]) if __name__ == "__main__": diff --git a/dev/code-generation/gen_ts_types.py b/dev/code-generation/gen_ts_types.py index 8a8932299..69c0d749e 100644 --- a/dev/code-generation/gen_ts_types.py +++ b/dev/code-generation/gen_ts_types.py @@ -1,4 +1,5 @@ import re +import subprocess from pathlib import Path from jinja2 import Template @@ -189,6 +190,7 @@ def generate_typescript_types() -> None: # noqa: C901 skipped_dirs: list[Path] = [] failed_modules: list[Path] = [] + out_paths: list[Path] = [] for module in schema_path.iterdir(): if module.is_dir() and module.stem in ignore_dirs: skipped_dirs.append(module) @@ -205,10 +207,18 @@ def generate_typescript_types() -> None: # noqa: C901 path_as_module = path_to_module(module) generate_typescript_defs(path_as_module, str(out_path), exclude=("MealieModel")) # type: ignore clean_output_file(out_path) + out_paths.append(out_path) except Exception: failed_modules.append(module) log.exception(f"Module Error: {module}") + # Run ESLint --fix on the files to clean up any formatting issues + subprocess.run( + ["yarn", "lint", "--fix", *(str(path) for path in out_paths)], + check=True, + cwd=PROJECT_DIR / "frontend", + ) + log.debug("\nšŸ“ Skipped Directories:") for skipped_dir in skipped_dirs: log.debug(f" šŸ“ {skipped_dir.name}") diff --git a/dev/code-generation/utils/template.py b/dev/code-generation/utils/template.py index 32ecf9c47..9d8724345 100644 --- a/dev/code-generation/utils/template.py +++ b/dev/code-generation/utils/template.py @@ -1,5 +1,4 @@ import logging -import subprocess from dataclasses import dataclass from pathlib import Path @@ -23,11 +22,6 @@ def render_python_template(template_file: Path | str, dest: Path, data: dict): dest.write_text(text) - # lint/format file with Ruff - log.info(f"Formatting {dest}") - subprocess.run(["poetry", "run", "ruff", "check", str(dest), "--fix"]) - subprocess.run(["poetry", "run", "ruff", "format", str(dest)]) - @dataclass class CodeSlicer: @@ -37,7 +31,7 @@ class CodeSlicer: indentation: str | None text: list[str] - _next_line = None + _next_line: int | None = None def purge_lines(self) -> None: start = self.start + 1 diff --git a/frontend/components/Domain/Cookbook/CookbookPage.vue b/frontend/components/Domain/Cookbook/CookbookPage.vue index 2267276cc..71c751a68 100644 --- a/frontend/components/Domain/Cookbook/CookbookPage.vue +++ b/frontend/components/Domain/Cookbook/CookbookPage.vue @@ -32,9 +32,9 @@ >
- - {{ $globals.icons.pages }} - + + {{ $globals.icons.pages }} + {{ book.name }} -
- -
- -
-

- {{ $t("household.private-household-description") }} -

- -
-
-
- -
-

- {{ $t("household.lock-recipe-edits-from-other-households-description") }} -

-
-
- +
+ +
+ +
+

+ {{ $t("household.private-household-description") }} +

+ +
+
+
+ +
+

+ {{ $t("household.lock-recipe-edits-from-other-households-description") }} +

+
+
+ - -
-
- -

- {{ p.description }} -

-
-
-
+ +
+
+ +

+ {{ p.description }} +

+
+
+
diff --git a/frontend/pages/household/mealplan/planner/edit.vue b/frontend/pages/household/mealplan/planner/edit.vue index b399d8e6b..82ce3b176 100644 --- a/frontend/pages/household/mealplan/planner/edit.vue +++ b/frontend/pages/household/mealplan/planner/edit.vue @@ -14,7 +14,7 @@ if (newMeal.existing) { actions.updateOne({ ...newMeal, date: newMealDateString }); } - else { + else { actions.createOne({ ...newMeal, date: newMealDateString }); } resetDialog(); @@ -147,7 +147,14 @@