Skip to content

修改项目.eslintrc.cjs配置 #94

@HowieHz

Description

@HowieHz

运行 pnpm run lint 后出现以下错误

 *  正在执行任务: pnpm run lint 


> @ lint E:\FileLibrary\CloneOthers\halo-theme-higan
> eslint ./src --ext .js,.cjs,.mjs,.ts,.cts,.mts --ignore-path .gitignore


E:\FileLibrary\CloneOthers\halo-theme-higan\src\assets\main.js    
    4:5   error  Redundant double negation   no-extra-boolean-cast
    4:7   error  '$' is not defined          no-undef
   10:3   error  '$' is not defined          no-undef
   13:1   error  'window' is not defined     no-undef
   14:84  error  'navigator' is not defined  no-undef
   18:1   error  '$' is not defined          no-undef
   22:3   error  '$' is not defined          no-undef
   23:5   error  '$' is not defined          no-undef
   30:7   error  '$' is not defined          no-undef
   31:18  error  '$' is not defined          no-undef
   33:22  error  '$' is not defined          no-undef
   38:9   error  '$' is not defined          no-undef
   38:11  error  'document' is not defined   no-undef
   61:7   error  '$' is not defined          no-undef
   61:9   error  'window' is not defined     no-undef
   73:14  error  '$' is not defined          no-undef
   74:11  error  '$' is not defined          no-undef
   75:11  error  '$' is not defined          no-undef
   76:21  error  '$' is not defined          no-undef
   77:11  error  '$' is not defined          no-undef
   78:11  error  '$' is not defined          no-undef
   87:9   error  '$' is not defined          no-undef
   89:7   error  '$' is not defined          no-undef
   89:9   error  'window' is not defined     no-undef
   90:27  error  '$' is not defined          no-undef
   90:29  error  'window' is not defined     no-undef
   94:11  error  '$' is not defined          no-undef
   97:11  error  '$' is not defined          no-undef
  102:9   error  '$' is not defined          no-undef
  103:9   error  '$' is not defined          no-undef
  104:9   error  '$' is not defined          no-undef
  109:11  error  '$' is not defined          no-undef
  111:11  error  '$' is not defined          no-undef
  118:3   error  '$' is not defined          no-undef
  119:3   error  '$' is not defined          no-undef

E:\FileLibrary\CloneOthers\halo-theme-higan\src\create-toc.ts
  24:9   error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  38:13  error  'headingNumber' is never reassigned. Use 'const' instead      prefer-const
  67:19  error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  84:5   error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment

E:\FileLibrary\CloneOthers\halo-theme-higan\src\vite-env.d.ts
  10:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 40 problems (39 errors, 1 warning)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

 ELIFECYCLE  Command failed with exit code 1.

发现出现大量no-undef错误,但是实际运行主题时未出现
检查后发现是 .eslintrc.cjs 缺失相关设置导致

image

修改后

 *  正在执行任务: pnpm run lint 


> @ lint E:\FileLibrary\CloneOthers\halo-theme-higan
> eslint ./src --ext .js,.cjs,.mjs,.ts,.cts,.mts --ignore-path .gitignore


E:\FileLibrary\CloneOthers\halo-theme-higan\src\assets\main.js
  4:5  error  Redundant double negation  no-extra-boolean-cast

E:\FileLibrary\CloneOthers\halo-theme-higan\src\create-toc.ts
  24:9   error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  38:13  error  'headingNumber' is never reassigned. Use 'const' instead      prefer-const
  67:19  error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  84:5   error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment

E:\FileLibrary\CloneOthers\halo-theme-higan\src\vite-env.d.ts
  10:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 6 problems (5 errors, 1 warning)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

 ELIFECYCLE  Command failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions