Fix Check Errors#29
Merged
Merged
Conversation
… the `fix` script.
## Before
```
> jsonjoy-builder@0.3.2 check /Users/coder/projects/oss/jsonjoy-builder
> biome check .
postcss.config.js format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Formatter would have printed the following content:
10 10 │ /** @type {() => import("postcss").Plugin} */
11 11 │ const cssScopingPlugin = () => {
12 │ - → return·{
13 │ - → → postcssPlugin:·"replace-root-with-new_design",
14 │ - → → Once(root)·{
15 │ - → → → //·Add·.jsonjoy·class·selector·to·all·selectors
16 │ - → → → root.walkRules((rule)·=>·{
17 │ - → → → → if·(
18 │ - → → → → → rule.parent?.type·===·"atrule"·&&
19 │ - → → → → → !AllowedAtRules.has(rule.parent.name)
20 │ - → → → → )·{
21 │ - → → → → → return;
22 │ - → → → → }
23 │ - → → → → const·newSelectors·=·new·Set();
24 │ - → → → → for·(const·selector·of·rule.selectors)·{
25 │ - → → → → → //·See··tailwindlabs/tailwindcss#18108
26 │ - → → → → → //·Tailwind·always·uses·:root·/·:host,·but·we·want·to·scope·it·to·.jsonjoy
27 │ - → → → → → //·Replace·:root·and·:host·with·.jsonjoy
28 │ - → → → → → if·(selector·===·":root"·||·selector·===·":host")·{
29 │ - → → → → → → newSelectors.add(".jsonjoy");
30 │ - → → → → → }
31 │ - → → → → → //·Scope·universal·selector
32 │ - → → → → → else·if·(selector·===·"*")·{
33 │ - → → → → → → newSelectors.add(".jsonjoy");
34 │ - → → → → → → newSelectors.add(".jsonjoy·*");
35 │ - → → → → → }
36 │ - → → → → → //·Prefix·all·other·selectors·with·.jsonjoy,·if·not·already·prefixed
37 │ - → → → → → else·if·(!selector.startsWith(".jsonjoy"))·{
38 │ - → → → → → → newSelectors.add(`.jsonjoy·${selector}`);
39 │ - → → → → → → newSelectors.add(
40 │ - → → → → → → → addClassSelectorScope("jsonjoy",·selector)
41 │ - → → → → → → );
42 │ - → → → → → }
43 │ - → → → → → //·Already·prefixed,·so·do·nothing
44 │ - → → → → → else·{
45 │ - → → → → → → newSelectors.add(selector);
46 │ - → → → → → }
47 │ - → → → → }
48 │ - → → → → rule.selectors·=·[...newSelectors];
49 │ - → → → });
12 │ + ··return·{
13 │ + ····postcssPlugin:·"replace-root-with-new_design",
14 │ + ····Once(root)·{
15 │ + ······//·Add·.jsonjoy·class·selector·to·all·selectors
16 │ + ······root.walkRules((rule)·=>·{
17 │ + ········if·(
18 │ + ··········rule.parent?.type·===·"atrule"·&&
19 │ + ··········!AllowedAtRules.has(rule.parent.name)
20 │ + ········)·{
21 │ + ··········return;
22 │ + ········}
23 │ + ········const·newSelectors·=·new·Set();
24 │ + ········for·(const·selector·of·rule.selectors)·{
25 │ + ··········//·See··tailwindlabs/tailwindcss#18108
26 │ + ··········//·Tailwind·always·uses·:root·/·:host,·but·we·want·to·scope·it·to·.jsonjoy
27 │ + ··········//·Replace·:root·and·:host·with·.jsonjoy
28 │ + ··········if·(selector·===·":root"·||·selector·===·":host")·{
29 │ + ············newSelectors.add(".jsonjoy");
30 │ + ··········}
31 │ + ··········//·Scope·universal·selector
32 │ + ··········else·if·(selector·===·"*")·{
33 │ + ············newSelectors.add(".jsonjoy");
34 │ + ············newSelectors.add(".jsonjoy·*");
35 │ + ··········}
36 │ + ··········//·Prefix·all·other·selectors·with·.jsonjoy,·if·not·already·prefixed
37 │ + ··········else·if·(!selector.startsWith(".jsonjoy"))·{
38 │ + ············newSelectors.add(`.jsonjoy·${selector}`);
39 │ + ············newSelectors.add(addClassSelectorScope("jsonjoy",·selector));
40 │ + ··········}
41 │ + ··········//·Already·prefixed,·so·do·nothing
42 │ + ··········else·{
43 │ + ············newSelectors.add(selector);
44 │ + ··········}
45 │ + ········}
46 │ + ········rule.selectors·=·[...newSelectors];
47 │ + ······});
50 48 │
51 │ - → → → //·Prefix·built-in·animation·names·from·tailwind·with·jsonjoy-
52 │ - → → → //·See·https://tailwindcss.com/docs/animation
53 │ - → → → root.walkDecls((decl)·=>·{
54 │ - → → → → if·(decl.variable)·{
55 │ - → → → → → const·animateMatch·=·/--animate-([a-zA-Z0-9_-]+)/.exec(
56 │ - → → → → → → decl.prop
57 │ - → → → → → );
58 │ - → → → → → if·(animateMatch)·{
59 │ - → → → → → → const·animationName·=·animateMatch[1];
60 │ - → → → → → → decl.value·=·decl.value.replace(
61 │ - → → → → → → → new·RegExp(`\\b${animationName}\\b`,·"g"),
62 │ - → → → → → → → `jsonjoy-${animationName}`
63 │ - → → → → → → );
64 │ - → → → → → }
65 │ - → → → → }
66 │ - → → → });
49 │ + ······//·Prefix·built-in·animation·names·from·tailwind·with·jsonjoy-
50 │ + ······//·See·https://tailwindcss.com/docs/animation
51 │ + ······root.walkDecls((decl)·=>·{
52 │ + ········if·(decl.variable)·{
53 │ + ··········const·animateMatch·=·/--animate-([a-zA-Z0-9_-]+)/.exec(decl.prop);
54 │ + ··········if·(animateMatch)·{
55 │ + ············const·animationName·=·animateMatch[1];
56 │ + ············decl.value·=·decl.value.replace(
57 │ + ··············new·RegExp(`\\b${animationName}\\b`,·"g"),
58 │ + ··············`jsonjoy-${animationName}`,
59 │ + ············);
60 │ + ··········}
61 │ + ········}
62 │ + ······});
67 63 │
68 │ - → → → //·Prefix·@layer·with·jsonjoy-
69 │ - → → → root.walkAtRules((atRule)·=>·{
70 │ - → → → → if·(
71 │ - → → → → → atRule.name·===·"layer"·&&
72 │ - → → → → → !atRule.params.startsWith("jsonjoy-")
73 │ - → → → → )·{
74 │ - → → → → → atRule.params·=·`jsonjoy-${atRule.params}`;
75 │ - → → → → }
76 │ - → → → });
64 │ + ······//·Prefix·@layer·with·jsonjoy-
65 │ + ······root.walkAtRules((atRule)·=>·{
66 │ + ········if·(atRule.name·===·"layer"·&&·!atRule.params.startsWith("jsonjoy-"))·{
67 │ + ··········atRule.params·=·`jsonjoy-${atRule.params}`;
68 │ + ········}
69 │ + ······});
77 70 │
78 │ - → → → //·Prefix·built-in·keyframe·names·from·tailwind·with·jsonjoy-
79 │ - → → → //·See·https://tailwindcss.com/docs/animation
80 │ - → → → root.walkAtRules((atRule)·=>·{
81 │ - → → → → if·(
82 │ - → → → → → atRule.name·===·"keyframes"·&&
83 │ - → → → → → !atRule.params.startsWith("jsonjoy-")
84 │ - → → → → )·{
85 │ - → → → → → atRule.params·=·`jsonjoy-${atRule.params}`;
86 │ - → → → → }
87 │ - → → → });
71 │ + ······//·Prefix·built-in·keyframe·names·from·tailwind·with·jsonjoy-
72 │ + ······//·See·https://tailwindcss.com/docs/animation
73 │ + ······root.walkAtRules((atRule)·=>·{
74 │ + ········if·(
75 │ + ··········atRule.name·===·"keyframes"·&&
76 │ + ··········!atRule.params.startsWith("jsonjoy-")
77 │ + ········)·{
78 │ + ··········atRule.params·=·`jsonjoy-${atRule.params}`;
79 │ + ········}
80 │ + ······});
88 81 │
89 │ - → → → //·Prefix·CSS·custom·properties·with·jsonjoy-
90 │ - → → → //·Skip·--vscode-*·variables·(used·by·Monaco·editor)
91 │ - → → → root.walkDecls((decl)·=>·{
92 │ - → → → → if·(
93 │ - → → → → → decl.variable·&&
116 more lines truncated
src/components/SchemaEditor/SchemaVisualEditor.tsx:1:1 assist/source/organizeImports FIXABLE ━━━━━━━━━━━━
✖ The imports and exports are not sorted.
> 1 │ import type { FC } from "react";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │ import { useTranslation } from "../../hooks/use-translation.ts";
3 │ import {
ℹ Safe fix: Organize Imports (Biome)
3 3 │ import {
4 4 │ createFieldSchema,
5 │ - ··updateObjectProperty,
6 │ - ··updatePropertyRequired,
7 │ - ··renameObjectProperty,
5 │ + ··renameObjectProperty,
6 │ + ··updateObjectProperty,
7 │ + ··updatePropertyRequired,
8 8 │ } from "../../lib/schemaEditor.ts";
9 9 │ import type { JSONSchema, NewField } from "../../types/jsonSchema.ts";
src/components/SchemaEditor/SchemaVisualEditor.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Formatter would have printed the following content:
58 58 │ newSchema = renameObjectProperty(newSchema, name, updatedField.name);
59 59 │ // Update the field schema after rename
60 │ - ······newSchema·=·updateObjectProperty(newSchema,·updatedField.name,·fieldSchema);
60 │ + ······newSchema·=·updateObjectProperty(
61 │ + ········newSchema,
62 │ + ········updatedField.name,
63 │ + ········fieldSchema,
64 │ + ······);
61 65 │ } else {
62 66 │ // Name didn't change, just update the schema
src/components/SchemaEditor/TypeEditor.tsx:1:1 assist/source/organizeImports FIXABLE ━━━━━━━━━━━━━━━━━━━━
✖ The imports and exports are not sorted.
> 1 │ import { lazy, Suspense } from "react";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │ import type {
3 │ JSONSchema,
ℹ Safe fix: Organize Imports (Biome)
1 1 │ import { lazy, Suspense } from "react";
2 │ - import·type·{
3 │ - ··JSONSchema,
4 │ - ··ObjectJSONSchema,
5 │ - ··SchemaType,
6 │ - }·from·"../../types/jsonSchema.ts";
7 │ - import·{·withObjectSchema·}·from·"../../types/jsonSchema.ts";
8 │ - import·type·{·ValidationTreeNode·}·from·"../../types/validation.ts";
9 │ - import·{·useTranslation·}·from·"../../hooks/use-translation.ts";
2 │ + import·{·useTranslation·}·from·"../../hooks/use-translation.ts";
3 │ + import·type·{
4 │ + ··JSONSchema,
5 │ + ··ObjectJSONSchema,
6 │ + ··SchemaType,
7 │ + }·from·"../../types/jsonSchema.ts";
8 │ + import·{·withObjectSchema·}·from·"../../types/jsonSchema.ts";
9 │ + import·type·{·ValidationTreeNode·}·from·"../../types/validation.ts";
10 10 │
11 11 │ // Lazy load specific type editors to avoid circular dependencies
src/hooks/use-monaco-theme.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Formatter would have printed the following content:
196 196 │ };
197 197 │
198 │ - ····MonacoModule.json.jsonDefaults.setDiagnosticsOptions(
199 │ - ······diagnosticsOptions,
200 │ - ····);
198 │ + ····MonacoModule.json.jsonDefaults.setDiagnosticsOptions(diagnosticsOptions);
201 199 │ };
202 200 │
src/i18n/locales/uk.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Formatter would have printed the following content:
11 11 │ fieldNameLabel: "Назва поля",
12 12 │ fieldNamePlaceholder: "наприклад, ім'я, вік, активне",
13 │ - ··fieldNameTooltip:·"Використовуйте·camelCase·для·кращої·читабельності·(наприклад,·firstName)",
13 │ + ··fieldNameTooltip:
14 │ + ····"Використовуйте·camelCase·для·кращої·читабельності·(наприклад,·firstName)",
14 15 │ fieldRequiredLabel: "Обов'язкове поле",
15 16 │ fieldType: "Тип поля",
······· │
133 134 │ inferrerCancel: "Скасувати",
134 135 │ inferrerGenerate: "Згенерувати схему",
135 │ - ··inferrerErrorInvalidJson:·"Неправильний·формат·JSON.·Перевірте,·будь·ласка,·введені·дані.",
136 │ + ··inferrerErrorInvalidJson:
137 │ + ····"Неправильний·формат·JSON.·Перевірте,·будь·ласка,·введені·дані.",
136 138 │
137 139 │ validatorTitle: "Перевірити JSON",
······· │
155 157 │ visualEditorNoFieldsHint2: "Додайте перше поле, щоб почати",
156 158 │
157 │ - ··typeValidationErrorNegativeLength:·"Значення·довжини·не·можуть·бути·від'ємними.",
159 │ + ··typeValidationErrorNegativeLength:
160 │ + ····"Значення·довжини·не·можуть·бути·від'ємними.",
158 161 │ typeValidationErrorIntValue: "Значення має бути цілим числом.",
159 162 │ typeValidationErrorPositive: "Значення має бути додатнім.",
test/lib/schemaEditor.test.ts:1:1 assist/source/organizeImports FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The imports and exports are not sorted.
> 1 │ import { describe, test } from "node:test";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │ import assert from "node:assert";
3 │ import { renameObjectProperty } from "../../src/lib/schemaEditor.ts";
ℹ Safe fix: Organize Imports (Biome)
1 │ - import·{·describe,·test·}·from·"node:test";
2 │ - import·assert·from·"node:assert";
1 │ + import·assert·from·"node:assert";
2 │ + import·{·describe,·test·}·from·"node:test";
3 3 │ import { renameObjectProperty } from "../../src/lib/schemaEditor.ts";
4 4 │
Checked 90 files in 279ms. No fixes applied.
Found 7 errors.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Some errors were emitted while running checks.
ELIFECYCLE Command failed with exit code 1.
```
check script by running the fix script.
Owner
|
Thanks ! Could you please also update the github action workflows so that this check is enforced in ci ? |
Contributor
Author
|
I was wondering about an implementation like that. Do you just want it to fail the CI? Would you be open to using something like Husky to run it (maybe some other tools too) on pre-commit? What all scripts would you like to make sure are passing? I know there's some lint rules, type checks, etc. I wasn't sure the difference of |
Owner
|
https://github.com/lovasoa/jsonjoy-builder/blob/main/package.json#L56
|
Contributor
Author
|
@lovasoa alrighty check it out, I think I've got implemented what you were requesting. |
lovasoa
approved these changes
Jan 23, 2026
Owner
|
thx! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes all the errors returned from the
checkscript by running thefixscript.Before
Details