Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting changes #124

Conversation

github-actions[bot]
Copy link
Contributor

This pull request includes linting changes based on the target branch.

Please review and merge if everything looks good.

Additional suggestions: ./tests/pages/CounterTests.tsx organizeImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Import statements could be sorted:

 2  2 │   import { BuiltInButton } from "../BuiltInButton";
 3  3 │   import { CounterWithReduxStore } from "../CounterWithReduxStore";
 4    │ - import·{·SimpleCounter·}·from·"../SimpleCounter";
 5    │ - import·{·StoredObservableCounter·}·from·"../StoredObservableCounter";
 6    │ - import·{·IndexedDBCounter·}·from·"../IndexedDBCounter";
    4 │ + import·{·IndexedDBCounter·}·from·"../IndexedDBCounter";
    5 │ + import·{·SimpleCounter·}·from·"../SimpleCounter";
    6 │ + import·{·StoredObservableCounter·}·from·"../StoredObservableCounter";
 7  7 │   
 8  8 │   export const CounterTests = () => (

./tasks/generateTypes.ts:16:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Prefer for...of instead of Array.forEach

14 │ >();
15 │ 

16 │ supportedHTMLElements.forEach((x) => {
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 │ elements.set(x.tagName, {
18 │ attributes: [HTMLElements["${x.tagName}"]],
19 │ elementInterfaces: [x.elementInterface],
20 │ });
21 │ });
│ ^^
22 │ supportedMathMLElements.forEach((x) => {
23 │ elements.set(x.tagName, {

i forEach could lead to performance issues when working with large arrays. When combined with functions like .filter or .map, this causes multiple iterations over the same type.

./tasks/generateTypes.ts:22:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Prefer for...of instead of Array.forEach

20 │   });
21 │ });

22 │ supportedMathMLElements.forEach((x) => {
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 │ elements.set(x.tagName, {
24 │ attributes: [MathMLElements["${x.tagName}"]],
25 │ elementInterfaces: [x.elementInterface],
26 │ });
27 │ });
│ ^^
28 │ supportedSVGElements.forEach((x) => {
29 │ const attributes = SVGElements["${x.tagName}"];

i forEach could lead to performance issues when working with large arrays. When combined with functions like .filter or .map, this causes multiple iterations over the same type.

./tasks/generateTypes.ts:28:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Prefer for...of instead of Array.forEach

26 │   });
27 │ });

28 │ supportedSVGElements.forEach((x) => {
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 │ const attributes = SVGElements["${x.tagName}"];
...
40 │ }
41 │ });
│ ^^
42 │
43 │ rmSync("./src/michijs/h/generated", { recursive: true, force: true });

i forEach could lead to performance issues when working with large arrays. When combined with functions like .filter or .map, this causes multiple iterations over the same type.

./tasks/generateTypes.ts lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tasks/generateTypes.ts organizeImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Import statements could be sorted:

 1    │ - import·{
    1 │ + import·{·mkdirSync,·rmSync,·writeFileSync·}·from·"fs";
    2 │ + import·{
 2  3 │     supportedHTMLElements,
 3  4 │     supportedMathMLElements,
 4  5 │     supportedSVGElements,
 5    │ - }·from·"@michijs/htmltype/supported";
 6    │ - import·{·writeFileSync,·rmSync,·mkdirSync·}·from·"fs";
    6 │ + }·from·"@michijs/htmltype/supported";
 7  7 │   
 8  8 │   const elements = new Map<

./tests/pages/CounterTests.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

 7  7 │   
 8  8 │   export const CounterTests = () => (
 9    │ - ··<>
10    │ - ····<h1>·Simple·counter</h1>
11    │ - ····<SimpleCounter
12    │ - ······oncountchanged={(ev)·=>·{
13    │ - ········console.log(ev.detail);
14    │ - ······}}
15    │ - ····/>
16    │ - ····<SimpleCounter·/>
17    │ - ····<h1>Counter·with·redux·store</h1>
18    │ - ····<CounterWithReduxStore·/>
19    │ - ····<CounterWithReduxStore·/>
20    │ - ····<h1>IndexedDB·counter</h1>
21    │ - ····<IndexedDBCounter·/>
22    │ - ····<IndexedDBCounter·/>
23    │ - ····<h1>Stored·attribute·counter</h1>
24    │ - ····<StoredObservableCounter·/>
25    │ - ····<StoredObservableCounter·/>
26    │ - ····<h1>Built-in·component</h1>
27    │ - ····<BuiltInButton>Sample·customized·button</BuiltInButton>
28    │ - ··</>
    9 │ + → <>
   10 │ + → → <h1>·Simple·counter</h1>
   11 │ + → → <SimpleCounter
   12 │ + → → → oncountchanged={(ev)·=>·{
   13 │ + → → → → console.log(ev.detail);
   14 │ + → → → }}
   15 │ + → → />
   16 │ + → → <SimpleCounter·/>
   17 │ + → → <h1>Counter·with·redux·store</h1>
   18 │ + → → <CounterWithReduxStore·/>
   19 │ + → → <CounterWithReduxStore·/>
   20 │ + → → <h1>IndexedDB·counter</h1>
   21 │ + → → <IndexedDBCounter·/>
   22 │ + → → <IndexedDBCounter·/>
   23 │ + → → <h1>Stored·attribute·counter</h1>
   24 │ + → → <StoredObservableCounter·/>
   25 │ + → → <StoredObservableCounter·/>
   26 │ + → → <h1>Built-in·component</h1>
   27 │ + → → <BuiltInButton>Sample·customized·button</BuiltInButton>
   28 │ + → </>
29 29 │   );
30 30 │   

./tests/pages/CounterTests.tsx check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tests/pages/i18nTests/en.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

1 1 │   {
2   │ - ····"language":·"Language",
3   │ - ····"dogBit":·"The·dog·bit·its·owner"
4   │ - }
  2 │ + → "language":·"Language",
  3 │ + → "dogBit":·"The·dog·bit·its·owner"
  4 │ + }
  5 │ + 

./tests/pages/i18nTests/en.json check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tests/pages/i18nTests/es.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

1 1 │   {
2   │ - ····"language":·"Lenguaje",
3   │ - ····"dogBit":·"El·perro·mordió·a·su·dueño"
4   │ - }
  2 │ + → "language":·"Lenguaje",
  3 │ + → "dogBit":·"El·perro·mordió·a·su·dueño"
  4 │ + }
  5 │ + 

./tests/pages/i18nTests/es.json check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tasks/generateTypes.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

 1  1 │   import {
 2    │ - ··supportedHTMLElements,
 3    │ - ··supportedMathMLElements,
 4    │ - ··supportedSVGElements,
    2 │ + → supportedHTMLElements,
    3 │ + → supportedMathMLElements,
    4 │ + → supportedSVGElements,
 5  5 │   } from "@michijs/htmltype/supported";
 6  6 │   import { writeFileSync, rmSync, mkdirSync } from "fs";
 7  7 │   
 8  8 │   const elements = new Map<
 9    │ - ··string,
10    │ - ··{
11    │ - ····attributes:·string[];
12    │ - ····elementInterfaces:·string[];
13    │ - ··}
    9 │ + → string,
   10 │ + → {
   11 │ + → → attributes:·string[];
   12 │ + → → elementInterfaces:·string[];
   13 │ + → }
14 14 │   >();
15 15 │   
16 16 │   supportedHTMLElements.forEach((x) => {
17    │ - ··elements.set(x.tagName,·{
18    │ - ····attributes:·[`HTMLElements["${x.tagName}"]`],
19    │ - ····elementInterfaces:·[x.elementInterface],
20    │ - ··});
   17 │ + → elements.set(x.tagName,·{
   18 │ + → → attributes:·[`HTMLElements["${x.tagName}"]`],
   19 │ + → → elementInterfaces:·[x.elementInterface],
   20 │ + → });
21 21 │   });
22 22 │   supportedMathMLElements.forEach((x) => {
23    │ - ··elements.set(x.tagName,·{
24    │ - ····attributes:·[`MathMLElements["${x.tagName}"]`],
25    │ - ····elementInterfaces:·[x.elementInterface],
26    │ - ··});
   23 │ + → elements.set(x.tagName,·{
   24 │ + → → attributes:·[`MathMLElements["${x.tagName}"]`],
   25 │ + → → elementInterfaces:·[x.elementInterface],
   26 │ + → });
27 27 │   });
28 28 │   supportedSVGElements.forEach((x) => {
29    │ - ··const·attributes·=·`SVGElements["${x.tagName}"]`;
30    │ - ··const·elementInterface·=·x.elementInterface;
31    │ - ··const·element·=·elements.get(x.tagName);
32    │ - ··if·(element)·{
33    │ - ····element.attributes.push(attributes);
34    │ - ····element.elementInterfaces.push(elementInterface);
35    │ - ··}·else·{
36    │ - ····elements.set(x.tagName,·{
37    │ - ······attributes:·[attributes],
38    │ - ······elementInterfaces:·[x.elementInterface],
39    │ - ····});
40    │ - ··}
   29 │ + → const·attributes·=·`SVGElements["${x.tagName}"]`;
   30 │ + → const·elementInterface·=·x.elementInterface;
   31 │ + → const·element·=·elements.get(x.tagName);
   32 │ + → if·(element)·{
   33 │ + → → element.attributes.push(attributes);
   34 │ + → → element.elementInterfaces.push(elementInterface);
   35 │ + → }·else·{
   36 │ + → → elements.set(x.tagName,·{
   37 │ + → → → attributes:·[attributes],
   38 │ + → → → elementInterfaces:·[x.elementInterface],
   39 │ + → → });
   40 │ + → }
41 41 │   });
42 42 │   
····· │ 
45 45 │   
46 46 │   writeFileSync(
47    │ - ··"./src/michijs/h/generated/JSX.ts",
48    │ - ··`·import·{·HTMLElements·as·HTMLElementsHTMLType,·MathMLElements,·SVGElements·as·SVGElementsHTMLType·}·from·"@michijs/htmltype";
   47 │ + → "./src/michijs/h/generated/JSX.ts",
   48 │ + → `·import·{·HTMLElements·as·HTMLElementsHTMLType,·MathMLElements,·SVGElements·as·SVGElementsHTMLType·}·from·"@michijs/htmltype";
49 49 │     import { MichiAttributes } from "../MichiAttributes";
50 50 │     import { SingleJSXElement } from '../../types';
····· │ 
52 52 │     interface ElementsInterfaceOverride {
53 53 │       ${Array.from(elements)
54    │ - ······.filter(([_name,·x])·=>·x.elementInterfaces.length·>·1)
55    │ - ······.map(([name,·x])·=>·`${name}:·${x.elementInterfaces.join("·&·")}`)
56    │ - ······.join(",\n")}
   54 │ + → → → .filter(([_name,·x])·=>·x.elementInterfaces.length·>·1)
   55 │ + → → → .map(([name,·x])·=>·`${name}:·${x.elementInterfaces.join("·&·")}`)
   56 │ + → → → .join(",\n")}
57 57 │     }
58 58 │     type HTMLElements = HTMLElementsHTMLType<ElementsInterfaceOverride>;
····· │ 
67 67 │         interface IntrinsicElements extends HTMLElements, MathMLElements, SVGElements {
68 68 │           ${Array.from(elements)
69    │ - ··········.sort()
70    │ - ··········.map(
71    │ - ············([key,·{·attributes,·elementInterfaces·}])·=>
72    │ - ··············`${key}:·${attributes.join(
73    │ - ················"·&·",
74    │ - ··············)}·&·MichiAttributes<${elementInterfaces.join("·&·")}>;`,
75    │ - ··········)
76    │ - ··········.join("\n")}
   69 │ + → → → → → .sort()
   70 │ + → → → → → .map(
   71 │ + → → → → → → ([key,·{·attributes,·elementInterfaces·}])·=>
   72 │ + → → → → → → → `${key}:·${attributes.join(
   73 │ + → → → → → → → → "·&·",
   74 │ + → → → → → → → )}·&·MichiAttributes<${elementInterfaces.join("·&·")}>;`,
   75 │ + → → → → → )
   76 │ + → → → → → .join("\n")}
77 77 │         }
78 78 │       }

./tasks/generateTypes.ts check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./dist.tsconfig.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

 1  1 │   {
 2    │ - ··"compilerOptions":·{
 3    │ - ····"strictFunctionTypes":·true,
 4    │ - ····"strictNullChecks":·true,
 5    │ - ····"strictBindCallApply":·true,
 6    │ - ····"resolveJsonModule":·true,
 7    │ - ····"allowJs":·true,
 8    │ - ····"allowSyntheticDefaultImports":·true,
 9    │ - ····"allowUnreachableCode":·false,
10    │ - ····"declaration":·true,
11    │ - ····"experimentalDecorators":·true,
12    │ - ····"noErrorTruncation":·true,
13    │ - ····"lib":·[
14    │ - ······"dom",
15    │ - ······"es2020"
16    │ - ····],
17    │ - ····"outDir":·"dist",
18    │ - ····"moduleResolution":·"node16",
19    │ - ····"module":·"esnext",
20    │ - ····"target":·"es2019",
21    │ - ····"noUnusedLocals":·false,
22    │ - ····"noUnusedParameters":·false,
23    │ - ····"noImplicitThis":·true,
24    │ - ····"jsx":·"react",
25    │ - ····"jsxFactory":·"h.createElement",
26    │ - ····"jsxFragmentFactory":·"h.Fragment"
27    │ - ··},
28    │ - ··"include":·[
29    │ - ····"src"
30    │ - ··],
31    │ - ··"exclude"·:·[
32    │ - ····"src/**/*.spec.ts",
33    │ - ····"src/**/*.spec.tsx"
34    │ - ··]
35    │ - }
    2 │ + → "compilerOptions":·{
    3 │ + → → "strictFunctionTypes":·true,
    4 │ + → → "strictNullChecks":·true,
    5 │ + → → "strictBindCallApply":·true,
    6 │ + → → "resolveJsonModule":·true,
    7 │ + → → "allowJs":·true,
    8 │ + → → "allowSyntheticDefaultImports":·true,
    9 │ + → → "allowUnreachableCode":·false,
   10 │ + → → "declaration":·true,
   11 │ + → → "experimentalDecorators":·true,
   12 │ + → → "noErrorTruncation":·true,
   13 │ + → → "lib":·["dom",·"es2020"],
   14 │ + → → "outDir":·"dist",
   15 │ + → → "moduleResolution":·"node16",
   16 │ + → → "module":·"esnext",
   17 │ + → → "target":·"es2019",
   18 │ + → → "noUnusedLocals":·false,
   19 │ + → → "noUnusedParameters":·false,
   20 │ + → → "noImplicitThis":·true,
   21 │ + → → "jsx":·"react",
   22 │ + → → "jsxFactory":·"h.createElement",
   23 │ + → → "jsxFragmentFactory":·"h.Fragment"
   24 │ + → },
   25 │ + → "include":·["src"],
   26 │ + → "exclude":·["src/**/*.spec.ts",·"src/**/*.spec.tsx"]
   27 │ + }
   28 │ + 

./dist.tsconfig.json check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tests/pages/AsyncTests.tsx organizeImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Import statements could be sorted:

 1    │ - import·{·h,·Link·}·from·"../../src";
    1 │ + import·{·Link,·h·}·from·"../../src";
 2  2 │   import { AsyncTestsRouter, asyncTestsUrls } from "../routes";
 3  3 │   

./tasks.tsconfig.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

 1  1 │   {
 2    │ - ··"compilerOptions":·{
 3    │ - ····"strictFunctionTypes":·true,
 4    │ - ····"strictNullChecks":·true,
 5    │ - ····"strictBindCallApply":·true,
 6    │ - ····"esModuleInterop":·true,
 7    │ - ····"resolveJsonModule":·true,
 8    │ - ····"allowJs":·true,
 9    │ - ····"allowSyntheticDefaultImports":·true,
10    │ - ····"allowUnreachableCode":·false,
11    │ - ····"declaration":·true,
12    │ - ····"experimentalDecorators":·true,
13    │ - ····"noErrorTruncation":·true,
14    │ - ····"lib":·[
15    │ - ······"dom",
16    │ - ······"esnext"
17    │ - ····],
18    │ - ····"incremental":·true,
19    │ - ····"outDir":·"bin",
20    │ - ····"moduleResolution":·"node",
21    │ - ····"module":·"commonjs",
22    │ - ····"target":·"esnext",
23    │ - ····"noUnusedLocals":·false,
24    │ - ····"noUnusedParameters":·false
25    │ - ··},
26    │ - ··"include":·[
27    │ - ····"tasks"
28    │ - ··],
29    │ - ··"exclude":·[
30    │ - ····"node_modules"
31    │ - ··]
32    │ - }
    2 │ + → "compilerOptions":·{
    3 │ + → → "strictFunctionTypes":·true,
    4 │ + → → "strictNullChecks":·true,
    5 │ + → → "strictBindCallApply":·true,
    6 │ + → → "esModuleInterop":·true,
    7 │ + → → "resolveJsonModule":·true,
    8 │ + → → "allowJs":·true,
    9 │ + → → "allowSyntheticDefaultImports":·true,
   10 │ + → → "allowUnreachableCode":·false,
   11 │ + → → "declaration":·true,
   12 │ + → → "experimentalDecorators":·true,
   13 │ + → → "noErrorTruncation":·true,
   14 │ + → → "lib":·["dom",·"esnext"],
   15 │ + → → "incremental":·true,
   16 │ + → → "outDir":·"bin",
   17 │ + → → "moduleResolution":·"node",
   18 │ + → → "module":·"commonjs",
   19 │ + → → "target":·"esnext",
   20 │ + → → "noUnusedLocals":·false,
   21 │ + → → "noUnusedParameters":·false
   22 │ + → },
   23 │ + → "include":·["tasks"],
   24 │ + → "exclude":·["node_modules"]
   25 │ + }
   26 │ + 

./tasks.tsconfig.json check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× The file contains diagnostics that needs to be addressed.

./tests/pages/AsyncTests.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Formatter would have printed the following content:

 3  3 │   
 4  4 │   export const AsyncTests = () => (
 5    │ - ··<>
 6    │ - ····<Link·url={asyncTestsUrls.test1()}>Link·to·test</Link>
 7    │ - ····<Link·url={asyncTestsUrls.test2()}>Link·to·test·2</Link>
 8    │ - ····<Link·url={asyncTestsUrls.test3()}>Link·to·test·3</Link>
 9    │ - ····<AsyncTestsRouter·/>
10    │ - ··</>
    5 │ + → <>
    6 │ + → → <Link·url={asyncTestsUrls.test1()}>Link·to·test</Link>
    7 │ + → → <Link·url={asyncTestsUrls.test2()}>Link·to·test·2</Link>
    8 │ + → → <Link·url={asyncTestsUrls.test3()}>Link·to·test·3</Link>
    9 │ + → → <AsyncTestsRouter·/>
   10 │ + → </>
11 11 │   );
12 12 │   

The number of diagnostics exceeds the number allowed by Biome.
Diagnostics not shown: 582.
Checked 147 file(s) in 117ms
Found 198 error(s)
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Some errors were emitted while running checks.

@lsegurado lsegurado closed this Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant