ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.51k stars 8.15k forks source link

🐛[BUG] antd 创建完默认项目后 eslint 报错 #9449

Closed molingyu closed 2 years ago

molingyu commented 2 years ago

🐛 bug 描述

📷 复现步骤

> yarn create umi myapp
> cd myapp
> yarn
> yarn lint

umi create choose

ant-design-pro
TypeScript
Complete

出现如下错误

yarn run v1.22.17
$ eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0

YOUR TYPESCRIPT VERSION: 4.5.4

Please only submit bug reports when using the officially supported version.

=============

  src\pages\account\settings\index.tsx:57:6
  ‼  57:6  React Hook useLayoutEffect has a missing dependency: resize. Either include it or remove the dependency array. Mutable values like dom.current aren't valid dependencies because mutating them doesn't re-render the component.  react-hooks/exhaustive-deps

  src\pages\account\center\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\account\settings\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\form\advanced-form\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\form\basic-form\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\form\step-form\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\list\basic-list\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\list\card-list\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\list\search\applications\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\list\search\articles\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\list\table-list\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\pages\user\register\_mock.ts:1:1
  ×   1:1  Definition for rule import/no-extraneous-dependencies was not found.
                         import/no-extraneous-dependencies

  src\service-worker.js:1:1
  ×   1:1  Definition for rule eslint-comments/disable-enable-pair was not found.
                         eslint-comments/disable-enable-pair

  1 warning
  12 errors

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

🏞 期望结果

💻 复现代码

© 版本信息

🚑 其他信息

chenshuai2144 commented 2 years ago

重新生成一下就好了

molingyu commented 2 years ago

@chenshuai2144 重新生成依然存在这个问题

我最后自己额外添加了 错误里提示的对应的插件

.eslintrc.js

plugins: ['eslint-plugin-import', 'eslint-plugin-eslint-comments'],
chenshuai2144 commented 2 years ago

推荐你直接删掉这些

eslint-comments/disable-enable-pair