From 781135fd1e1dfdb5a319a1887375e81cf1266ca3 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Mon, 23 Jan 2017 20:38:34 +1100 Subject: [PATCH] Move htmllint to npm script. --- Gruntfile.js | 25 ++++--------------------- docs/.htmllintrc | 18 ++++++++++++++++++ package.json | 3 ++- 3 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 docs/.htmllintrc diff --git a/Gruntfile.js b/Gruntfile.js index 7d16ff4320f7..6b5bca0efbf9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -162,26 +162,6 @@ module.exports = function (grunt) { } }, - htmllint: { - options: { - ignore: [ - 'Attribute “autocomplete” is only allowed when the input type is “color”, “date”, “datetime”, “datetime-local”, “email”, “hidden”, “month”, “number”, “password”, “range”, “search”, “tel”, “text”, “time”, “url”, or “week”.', - 'Attribute “autocomplete” not allowed on element “button” at this point.', - 'Consider using the “h1” element as a top-level heading only (all “h1” elements are treated as top-level headings by many screen readers and other tools).', - 'Element “div” not allowed as child of element “progress” in this context. (Suppressing further errors from this subtree.)', - 'Element “img” is missing required attribute “src”.', - 'The “color” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “date” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “datetime” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “datetime-local” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “month” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “time” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.', - 'The “week” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' - ] - }, - src: ['_gh_pages/**/*.html', 'js/tests/visual/*.html'] - }, - watch: { src: { files: '<%= concat.bootstrap.src %>', @@ -226,6 +206,9 @@ module.exports = function (grunt) { htmlhint: { command: 'npm run htmlhint' }, + htmllint: { + command: 'npm run htmllint' + }, sass: { command: 'npm run sass' }, @@ -288,7 +271,7 @@ module.exports = function (grunt) { require('time-grunt')(grunt) // Docs HTML validation task - grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint', 'exec:htmlhint']) + grunt.registerTask('validate-html', ['jekyll:docs', 'exec:htmllint', 'exec:htmlhint']) var runSubset = function (subset) { return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset diff --git a/docs/.htmllintrc b/docs/.htmllintrc new file mode 100644 index 000000000000..2a6bb58d6bf7 --- /dev/null +++ b/docs/.htmllintrc @@ -0,0 +1,18 @@ +{ + "attr-bans": ["align", "background", "bgcolor", "border", "frameborder", "longdesc", "marginwidth", "marginheight", "scrolling"], + "attr-name-style": "dash", + "attr-no-unsafe-char": false, + "class-style": "dash", + "doctype-first": true, + "doctype-html5": true, + "fig-req-figcaption": true, + "html-valid-content-model": false, + "id-class-ignore-regex": "(onclick|content|[a-z]+([A-Z][a-z])+)", + "id-class-style": "dash", + "img-req-alt": false, + "indent-style": "spaces", + "indent-width": 2, + "spec-char-escape": false, + "tag-bans": ["b", "i"], + "title-max-len": false +} diff --git a/package.json b/package.json index 69c7f622355d..7b513f1ab96a 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "clean-css-docs": "cleancss --skip-advanced --source-map --output docs/assets/css/docs.min.css docs/assets/css/docs.min.css", "eslint": "eslint --ignore-path .eslintignore js && eslint --config js/tests/.eslintrc.json --env node grunt Gruntfile.js && eslint --config js/tests/.eslintrc.json docs/assets/js/src docs/assets/js/ie-emulation-modes-warning.js docs/assets/js/ie10-viewport-bug-workaround.js", "htmlhint": "htmlhint --config docs/.htmlhintrc _gh_pages/", + "htmllint": "htmllint --rc docs/.htmllintrc _gh_pages/**/*.html js/tests/visual/*.html", "postcss": "postcss --config grunt/postcss.js --replace dist/css/*.css", "postcss-docs": "postcss --config grunt/postcss.js --no-map --replace docs/assets/css/docs.min.css && postcss --config grunt/postcss.js --no-map --replace docs/examples/**/*.css", "sass": "node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap.scss dist/css/bootstrap.css && node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap-grid.scss dist/css/bootstrap-grid.css && node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap-reboot.scss dist/css/bootstrap-reboot.css", @@ -66,11 +67,11 @@ "grunt-contrib-qunit": "^1.2.0", "grunt-contrib-watch": "^1.0.0", "grunt-exec": "^1.0.1", - "grunt-html": "^8.1.0", "grunt-jekyll": "^0.4.4", "grunt-saucelabs": "^9.0.0", "grunt-stamp": "^0.3.0", "htmlhint": "^0.9.13", + "htmllint-cli": "0.0.6", "is-travis": "^1.0.0", "load-grunt-tasks": "^3.5.2", "node-sass": "^4.1.1",