未验证 提交 6ff72006 编写于 作者: P Prateek Bhatnagar 提交者: GitHub

bug fixes for css eslint rule (#14202)

- ignores the link tags which do not have literal href
e.g. `<link rel="stylesheet" href={props.href} />`
上级 d3704a66
......@@ -18,7 +18,9 @@ module.exports = function (context) {
) &&
attributes.find(
(attr) =>
attr.name.name === 'href' && !/^https?/.test(attr.value.value)
attr.name.name === 'href' &&
attr.value.type === 'Literal' &&
!/^https?/.test(attr.value.value)
)
) {
context.report({
......
......@@ -50,6 +50,18 @@ ruleTester.run('no-css-tags', rule, {
);
}
}`,
`import {Head} from 'next/document';
export class Blah extends Head {
render(props) {
return (
<div>
<h1>Hello title</h1>
<link rel="stylesheet" {...props} />
</div>
);
}
}`,
],
invalid: [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册