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

4.6.0 eslint 不兼容 #226

Closed
yzw7489757 opened this issue Jun 29, 2022 · 7 comments
Closed

4.6.0 eslint 不兼容 #226

yzw7489757 opened this issue Jun 29, 2022 · 7 comments

Comments

@yzw7489757
Copy link

eslint version : "7.32.0"
原 ^4.5.1
自动升级至 4.6.0

image

解决方式:
通过 yarn 的 resolution 字段锁定 4.5.1 版本,问题解决。

@yzw7489757
Copy link
Author

该规则增加于 [5.22.0](typescript-eslint/typescript-eslint@v5.21.0...v5.22.0#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR18)

团队的 lint 包 @typescript-eslint/eslint-plugin 还处于 4.29.0 版本,导致不能兼容,是否应该增加 peer 来限制?

@xcatliu
Copy link
Member

xcatliu commented Jun 29, 2022

现在 eslint-config-alloy 是单包管理,如果添加 peer 需要把所有 plugin 都加上,但你用了 React 就肯定不会用 Vue,于是会导致 install 时 peer 报错缺少依赖。

要彻底解决这个问题,需要拆成多个包吧

@xcatliu
Copy link
Member

xcatliu commented Jun 29, 2022

我好像找到解决办法了,可以用 peerDependenciesMeta
https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependenciesmeta

@yzw7489757
Copy link
Author

peer 需要把所有 plugin 都加上,但你用了 React 就肯定不会用 Vue,于是会导致 install 时 peer 报错缺少依赖。

要彻底解决这个问题,需要拆成多个包吧

嗯,两者结合的方式还有待更多场景考证,目前看来似乎没问题

@xcatliu
Copy link
Member

xcatliu commented Jul 3, 2022

Fixed in 4.6.1

@pawover
Copy link

pawover commented Jul 4, 2022

@xcatliu
现在可以同时配置 React 和 Vue 的规则吗,项目有需求混合开发,目前 eslint 会把 React 的 JSX 识别为 Vue 的 JSX

@xcatliu
Copy link
Member

xcatliu commented Jul 4, 2022

@Handpear 应该是可以的,如果有冲突,可以用 overrides 来针对不同文件配置不同规则

@xcatliu xcatliu closed this as completed Jul 8, 2022
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

No branches or pull requests

3 participants