diff --git a/Gruntfile.js b/Gruntfile.js index 906ed2a13..763dfbd79 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,7 +48,6 @@ module.exports = function(grunt) { uglify: { htmlhint: { options: { - banner: "/*!\r\n * HTMLHint v<%= pkg.version %>\r\n * https://github.com/yaniswang/HTMLHint\r\n *\r\n * (c) 2014-"+new Date().getFullYear()+" Yanis Wang .\r\n * MIT Licensed\r\n */\n", beautify: { ascii_only: true } diff --git a/bin/formatters/checkstyle.js b/bin/formatters/checkstyle.js index ae770bd21..1319430a5 100644 --- a/bin/formatters/checkstyle.js +++ b/bin/formatters/checkstyle.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var xml = require('xml'); var checkstyleFormatter = function(formatter){ diff --git a/bin/formatters/compact.js b/bin/formatters/compact.js index 75797d4e8..fc4ae8ae8 100644 --- a/bin/formatters/compact.js +++ b/bin/formatters/compact.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var compactFormatter = function(formatter, HTMLHint, options){ var nocolor = options.nocolor; formatter.on('file', function(event){ diff --git a/bin/formatters/default.js b/bin/formatters/default.js index 03a48d4a9..121348071 100644 --- a/bin/formatters/default.js +++ b/bin/formatters/default.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var defaultFormatter = function(formatter, HTMLHint, options){ var nocolor = options.nocolor; formatter.on('start', function(){ diff --git a/bin/formatters/json.js b/bin/formatters/json.js index 47186e96c..96c968988 100644 --- a/bin/formatters/json.js +++ b/bin/formatters/json.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var jsonFormatter = function(formatter){ formatter.on('end', function(event){ console.log(JSON.stringify(event.arrAllMessages)); diff --git a/bin/formatters/junit.js b/bin/formatters/junit.js index af4eeb597..7ed0da426 100644 --- a/bin/formatters/junit.js +++ b/bin/formatters/junit.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var xml = require('xml'); var junitFormatter = function(formatter, HTMLHint){ diff --git a/bin/formatters/markdown.js b/bin/formatters/markdown.js index 1f20a6fd7..1b2bcb82b 100644 --- a/bin/formatters/markdown.js +++ b/bin/formatters/markdown.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var markdownFormatter = function(formatter, HTMLHint){ formatter.on('end', function(event){ console.log('# TOC'); diff --git a/bin/formatters/unix.js b/bin/formatters/unix.js index 06358466a..3cf4efade 100644 --- a/bin/formatters/unix.js +++ b/bin/formatters/unix.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var unixFormatter = function(formatter, HTMLHint, options){ var nocolor = options.nocolor; formatter.on('file', function(event){ diff --git a/src/core.js b/src/core.js index 3a3da57fe..c0f9e2e29 100644 --- a/src/core.js +++ b/src/core.js @@ -1,8 +1,4 @@ /* jshint -W079 */ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var HTMLHint = (function (undefined) { var HTMLHint = {}; diff --git a/src/htmlparser.js b/src/htmlparser.js index 9b6da399f..7cc1ef9f7 100644 --- a/src/htmlparser.js +++ b/src/htmlparser.js @@ -1,8 +1,4 @@ /* jshint -W079 */ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ var HTMLParser = (function(undefined){ var HTMLParser = function(){ diff --git a/src/reporter.js b/src/reporter.js index 444b6da0f..e7d379ddf 100644 --- a/src/reporter.js +++ b/src/reporter.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ (function(HTMLHint, undefined){ var Reporter = function(){ diff --git a/src/rules/alt-require.js b/src/rules/alt-require.js index 9804791c9..c2df01954 100644 --- a/src/rules/alt-require.js +++ b/src/rules/alt-require.js @@ -1,8 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * Copyright (c) 2014, Takeshi Kurosawa - * MIT Licensed - */ HTMLHint.addRule({ id: 'alt-require', description: 'The alt attribute of an element must be present and alt attribute of area[href] and input[type=image] must have a value.', diff --git a/src/rules/attr-lowercase.js b/src/rules/attr-lowercase.js index 058d24d95..55648bf6e 100644 --- a/src/rules/attr-lowercase.js +++ b/src/rules/attr-lowercase.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'attr-lowercase', description: 'All attribute names must be in lowercase.', diff --git a/src/rules/attr-no-duplication.js b/src/rules/attr-no-duplication.js index 60e1b7cf3..ae2e8fcdb 100644 --- a/src/rules/attr-no-duplication.js +++ b/src/rules/attr-no-duplication.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2014, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'attr-no-duplication', description: 'Elements cannot have duplicate attributes.', @@ -24,4 +20,4 @@ HTMLHint.addRule({ } }); } -}); \ No newline at end of file +}); diff --git a/src/rules/attr-unsafe-chars.js b/src/rules/attr-unsafe-chars.js index de6b7fdcd..b91d988f2 100644 --- a/src/rules/attr-unsafe-chars.js +++ b/src/rules/attr-unsafe-chars.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2014, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'attr-unsafe-chars', description: 'Attribute values cannot contain unsafe chars.', diff --git a/src/rules/attr-value-double-quotes.js b/src/rules/attr-value-double-quotes.js index 971fd9524..c54833570 100644 --- a/src/rules/attr-value-double-quotes.js +++ b/src/rules/attr-value-double-quotes.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'attr-value-double-quotes', description: 'Attribute values must be in double quotes.', @@ -20,4 +16,4 @@ HTMLHint.addRule({ } }); } -}); \ No newline at end of file +}); diff --git a/src/rules/attr-value-not-empty.js b/src/rules/attr-value-not-empty.js index 5fecf48ac..7ad85e794 100644 --- a/src/rules/attr-value-not-empty.js +++ b/src/rules/attr-value-not-empty.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'attr-value-not-empty', description: 'All attributes must have values.', @@ -19,4 +15,4 @@ HTMLHint.addRule({ } }); } -}); \ No newline at end of file +}); diff --git a/src/rules/csslint.js b/src/rules/csslint.js index a5fd62394..ba546e163 100644 --- a/src/rules/csslint.js +++ b/src/rules/csslint.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'csslint', description: 'Scan css with csslint.', @@ -35,4 +31,4 @@ HTMLHint.addRule({ } }); } -}); \ No newline at end of file +}); diff --git a/src/rules/doctype-first.js b/src/rules/doctype-first.js index 566b970c1..f5eb55c87 100644 --- a/src/rules/doctype-first.js +++ b/src/rules/doctype-first.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'doctype-first', description: 'Doctype must be declared first.', @@ -18,4 +14,4 @@ HTMLHint.addRule({ }; parser.addListener('all', allEvent); } -}); \ No newline at end of file +}); diff --git a/src/rules/doctype-html5.js b/src/rules/doctype-html5.js index 6586c7d6e..d134de8ff 100644 --- a/src/rules/doctype-html5.js +++ b/src/rules/doctype-html5.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'doctype-html5', description: 'Invalid doctype. Use: ""', @@ -19,4 +15,4 @@ HTMLHint.addRule({ parser.addListener('all', onComment); parser.addListener('tagstart', onTagStart); } -}); \ No newline at end of file +}); diff --git a/src/rules/head-script-disabled.js b/src/rules/head-script-disabled.js index 9f9ffd0f9..f8afed300 100644 --- a/src/rules/head-script-disabled.js +++ b/src/rules/head-script-disabled.js @@ -1,7 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ HTMLHint.addRule({ id: 'head-script-disabled', description: 'The b'; - var messages = HTMLHint.verify(code, ruleOptions); - expect(messages.length).to.be(4); - expect(messages[0].rule.id).to.be(ruldId); - expect(messages[0].line).to.be(3); - expect(messages[0].col).to.be(3); - expect(messages[0].type).to.be('warning'); - expect(messages[1].rule.id).to.be(ruldId); - expect(messages[1].line).to.be(4); - expect(messages[1].col).to.be(4); - expect(messages[1].type).to.be('warning'); - expect(messages[2].rule.id).to.be(ruldId); - expect(messages[2].line).to.be(4); - expect(messages[2].col).to.be(1); - expect(messages[2].type).to.be('warning'); - expect(messages[3].rule.id).to.be(ruldId); - expect(messages[3].line).to.be(2); - expect(messages[3].col).to.be(5); - expect(messages[3].type).to.be('warning'); - }); - - it('type of script be not text/javascript should not result in an error', function(){ - var code = 'ab'; - var messages = HTMLHint.verify(code, ruleOptions); - expect(messages.length).to.be(0); - }); - - it('type of script be text/javascript should result in an error', function(){ - var code = 'ab'; - var messages = HTMLHint.verify(code, ruleOptions); - expect(messages.length).not.to.be(0); - }); - - it('type of script be text/javascript but have src should not result in an error', function(){ - var code = 'ab'; - var messages = HTMLHint.verify(code, ruleOptions); - expect(messages.length).to.be(0); - }); - -}); \ No newline at end of file +var expect = require("expect.js"); + +var HTMLHint = require("../../index").HTMLHint; + +var ruldId = 'jshint', + ruleOptions = {}; + +ruleOptions[ruldId] = { + "undef": true, + "unused": true + }; + +describe('Rules: '+ruldId, function(){ + + it('should result in an error', function(){ + var code = 'ab'; + var messages = HTMLHint.verify(code, ruleOptions); + expect(messages.length).to.be(4); + expect(messages[0].rule.id).to.be(ruldId); + expect(messages[0].line).to.be(3); + expect(messages[0].col).to.be(3); + expect(messages[0].type).to.be('warning'); + expect(messages[1].rule.id).to.be(ruldId); + expect(messages[1].line).to.be(4); + expect(messages[1].col).to.be(4); + expect(messages[1].type).to.be('warning'); + expect(messages[2].rule.id).to.be(ruldId); + expect(messages[2].line).to.be(4); + expect(messages[2].col).to.be(1); + expect(messages[2].type).to.be('warning'); + expect(messages[3].rule.id).to.be(ruldId); + expect(messages[3].line).to.be(2); + expect(messages[3].col).to.be(5); + expect(messages[3].type).to.be('warning'); + }); + + it('type of script be not text/javascript should not result in an error', function(){ + var code = 'ab'; + var messages = HTMLHint.verify(code, ruleOptions); + expect(messages.length).to.be(0); + }); + + it('type of script be text/javascript should result in an error', function(){ + var code = 'ab'; + var messages = HTMLHint.verify(code, ruleOptions); + expect(messages.length).not.to.be(0); + }); + + it('type of script be text/javascript but have src should not result in an error', function(){ + var code = 'ab'; + var messages = HTMLHint.verify(code, ruleOptions); + expect(messages.length).to.be(0); + }); + +}); diff --git a/test/rules/space-tab-mixed-disabled.spec.js b/test/rules/space-tab-mixed-disabled.spec.js index 21528aa37..e85205d2a 100644 --- a/test/rules/space-tab-mixed-disabled.spec.js +++ b/test/rules/space-tab-mixed-disabled.spec.js @@ -1,8 +1,3 @@ -/** - * Copyright (c) 2014-2015, Yanis Wang - * MIT Licensed - */ - var expect = require("expect.js"); var HTMLHint = require("../../index").HTMLHint; diff --git a/test/rules/spec-char-escape.spec.js b/test/rules/spec-char-escape.spec.js index 89e4b24d2..67384a3ae 100644 --- a/test/rules/spec-char-escape.spec.js +++ b/test/rules/spec-char-escape.spec.js @@ -1,8 +1,3 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ - var expect = require("expect.js"); var HTMLHint = require("../../index").HTMLHint; @@ -35,4 +30,4 @@ describe('Rules: '+ruldId, function(){ expect(messages.length).to.be(0); }); -}); \ No newline at end of file +}); diff --git a/test/rules/src-not-empty.spec.js b/test/rules/src-not-empty.spec.js index 5df5f34d1..701129cf5 100644 --- a/test/rules/src-not-empty.spec.js +++ b/test/rules/src-not-empty.spec.js @@ -1,35 +1,30 @@ -/** - * Copyright (c) 2015, Yanis Wang - * MIT Licensed - */ - -var expect = require("expect.js"); - -var HTMLHint = require("../../index").HTMLHint; - -var ruldId = 'src-not-empty', - ruleOptions = {}; - -ruleOptions[ruldId] = true; - -describe('Rules: '+ruldId, function(){ - - it('Src be emtpy should result in an error', function(){ - var code = '