ecomfe / fecs

Front End Code Style Suite
http://fecs.baidu.com/
643 stars 115 forks source link

--stream 不支持 HTML #344

Open harttle opened 5 years ago

harttle commented 5 years ago

安装 fecs@1.6.4,执行命令:

fecs check --stream < a.html

产生错误:

fecs  INFO current-file.js (1 message)
fecs ERROR → line 1, col 2: Parsing error: Unexpected token> 1 | <!DOCTYPE html>    |  ^  2 | <html lang="en">  3 | <head>  4 |   <meta charset="UTF-8">

fecs  INFO Linter found 1 error in 1 of 1 file.
fecs@1.6.4: 251.727ms

预期:能够报告 HTML 中的错误,而不是解析 HTML 失败。附上 a.html 内容:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
<script>
console.log(1,2)
</script>
</body>
</html>

以上 HTML 为例,CSS 也有同样的问题。JS 和 TypeScript 表现正常。