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

[master] Linting changes #271

Merged
merged 1 commit into from
Nov 20, 2024
Merged

[master] Linting changes #271

merged 1 commit into from
Nov 20, 2024

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: ./.vscode/settings.json:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected a property but instead found '}'.

5 │     "package.json": "bun.lockb, README.md,.gitignore, tsconfig.json, rome.json, dist.tsconfig.json, LICENSE.md, package-lock.json, jest-puppeteer.config.js, michi.config.ts",
6 │     "*.tsx": "$(capture).css, $(capture).css.ts, $(capture).html, $(capture).spec.ts, $(capture).spec.tsx, $(capture).stories.tsx, types.ts, constants.ts",

7 │ }
│ ^
8 │ }
9 │

i Expected a property here.

5 │     "package.json": "bun.lockb, README.md,.gitignore, tsconfig.json, rome.json, dist.tsconfig.json, LICENSE.md, package-lock.json, jest-puppeteer.config.js, michi.config.ts",
6 │     "*.tsx": "$(capture).css, $(capture).css.ts, $(capture).html, $(capture).spec.ts, $(capture).spec.tsx, $(capture).stories.tsx, types.ts, constants.ts",

7 │ }
│ ^
8 │ }
9 │

./.vscode/settings.json:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected a property but instead found '}'.

5 │     "package.json": "bun.lockb, README.md,.gitignore, tsconfig.json, rome.json, dist.tsconfig.json, LICENSE.md, package-lock.json, jest-puppeteer.config.js, michi.config.ts",
6 │     "*.tsx": "$(capture).css, $(capture).css.ts, $(capture).html, $(capture).spec.ts, $(capture).spec.tsx, $(capture).stories.tsx, types.ts, constants.ts",

7 │ }
│ ^
8 │ }
9 │

i Expected a property here.

5 │     "package.json": "bun.lockb, README.md,.gitignore, tsconfig.json, rome.json, dist.tsconfig.json, LICENSE.md, package-lock.json, jest-puppeteer.config.js, michi.config.ts",
6 │     "*.tsx": "$(capture).css, $(capture).css.ts, $(capture).html, $(capture).spec.ts, $(capture).spec.tsx, $(capture).stories.tsx, types.ts, constants.ts",

7 │ }
│ ^
8 │ }
9 │

./.vscode/settings.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Code formatting aborted due to parsing errors. To format code with errors, enable the 'formatter.formatWithErrors' option.

./.vscode/tasks.json:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected a property but instead found '}'.

10 │                 "isDefault": true
11 │             },

12 │ },
│ ^
13 │ ]
14 │ }

i Expected a property here.

10 │                 "isDefault": true
11 │             },

12 │ },
│ ^
13 │ ]
14 │ }

./.vscode/tasks.json:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected an array, an object, or a literal but instead found ']'.

11 │             },
12 │         },

13 │ ]
│ ^
14 │ }

i Expected an array, an object, or a literal here.

11 │             },
12 │         },

13 │ ]
│ ^
14 │ }

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

× Formatter would have printed the following content:

 1  1 │   {
 2    │ - ··"extends":·"@michijs/tsconfig/tsconfig.json",
 3    │ - ··"compilerOptions":·{
 4    │ - ····"outDir":·"bin",
 5    │ - ····"moduleResolution":·"NodeNext",
 6    │ - ····"module":·"NodeNext",
 7    │ - ····"target":·"esnext",
 8    │ - ··},
 9    │ - ··"exclude":·[
10    │ - ······"bin",
11    │ - ······"node_modules"
12    │ - ··],
13    │ - ··"include":·[
14    │ - ······"src"
15    │ - ··]
16    │ - }
    2 │ + → "extends":·"@michijs/tsconfig/tsconfig.json",
    3 │ + → "compilerOptions":·{
    4 │ + → → "outDir":·"bin",
    5 │ + → → "moduleResolution":·"NodeNext",
    6 │ + → → "module":·"NodeNext",
    7 │ + → → "target":·"esnext"
    8 │ + → },
    9 │ + → "exclude":·["bin",·"node_modules"],
   10 │ + → "include":·["src"]
   11 │ + }
   12 │ + 

./.vscode/tasks.json:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected a property but instead found '}'.

10 │                 "isDefault": true
11 │             },

12 │ },
│ ^
13 │ ]
14 │ }

i Expected a property here.

10 │                 "isDefault": true
11 │             },

12 │ },
│ ^
13 │ ]
14 │ }

./.vscode/tasks.json:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected an array, an object, or a literal but instead found ']'.

11 │             },
12 │         },

13 │ ]
│ ^
14 │ }

i Expected an array, an object, or a literal here.

11 │             },
12 │         },

13 │ ]
│ ^
14 │ }

./.vscode/tasks.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Code formatting aborted due to parsing errors. To format code with errors, enable the 'formatter.formatWithErrors' option.

./package.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Formatter would have printed the following content:

 1  1 │   {
 2    │ - ··"name":·"@michijs/dev-server",
 3    │ - ··"license":·"MIT",
 4    │ - ··"version":·"0.7.24-beta.0",
 5    │ - ··"repository":·{
 6    │ - ····"type":·"git",
 7    │ - ····"url":·"https://github.com/michijs/dev-server.git"
 8    │ - ··},
 9    │ - ··"main":·"bin/index",
10    │ - ··"exports":·{
11    │ - ····"types":·"./bin/index.d.ts",
12    │ - ····"default":·"./bin/index.js",
13    │ - ····"constants":·"./bin/constants.js"
14    │ - ··},
15    │ - ··"bin":·{
16    │ - ····"michi-server":·"bin/index.js"
17    │ - ··},
18    │ - ··"description":·"Development·server·based·on·esbuild",
19    │ - ··"files":·[
20    │ - ····"bin/",
21    │ - ····"feature-image-template.svg"
22    │ - ··],
23    │ - ··"type":·"module",
24    │ - ··"baseUrl":·"./src",
25    │ - ··"scripts":·{
26    │ - ····"dist":·"tsc",
27    │ - ····"dist-w":·"tsc·-w",
28    │ - ····"bun-link":·"bun·link·--force",
29    │ - ····"link":·"bunx·concurrently·bun:dist-w·bun:bun-link"
30    │ - ··},
31    │ - ··"devDependencies":·{
32    │ - ····"@michijs/tsconfig":·"0.0.4",
33    │ - ····"@types/node":·"22.9.0",
34    │ - ····"@types/yargs":·"17.0.33",
35    │ - ····"typescript":·"5.6.3"
36    │ - ··},
37    │ - ··"keywords":·[
38    │ - ····"react",
39    │ - ····"javascript",
40    │ - ····"css",
41    │ - ····"bundler",
42    │ - ····"typescript",
43    │ - ····"compiler",
44    │ - ····"jsx",
45    │ - ····"commonjs",
46    │ - ····"minifier",
47    │ - ····"tsx",
48    │ - ····"esm",
49    │ - ····"server",
50    │ - ····"development"
51    │ - ··],
52    │ - ··"engines":·{
53    │ - ····"node":·">=14.16"
54    │ - ··},
55    │ - ··"dependencies":·{
56    │ - ····"colorthief":·"2.6.0",
57    │ - ····"@types/web-app-manifest":·"1.0.8",
58    │ - ····"esbuild":·"0.24.0",
59    │ - ····"node-watch":·"0.7.4",
60    │ - ····"open":·"10.1.0",
61    │ - ····"playwright-core":·"1.49.0",
62    │ - ····"sharp":·"0.33.5",
63    │ - ····"yargs":·"17.7.2"
64    │ - ··}
    2 │ + → "name":·"@michijs/dev-server",
    3 │ + → "license":·"MIT",
    4 │ + → "version":·"0.7.24-beta.0",
    5 │ + → "repository":·{
    6 │ + → → "type":·"git",
    7 │ + → → "url":·"https://github.com/michijs/dev-server.git"
    8 │ + → },
    9 │ + → "main":·"bin/index",
   10 │ + → "exports":·{
   11 │ + → → "types":·"./bin/index.d.ts",
   12 │ + → → "default":·"./bin/index.js",
   13 │ + → → "constants":·"./bin/constants.js"
   14 │ + → },
   15 │ + → "bin":·{
   16 │ + → → "michi-server":·"bin/index.js"
   17 │ + → },
   18 │ + → "description":·"Development·server·based·on·esbuild",
   19 │ + → "files":·["bin/",·"feature-image-template.svg"],
   20 │ + → "type":·"module",
   21 │ + → "baseUrl":·"./src",
   22 │ + → "scripts":·{
   23 │ + → → "dist":·"tsc",
   24 │ + → → "dist-w":·"tsc·-w",
   25 │ + → → "bun-link":·"bun·link·--force",
   26 │ + → → "link":·"bunx·concurrently·bun:dist-w·bun:bun-link"
   27 │ + → },
   28 │ + → "devDependencies":·{
   29 │ + → → "@michijs/tsconfig":·"0.0.4",
   30 │ + → → "@types/node":·"22.9.0",
   31 │ + → → "@types/yargs":·"17.0.33",
   32 │ + → → "typescript":·"5.6.3"
   33 │ + → },
   34 │ + → "keywords":·[
   35 │ + → → "react",
   36 │ + → → "javascript",
   37 │ + → → "css",
   38 │ + → → "bundler",
   39 │ + → → "typescript",
   40 │ + → → "compiler",
   41 │ + → → "jsx",
   42 │ + → → "commonjs",
   43 │ + → → "minifier",
   44 │ + → → "tsx",
   45 │ + → → "esm",
   46 │ + → → "server",
   47 │ + → → "development"
   48 │ + → ],
   49 │ + → "engines":·{
   50 │ + → → "node":·">=14.16"
   51 │ + → },
   52 │ + → "dependencies":·{
   53 │ + → → "colorthief":·"2.6.0",
   54 │ + → → "@types/web-app-manifest":·"1.0.8",
   55 │ + → → "esbuild":·"0.24.0",
   56 │ + → → "node-watch":·"0.7.4",
   57 │ + → → "open":·"10.1.0",
   58 │ + → → "playwright-core":·"1.49.0",
   59 │ + → → "sharp":·"0.33.5",
   60 │ + → → "yargs":·"17.7.2"
   61 │ + → }
65 62 │   }
66 63 │   

./src/actions/build.ts:4:39 lint/complexity/noBannedTypes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Don't use 'Function' as a type.

2 │ import { build as esbuild } from "esbuild";
3 │ 

4 │ export async function build(callback: Function) {
│ ^^^^^^^^
5 │ await esbuild(config.esbuildOptions);
6 │ callback();

i Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

./src/actions/build.ts organizeImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Import statements could be sorted:

1   │ - import·{·config·}·from·"../config/config.js";
2   │ - import·{·build·as·esbuild·}·from·"esbuild";
  1 │ + import·{·build·as·esbuild·}·from·"esbuild";
  2 │ + import·{·config·}·from·"../config/config.js";
3 3 │   
4 4 │   export async function build(callback: Function) {

./src/actions/build.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Formatter would have printed the following content:

3 3 │   
4 4 │   export async function build(callback: Function) {
5   │ - ··await·esbuild(config.esbuildOptions);
6   │ - ··callback();
  5 │ + → await·esbuild(config.esbuildOptions);
  6 │ + → callback();
7 7 │   }
8 8 │   

./src/utils/syncDirs.ts:1:16 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━

× A Node.js builtin module should be imported with the node: protocol.

1 │ import fs from "fs";
│ ^^^^
2 │ import path from "path";
3 │ import { type Transformer, copyFile } from "../utils/copy.js";

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 1    │ - import·fs·from·"fs";
    1 │ + import·fs·from·"node:fs";
 2  2 │   import path from "path";
 3  3 │   import { type Transformer, copyFile } from "../utils/copy.js";

./src/utils/syncDirs.ts:2:18 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━

× A Node.js builtin module should be imported with the node: protocol.

1 │ import fs from "fs";

2 │ import path from "path";
│ ^^^^^^
3 │ import { type Transformer, copyFile } from "../utils/copy.js";
4 │ import watch from "node-watch";

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 1  1 │   import fs from "fs";
 2    │ - import·path·from·"path";
    2 │ + import·path·from·"node:path";
 3  3 │   import { type Transformer, copyFile } from "../utils/copy.js";
 4  4 │   import watch from "node-watch";

./src/utils/syncDirs.ts:35:11 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Prefer for...of instead of forEach.

33 │         );
34 │         if (fileTransformer.length > 0) {

35 │ fileTransformer.forEach(async (x) => {
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 │ if (x.fileRegex.test(fileChangedPath)) {
...
40 │ }
41 │ });
│ ^^
42 │ } else fs.rmSync(pathToRemove, { force: true, recursive: true });
43 │ } else {

i forEach may 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.

./src/utils/syncDirs.ts organizeImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Import statements could be sorted:

 1  1 │   import fs from "fs";
 2  2 │   import path from "path";
 3    │ - import·{·type·Transformer,·copyFile·}·from·"../utils/copy.js";
 4    │ - import·watch·from·"node-watch";
    3 │ + import·watch·from·"node-watch";
    4 │ + import·{·type·Transformer,·copyFile·}·from·"../utils/copy.js";
 5  5 │   import { getPath } from "../utils/getPath.js";
 6  6 │   import coloredString from "./coloredString.js";

./src/actions/minifyAsset.ts:2:47 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━

× A Node.js builtin module should be imported with the node: protocol.

1 │ import { getPath } from "../utils/getPath.js";

2 │ import { readdirSync, rmSync, statSync } from "fs";
│ ^^^^
3 │ import { basename, dirname } from "path";
4 │

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 1  1 │   import { getPath } from "../utils/getPath.js";
 2    │ - import·{·readdirSync,·rmSync,·statSync·}·from·"fs";
    2 │ + import·{·readdirSync,·rmSync,·statSync·}·from·"node:fs";
 3  3 │   import { basename, dirname } from "path";
 4  4 │   

./src/actions/minifyAsset.ts:3:35 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━

× A Node.js builtin module should be imported with the node: protocol.

1 │ import { getPath } from "../utils/getPath.js";
2 │ import { readdirSync, rmSync, statSync } from "fs";

3 │ import { basename, dirname } from "path";
│ ^^^^^^
4 │
5 │ async function minifyImage(src: string) {

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 1  1 │   import { getPath } from "../utils/getPath.js";
 2  2 │   import { readdirSync, rmSync, statSync } from "fs";
 3    │ - import·{·basename,·dirname·}·from·"path";
    3 │ + import·{·basename,·dirname·}·from·"node:path";
 4  4 │   
 5  5 │   async function minifyImage(src: string) {

./src/actions/dist.ts:2:16 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× A Node.js builtin module should be imported with the node: protocol.

1 │ import { tsconfig } from "../config/tsconfig.js";

2 │ import fs from "fs";
│ ^^^^
3 │ import path from "path";
4 │ import { transformSync as esbuild } from "esbuild";

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 1  1 │   import { tsconfig } from "../config/tsconfig.js";
 2    │ - import·fs·from·"fs";
    2 │ + import·fs·from·"node:fs";
 3  3 │   import path from "path";
 4  4 │   import { transformSync as esbuild } from "esbuild";

Skipped 16 suggested fixes.
If you wish to apply the suggested (unsafe) fixes, use the command biome check --fix --unsafe

The number of diagnostics exceeds the number allowed by Biome.
Diagnostics not shown: 99.
Checked 37 files in 20ms. No fixes applied.
Found 119 errors.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Some errors were emitted while running checks.

@lsegurado lsegurado merged commit 7774f8d into master Nov 20, 2024
@lsegurado lsegurado deleted the master_lint branch November 20, 2024 18:31
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