amilajack / amilajack/eslint-plugin-compat

Bug: ESlint not detecting Safari limited support of custom components

Đang mở
#645 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
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ả

In CanIUse I found that Safari browsers have only limited support for the customized built-in-elements.
https://caniuse.com/custom-elementsv1

I have Eslint setup with compatibility checking in order to catch such problems.
However, it passes without errors which does not seem like correct behaviour.

My config:
```js
import pluginJs from "@eslint/js";
import compat from "eslint-plugin-compat";
import globals from "globals";

export default [
{
files: ["**/*.mjs"],
languageOptions: { sourceType: "module" },
},
{
files: ["**/*.js"],
languageOptions: { sourceType: "commonjs" },
},
{
files: ["functions/**/*.js"], // backend code
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.node, // Include node globals like 'process'
}
},
},
{
files: ["tests/**/*.js"], // Jest tests
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.browser, // Include browser globals like 'document' arising from puppeteer
...globals.jest, // Include Jest globals like 'test', 'expect'
}
},
},
{
files: ["public/**/*.{js,mjs}"], // Browser facing code
languageOptions: {
sourceType: "commonjs" ,
globals: {
...globals.browser, // Include browser globals like 'document'
}
},
settings: {
browsers: [
"> 1%",
"last 3 versions",
"not dead",
"defaults",
"not op_mini all"
]
},
plugins: {
compat: compat // Compatibility testing in browser facing code
},
rules: {
...compat.configs["flat/recommended"].rules,
}
},
pluginJs.configs.recommended
];
```

Sample code that should give errors:
```js
class FooterComponent extends HTMLElement {
/**
* Constructs a new instance of the Footer component.
*
* Is added as follows:
*
* [text]
*
*
* @class FooterComponent
* @extends {HTMLElement}
* @constructor
*/
constructor() {
super()
}
}

customElements.define('footer-component', FooterComponent, {
extends: 'footer'
})
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.