amilajack / amilajack/eslint-plugin-compat
It seems that !lintAllEsApis is not working
- Ngôn ngữ chính
- TypeScript
- Star
- 3.2k
- Fork
- 115
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hi! I want to add `eslint-plugin-compat` to my project, and the trouble is that plugin ignores babel built-in polyfills. I have tried to debug it, and it seems that the reason is here:
[compat.ts:165](https://github.com/amilajack/eslint-plugin-compat/blob/89b7dc7c53b9b39d76ac508fb46c74859daf75f0/src/rules/compat.ts#L165)
```typescript
nodes.filter((node) => {
return lintAllEsApis ? true : node.kind !== "es";
})
```
This code ignores node if `node.kind` is `es`, but there is no `es` property in caniuse nodes. Because of this, duplicated rules affects lint process anyway (Promise for example).
For now I fixed it in `.eslintrc.js` like this, but it seems to be a bad practice:
```javascript
polyfills: [
'es:all',
...Object.keys(require('@babel/preset-env/lib/polyfills/corejs3/built-in-definitions').BuiltIns),
],
```
You can see the demo here: https://github.com/kshshe/eslint-plugin-compat-demo
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.