{"id":13659698,"url":"https://github.com/bezoerb/gulp-htmlhint","last_synced_at":"2025-04-07T08:26:27.521Z","repository":{"id":13209039,"uuid":"15893038","full_name":"bezoerb/gulp-htmlhint","owner":"bezoerb","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-24T19:16:45.000Z","size":1638,"stargazers_count":81,"open_issues_count":15,"forks_count":21,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-04-13T20:32:43.078Z","etag":null,"topics":["gulp-plugin","htmlhint"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bezoerb.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-14T05:41:36.000Z","updated_at":"2024-06-18T13:58:00.051Z","dependencies_parsed_at":"2024-06-18T13:57:41.214Z","dependency_job_id":"bfa8161b-f607-4d6c-8012-ac080e3107da","html_url":"https://github.com/bezoerb/gulp-htmlhint","commit_stats":{"total_commits":143,"total_committers":21,"mean_commits":6.809523809523809,"dds":"0.49650349650349646","last_synced_commit":"3650fd9c3bf2d6fdb5dac9db2e7bf496f4207655"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezoerb%2Fgulp-htmlhint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezoerb%2Fgulp-htmlhint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezoerb%2Fgulp-htmlhint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezoerb%2Fgulp-htmlhint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezoerb","download_url":"https://codeload.github.com/bezoerb/gulp-htmlhint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247617326,"owners_count":20967581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gulp-plugin","htmlhint"],"created_at":"2024-08-02T05:01:11.396Z","updated_at":"2025-04-07T08:26:27.496Z","avatar_url":"https://github.com/bezoerb.png","language":"JavaScript","funding_links":[],"categories":["Plugins","JavaScript","插件"],"sub_categories":["Linting","代码校验"],"readme":"# gulp-htmlhint [![NPM version][npm-image]][npm-url] [![Build Status][ci-image]][ci-url] \n\n\u003e [htmlhint](https://github.com/yaniswang/HTMLHint) wrapper for [gulp](https://github.com/wearefractal/gulp) to validate your HTML\n\n\n## Usage\n\nFirst, install `gulp-htmlhint` as a development dependency:\n\n```shell\nnpm install --save-dev gulp-htmlhint\n```\n\nThen, add it to your `gulpfile.js`:\n\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint())\n```\n\n\n\n## API\n\n### htmlhint([options [, customRules]])\n\n#### options\nSee all rules here: [https://github.com/HTMLHint/HTMLHint/wiki/Rules](https://github.com/yaniswang/HTMLHint/wiki/Rules)\n\nIf `options` is empty, the task will use standard options.\n\n##### options.htmlhintrc\nType: `String`\u003cbr\u003e\nDefault value: `null`\n\nIf this filename is specified, options and globals defined there will be used. Task and target options override the options within the `htmlhintrc` file. The `htmlhintrc` file must be valid JSON and looks something like this:\n\n```json\n{\n  \"tag-pair\": true\n}\n```\n\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint('.htmlhintrc'))\n```\n\n#### customRules\n\nType: `Array` _Optional_\u003cbr\u003e\nDefault value: `null`\n\nArray that contains all user-defined custom rules. Rules added to this param need not exist in the `htmlhintrc` file.\nAll rules inside this array should be valid objects and look like this:\n\n```javascript\n{\n\t\tid: 'my-custom-rule',\n\t\tdescription: 'Custom rule definition',\n\t\tinit: function(parser, reporter){\n\t\t\t\t//Code goes here\n\t\t}\n}\n```\n\nHere is an example:\n\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\nvar customRules = [];\ncustomRules.push({\n\t\tid: 'my-custom-rule',\n\t\tdescription: 'Custom rule definition',\n\t\tinit: function(parser, reporter){\n\t\t\t\t//Code goes here\n\t\t}\n});\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint('.htmlhintrc', customRules))\n```\n\nNote: You can call `htmlhint` function four different ways:\n\n- Without params (task will use standard options).\n- With `options` param alone.\n- With `customRules` param alone (task will only use custom rules options).\n- With both `options` and `customRules` params defined.\n\n## Reporters\n\n### Default reporter\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint())\n\t.pipe(htmlhint.reporter())\n```\n\n\n### Fail reporters\n\n#### failOnError\n\nUse this reporter if you want your task to fail on the first file that triggers an HTMLHint Error.\nIt also prints a summary of all errors in the first bad file.\n\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint())\n\t.pipe(htmlhint.failOnError())\n```\n\n#### failAfterError\n\nUse this reporter if you want to collect statistics from all files before failing.\nIt also prints a summary of all errors in the first bad file.\n\n```javascript\nvar htmlhint = require(\"gulp-htmlhint\");\n\ngulp.src(\"./src/*.html\")\n\t.pipe(htmlhint())\n\t.pipe(htmlhint.failAfterError())\n```\n\n#### Reporter options\n\nOptionally, you can pass a config object to either fail reporter.\n\n##### suppress\nType: `Boolean`\u003cbr\u003e\nDefault value: `false`\n\n  When set to `true`, errors are not displayed on failure.\n  Use in conjunction with the default and/or custom reporter(s).\n  Prevents duplication of error messages when used along with another reporter.\n\n  ```javascript\n  var htmlhint = require(\"gulp-htmlhint\");\n\n  gulp.src(\"./src/*.html\")\n\t  .pipe(htmlhint())\n\t  .pipe(htmlhint.reporter(\"htmlhint-stylish\"))\n\t  .pipe(htmlhint.failOnError({ suppress: true }))\n  ```\n\n### Third-party reporters\n\n[gulp-reporter](https://github.com/gucong3000/gulp-reporter) used in team project, it fails only when error belongs to the current author of git.\n\n## License\n\n[MIT License](bezoerb.mit-license.org)\n\n[npm-url]: https://npmjs.org/package/gulp-htmlhint\n[npm-image]: https://badge.fury.io/js/gulp-htmlhint.svg\n\n[ci-url]: https://github.com/bezoerb/gulp-htmlhint/actions/workflows/test.yml\n[ci-image]: https://github.com/bezoerb/gulp-htmlhint/actions/workflows/test.yml/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezoerb%2Fgulp-htmlhint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezoerb%2Fgulp-htmlhint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezoerb%2Fgulp-htmlhint/lists"}