htmlhint/HTMLHint
GitHub: htmlhint/HTMLHint
一款专注于 HTML 的静态代码分析工具,帮助开发者检测语法错误并强制执行代码规范。
Stars: 3319 | Forks: 440
HTMLHint
您 HTML 项目所需的静态代码分析工具。
## 目录 - **[安装与使用](#-installation-and-usage)** - **[本地安装与使用](#local-installation-and-usage)** - **[全局安装与使用](#global-installation-and-usage)** - **[输出示例](#-example-output)** - **[配置](#-configuration)** - **[文档](#-docs)** ## 📟 安装与使用 安装 HTMLHint 有两种方式:全局安装和本地安装。 ### 本地安装与使用 如果您希望将 HTMLHint 作为项目的一部分,可以使用 npm 在本地安装: ``` npm install htmlhint --save-dev ``` 之后,您可以像这样在任何文件或目录上运行 HTMLHint: ``` ./node_modules/.bin/htmlhint www/index.html ./node_modules/.bin/htmlhint www/**/*.html ``` 或者,您可以像这样通过编程方式使用 HTMLHint linter: ``` import { HTMLHint } from 'htmlhint' const htmlVerificationHints = HTMLHint.verify(localHtmlContent) console.log('htmlVerificationHints', htmlVerificationHints) // this logs a list of `Hint`s which contain information on all linting errors ``` ### 全局安装与使用 如果您希望 HTMLHint 能够在所有项目中使用,可以使用 npm 全局安装 HTMLHint: ``` npm install htmlhint -g ``` 之后,您可以像这样在任何文件上运行 HTMLHint: ``` htmlhint www/index.html htmlhint www/**/*.html ``` 您甚至可以启动 HTMLHint 来分析 URL: ``` htmlhint https://htmlhint.com/ ``` ## 📃 输出示例 ## 🔧 配置 在当前目录及其所有父目录中搜索 `.htmlhintrc` 文件: ``` htmlhint htmlhint test.html ``` 自定义配置文件: ``` htmlhint --config htmlhint.conf test.html ``` 自定义规则: ``` htmlhint --rules tag-pair,id-class-value=underline index.html ``` `test.html` 中的内联规则: ``` ... ``` ## 📙 文档 1. [如何使用](https://htmlhint.com/getting-started/) 2. [所有规则](https://htmlhint.com/rules/) 3. [更新日志](https://htmlhint.com/changelog/) 4. [如何开发](/.github/CONTRIBUTING.md) ## © 许可证 [MIT 许可证](./LICENSE.md) ## 🎖 赞助者 通过成为赞助商来支持此项目。您的标志将显示在此处,并附上指向您网站的链接。[成为赞助商](https://opencollective.com/htmlhint#sponsor)。标签:GNU通用公共许可证, HTML, HTMLHint, Lint工具, MITM代理, Node.js, NPM包, OSV-Scalibr, Syscall, Web开发, 代码审查, 代码规范, 前端构建, 威胁情报, 开发者工具, 数据可视化, 文档结构分析, 暗色界面, 自定义脚本, 语法检查, 错误基检测, 静态代码分析