diff --git a/.gitignore b/.gitignore index 052d256c2..0dca15623 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ lib # Test releated files test/unit/coverage test/e2e/reports +report.html # Website/Docs releated files /website/node_modules diff --git a/src/cli/formatter.ts b/src/cli/formatter.ts index bca2d711a..7144eb1ac 100644 --- a/src/cli/formatter.ts +++ b/src/cli/formatter.ts @@ -3,7 +3,7 @@ import { EventEmitter } from 'events' import { sync as globSync } from 'glob' import { parse, resolve } from 'path' import type { HTMLHint as IHTMLHint } from '../core/core' -import type { Hint, Ruleset } from '../core/types' +import type { Configuration, Hint } from '../core/types' let HTMLHint: typeof IHTMLHint let options: { nocolor?: boolean } @@ -45,7 +45,7 @@ export interface FormatterFileEvent { } export interface FormatterConfigEvent { - ruleset: Ruleset + config?: Configuration configPath?: string } diff --git a/src/cli/htmlhint.ts b/src/cli/htmlhint.ts index 1236feb64..44e384256 100644 --- a/src/cli/htmlhint.ts +++ b/src/cli/htmlhint.ts @@ -11,7 +11,7 @@ import { dirname, resolve, sep } from 'path' import * as request from 'request' import * as stripJsonComments from 'strip-json-comments' import type { HTMLHint as IHTMLHint } from '../core/core' -import type { Hint, Ruleset } from '../core/types' +import type { Configuration, Hint } from '../core/types' import { Formatter } from './formatter' const HTMLHint: typeof IHTMLHint = require('../htmlhint.js').HTMLHint @@ -96,9 +96,11 @@ if (format) { formatter.setFormat(format) } +// TODO: parse and validate `program.rules` + hintTargets(arrTargets, { rulesdir: program.rulesdir, - ruleset: program.rules, + config: program.rules ? { rules: program.rules } : undefined, formatter: formatter, ignore: program.ignore, }) @@ -121,7 +123,7 @@ function hintTargets( arrTargets: string[], options: { formatter: Formatter - ruleset?: Ruleset + config?: Configuration rulesdir?: string ignore?: string } @@ -213,7 +215,7 @@ function hintAllFiles( options: { ignore?: string formatter: Formatter - ruleset?: Ruleset + config?: Configuration }, onFinised: (result: { targetFileCount: number @@ -241,10 +243,10 @@ function hintAllFiles( time: number }> = [] - // init ruleset - let ruleset = options.ruleset - if (ruleset === undefined) { - ruleset = getConfig(program.config, globInfo.base, formatter) + // init config + let config = options.config + if (config === undefined) { + config = getConfig(program.config, globInfo.base, formatter) } // hint queue @@ -252,11 +254,11 @@ function hintAllFiles( const startTime = new Date().getTime() if (filepath === 'stdin') { - hintStdin(ruleset, hintNext) + hintStdin(config, hintNext) } else if (/^https?:\/\//.test(filepath)) { - hintUrl(filepath, ruleset, hintNext) + hintUrl(filepath, config, hintNext) } else { - const messages = hintFile(filepath, ruleset) + const messages = hintFile(filepath, config) hintNext(messages) } @@ -370,7 +372,7 @@ function getConfig( configPath: string | undefined, base: string, formatter: Formatter -) { +): Configuration | undefined { if (configPath === undefined && existsSync(base)) { // find default config file in parent directory if (statSync(base).isDirectory() === false) { @@ -378,6 +380,7 @@ function getConfig( } while (base) { + // TODO: load via cosmiconfig (https://github.com/htmlhint/HTMLHint/issues/126) const tmpConfigFile = resolve(base, '.htmlhintrc') if (existsSync(tmpConfigFile)) { @@ -395,20 +398,22 @@ function getConfig( // TODO: can configPath be undefined here? if (configPath !== undefined && existsSync(configPath)) { - const config = readFileSync(configPath, 'utf-8') - let ruleset: Ruleset = {} + const configContent = readFileSync(configPath, 'utf-8') + let config: Configuration | undefined try { - ruleset = JSON.parse(stripJsonComments(config)) + config = JSON.parse(stripJsonComments(configContent)) formatter.emit('config', { - ruleset: ruleset, - configPath: configPath, + configPath, + config, }) } catch (e) { // ignore } - return ruleset + // TODO: validate config + + return config } } @@ -456,7 +461,7 @@ function walkPath( } // hint file -function hintFile(filepath: string, ruleset?: Ruleset) { +function hintFile(filepath: string, config?: Configuration) { let content = '' try { @@ -465,12 +470,12 @@ function hintFile(filepath: string, ruleset?: Ruleset) { // ignore } - return HTMLHint.verify(content, { rules: ruleset }) + return HTMLHint.verify(content, config) } // hint stdin function hintStdin( - ruleset: Ruleset | undefined, + config: Configuration | undefined, callback: (messages: Hint[]) => void ) { process.stdin.setEncoding('utf8') @@ -483,7 +488,7 @@ function hintStdin( process.stdin.on('end', () => { const content = buffers.join('') - const messages = HTMLHint.verify(content, { rules: ruleset }) + const messages = HTMLHint.verify(content, config) callback(messages) }) } @@ -491,12 +496,12 @@ function hintStdin( // hint url function hintUrl( url: string, - ruleset: Ruleset | undefined, + config: Configuration | undefined, callback: (messages: Hint[]) => void ) { request.get(url, (error, response, body) => { if (!error && response.statusCode == 200) { - const messages = HTMLHint.verify(body, { rules: ruleset }) + const messages = HTMLHint.verify(body, config) callback(messages) } else { callback([]) diff --git a/src/core/configuration.ts b/src/core/configuration.ts new file mode 100644 index 000000000..e56853cbe --- /dev/null +++ b/src/core/configuration.ts @@ -0,0 +1,39 @@ +import { Configuration } from './types' + +export function isConfiguration(value: unknown): value is Configuration { + // Config must be an object + if (typeof value !== 'object') { + return false + } + + // Config must not be null + if (value === null) { + return false + } + + // This helps to get better support for TypeScript + const config = value as Record + + // If extends is defined, it must be an array + if (config.extends !== undefined) { + if (!Array.isArray(config.extends)) { + return false + } + + // Any value within extens must be a string + for (const extension of config.extends) { + if (typeof extension !== 'string') { + return false + } + } + } + + // If extends is defined, it must be an object + if (config.rules !== undefined) { + if (typeof config.rules !== 'object' && config.rules !== null) { + return false + } + } + + return true +} diff --git a/src/core/core.ts b/src/core/core.ts index bf6c55482..9b09aa231 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -1,3 +1,4 @@ +import { isConfiguration } from './configuration' import HTMLParser from './htmlparser' import Reporter, { ReportMessageCallback } from './reporter' import * as HTMLRules from './rules' @@ -15,20 +16,43 @@ export interface FormatOptions { indent?: number } -class HTMLHintCore { - public rules: { [id: string]: Rule } = {} - public readonly defaultRuleset: Ruleset = { - 'tagname-lowercase': 'error', +const HTMLHINT_RECOMMENDED = 'htmlhint:recommended' +const HTMLHINT_LEGACY = 'htmlhint:legacy' + +const DEFAULT_RULESETS: Record = { + [HTMLHINT_RECOMMENDED]: { + 'alt-require': 'warn', + 'attr-lowercase': 'warn', + 'attr-no-duplication': 'error', + 'attr-no-unnecessary-whitespace': 'warn', + 'attr-unsafe-chars': 'warn', + 'attr-value-double-quotes': 'warn', + 'id-class-ad-disabled': 'warn', + 'id-unique': 'error', + 'space-tab-mixed-disabled': 'warn', + 'spec-char-escape': 'warn', + 'src-not-empty': 'error', + 'tag-pair': 'warn', + 'tagname-lowercase': 'warn', + 'tagname-specialchars': 'error', + 'title-require': 'warn', + }, + [HTMLHINT_LEGACY]: { 'attr-lowercase': 'error', + 'attr-no-duplication': 'error', 'attr-value-double-quotes': 'error', 'doctype-first': 'error', - 'tag-pair': 'error', - 'spec-char-escape': 'error', 'id-unique': 'error', + 'spec-char-escape': 'error', 'src-not-empty': 'error', - 'attr-no-duplication': 'error', + 'tag-pair': 'error', + 'tagname-lowercase': 'error', 'title-require': 'error', - } + }, +} + +class HTMLHintCore { + public rules: { [id: string]: Rule } = {} public addRule(rule: Rule) { this.rules[rule.id] = rule @@ -36,11 +60,34 @@ class HTMLHintCore { public verify( html: string, - config: Configuration = { rules: this.defaultRuleset } + config: Configuration = { extends: [HTMLHINT_RECOMMENDED] } ) { - let ruleset = config.rules ?? this.defaultRuleset + if (!isConfiguration(config)) { + throw new Error('The HTMLHint configuration is invalid') + } + + let ruleset: Ruleset = {} + + // If an empty configuration is passed, use the recommended ruleset + if (config.extends === undefined && config.rules === undefined) { + config.extends = [HTMLHINT_RECOMMENDED] + } + + // Iterate through extensions and merge rulesets into ruleset + for (const extend of config.extends ?? []) { + if (typeof extend === 'string') { + const extendRuleset = DEFAULT_RULESETS[extend] ?? {} + ruleset = { ...ruleset, ...extendRuleset } + } + } + + // Apply self-configured rules + ruleset = { ...ruleset, ...(config.rules ?? {}) } + + // If no rules have been configured, return immediately if (Object.keys(ruleset).length === 0) { - ruleset = this.defaultRuleset + // console.log('Please configure some HTMLHint rules') + return [] } // parse inline ruleset diff --git a/src/core/types.ts b/src/core/types.ts index 959ca4824..c8310ec8d 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -2,6 +2,7 @@ import { HTMLParser } from './core' import { ReportMessageCallback } from './reporter' export interface Configuration { + extends?: string[] rules?: Ruleset } diff --git a/test/cli/formatters/checkstyle.spec.js b/test/cli/formatters/checkstyle.spec.js index 7ab2af9b7..35dd11aba 100644 --- a/test/cli/formatters/checkstyle.spec.js +++ b/test/cli/formatters/checkstyle.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: checkstyle', () => { - it('should have stdout output with formatter checkstyle', (done) => { + it('Should have stdout output with formatter checkstyle', (done) => { const expected = fs .readFileSync(path.resolve(__dirname, 'checkstyle.xml'), 'utf8') .replace('{{path}}', path.resolve(__dirname, 'example.html')) diff --git a/test/cli/formatters/checkstyle.xml b/test/cli/formatters/checkstyle.xml index aa96f0fc7..5d8fdcbfd 100644 --- a/test/cli/formatters/checkstyle.xml +++ b/test/cli/formatters/checkstyle.xml @@ -1,25 +1,25 @@ - - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/test/cli/formatters/compact.spec.js b/test/cli/formatters/compact.spec.js index cd0f8d324..dcb1ebcc6 100644 --- a/test/cli/formatters/compact.spec.js +++ b/test/cli/formatters/compact.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: compact', () => { - it('should have stdout output with formatter compact', (done) => { + it('Should have stdout output with formatter compact', (done) => { const expected = fs .readFileSync(path.resolve(__dirname, 'compact.txt'), 'utf8') .replace( diff --git a/test/cli/formatters/compact.txt b/test/cli/formatters/compact.txt index 07dee1834..6d850ffc6 100644 --- a/test/cli/formatters/compact.txt +++ b/test/cli/formatters/compact.txt @@ -1,94 +1,94 @@ -{{path}}: line 8, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 8, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 8, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 9, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 9, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 8, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 8, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 9, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 10, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 10, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 9, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 9, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 10, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 11, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 11, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 10, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 10, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 11, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 12, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 12, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 11, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 11, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 12, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 13, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 13, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 12, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 12, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 13, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 14, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 14, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 13, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 13, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 14, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 15, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 15, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 14, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 14, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 15, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 16, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 16, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 15, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 15, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 16, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 17, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 17, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 16, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 16, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 17, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 18, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 18, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 17, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 17, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 18, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 19, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 19, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 18, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 18, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 19, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 20, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 20, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 19, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 19, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 20, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 21, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 21, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 20, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 20, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 21, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 22, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 22, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 21, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 21, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 22, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 23, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 23, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 22, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 22, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 23, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 24, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 24, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 23, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 23, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) {{path}}: line 24, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication) -{{path}}: line 25, col 22, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 26, col 3, error - Special characters must be escaped : [ < ]. (spec-char-escape) -{{path}}: line 26, col 18, error - Special characters must be escaped : [ > ]. (spec-char-escape) -{{path}}: line 28, col 11, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 29, col 9, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 30, col 7, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 31, col 5, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 32, col 3, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 38, col 19, error - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 38, col 28, error - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 38, col 36, error - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 44, col 3, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 50, col 19, error - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 50, col 28, error - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 50, col 36, error - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 56, col 3, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 62, col 19, error - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 62, col 28, error - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 62, col 36, error - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 68, col 3, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 74, col 19, error - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 74, col 28, error - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 74, col 36, error - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) -{{path}}: line 80, col 3, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 81, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 82, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 83, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 84, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 85, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 86, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 87, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 88, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 89, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 90, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 91, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 92, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 93, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 94, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 95, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 96, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) -{{path}}: line 97, col 1, error - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 24, col 7, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 24, col 14, warning - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 25, col 22, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 26, col 3, warning - Special characters must be escaped : [ < ]. (spec-char-escape) +{{path}}: line 26, col 18, warning - Special characters must be escaped : [ > ]. (spec-char-escape) +{{path}}: line 28, col 11, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 29, col 9, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 30, col 7, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 31, col 5, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 32, col 3, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 38, col 19, warning - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 38, col 28, warning - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 38, col 36, warning - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 44, col 3, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 50, col 19, warning - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 50, col 28, warning - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 50, col 36, warning - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 56, col 3, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 62, col 19, warning - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 62, col 28, warning - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 62, col 36, warning - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 68, col 3, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 74, col 19, warning - The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 74, col 28, warning - The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 74, col 36, warning - The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes) +{{path}}: line 80, col 3, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 81, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 82, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 83, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 84, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 85, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 86, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 87, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 88, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 89, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 90, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 91, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 92, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 93, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 94, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 95, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 96, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) +{{path}}: line 97, col 1, warning - Tag must be paired, no start tag: [ ] (tag-pair) \u001b[31m92 problems\u001b[39m diff --git a/test/cli/formatters/default.spec.js b/test/cli/formatters/default.spec.js index 0c84c1da4..caa41e39c 100644 --- a/test/cli/formatters/default.spec.js +++ b/test/cli/formatters/default.spec.js @@ -5,7 +5,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: default', () => { - it('should have stdout output with formatter default', (done) => { + it('Should have stdout output with formatter default', (done) => { ChildProcess.exec( [ 'node', diff --git a/test/cli/formatters/html.html b/test/cli/formatters/html.html index b335e82d2..ec71e2f65 100644 --- a/test/cli/formatters/html.html +++ b/test/cli/formatters/html.html @@ -1 +1 @@ -HTML Hint Violation Report

Violation Report

Number#File NameLine NumberMessage
1{{path}}8The value of attribute [ bad ] must be in double quotes.
2{{path}}8The value of attribute [ bad ] must be in double quotes.
3{{path}}8Duplicate of attribute name [ bad ] was found.
4{{path}}9The value of attribute [ bad ] must be in double quotes.
5{{path}}9The value of attribute [ bad ] must be in double quotes.
6{{path}}9Duplicate of attribute name [ bad ] was found.
7{{path}}10Tag must be paired, no start tag: [ ]
8{{path}}11Special characters must be escaped : [ < ].
9{{path}}11Special characters must be escaped : [ > ].
10{{path}}13Tag must be paired, no start tag: [ ]
11{{path}}14Tag must be paired, no start tag: [ ]
12{{path}}15Tag must be paired, no start tag: [ ]
13{{path}}16Tag must be paired, no start tag: [ ]
14{{path}}17Tag must be paired, no start tag: [ ]
15{{path}}21The value of attribute [ class ] must be in double quotes.
16{{path}}21The value of attribute [ what ] must be in double quotes.
17{{path}}21The value of attribute [ something ] must be in double quotes.
18{{path}}25Tag must be paired, no start tag: [ ]
19{{path}}26Tag must be paired, no start tag: [ ]
20{{path}}27Tag must be paired, no start tag: [ ]
+HTML Hint Violation Report

Violation Report

Number#File NameLine NumberMessage
1{{path}}8Duplicate of attribute name [ bad ] was found.
2{{path}}8The value of attribute [ bad ] must be in double quotes.
3{{path}}8The value of attribute [ bad ] must be in double quotes.
4{{path}}9Duplicate of attribute name [ bad ] was found.
5{{path}}9The value of attribute [ bad ] must be in double quotes.
6{{path}}9The value of attribute [ bad ] must be in double quotes.
7{{path}}10Tag must be paired, no start tag: [ ]
8{{path}}11Special characters must be escaped : [ < ].
9{{path}}11Special characters must be escaped : [ > ].
10{{path}}13Tag must be paired, no start tag: [ ]
11{{path}}14Tag must be paired, no start tag: [ ]
12{{path}}15Tag must be paired, no start tag: [ ]
13{{path}}16Tag must be paired, no start tag: [ ]
14{{path}}17Tag must be paired, no start tag: [ ]
15{{path}}21The value of attribute [ class ] must be in double quotes.
16{{path}}21The value of attribute [ what ] must be in double quotes.
17{{path}}21The value of attribute [ something ] must be in double quotes.
18{{path}}25Tag must be paired, no start tag: [ ]
19{{path}}26Tag must be paired, no start tag: [ ]
20{{path}}27Tag must be paired, no start tag: [ ]
diff --git a/test/cli/formatters/html.spec.js b/test/cli/formatters/html.spec.js index 67e38d171..d780de863 100644 --- a/test/cli/formatters/html.spec.js +++ b/test/cli/formatters/html.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: html', () => { - it('should have stdout output with formatter html', (done) => { + it('Should have stdout output with formatter html', (done) => { const expected = fs .readFileSync(path.resolve(__dirname, 'html.html'), 'utf8') .replace(/\{\{path\}\}/g, path.resolve(__dirname, 'example.html')) diff --git a/test/cli/formatters/json.json b/test/cli/formatters/json.json index 8744fe391..f8446bd10 100644 --- a/test/cli/formatters/json.json +++ b/test/cli/formatters/json.json @@ -4,6 +4,19 @@ "messages": [ { "type": "error", + "message": "Duplicate of attribute name [ bad ] was found.", + "raw": " bad=''", + "evidence": "
", + "line": 8, + "col": 14, + "rule": { + "id": "attr-no-duplication", + "description": "Elements cannot have duplicate attributes.", + "link": "https://github.com/thedaviddias/HTMLHint/wiki/attr-no-duplication" + } + }, + { + "type": "warning", "message": "The value of attribute [ bad ] must be in double quotes.", "raw": " bad=''", "evidence": "
", @@ -16,7 +29,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ bad ] must be in double quotes.", "raw": " bad=''", "evidence": "
", @@ -33,7 +46,7 @@ "message": "Duplicate of attribute name [ bad ] was found.", "raw": " bad=''", "evidence": "
", - "line": 8, + "line": 9, "col": 14, "rule": { "id": "attr-no-duplication", @@ -42,7 +55,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ bad ] must be in double quotes.", "raw": " bad=''", "evidence": "
", @@ -55,7 +68,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ bad ] must be in double quotes.", "raw": " bad=''", "evidence": "
", @@ -68,20 +81,7 @@ } }, { - "type": "error", - "message": "Duplicate of attribute name [ bad ] was found.", - "raw": " bad=''", - "evidence": "
", - "line": 9, - "col": 14, - "rule": { - "id": "attr-no-duplication", - "description": "Elements cannot have duplicate attributes.", - "link": "https://github.com/thedaviddias/HTMLHint/wiki/attr-no-duplication" - } - }, - { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": " ", @@ -94,7 +94,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Special characters must be escaped : [ < ].", "raw": "\n
\n\n ", "evidence": "
", @@ -107,7 +107,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Special characters must be escaped : [ > ].", "raw": "\n
\n\n ", "evidence": "
", @@ -120,7 +120,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [
]", "raw": "
", "evidence": "
", @@ -133,7 +133,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [
]", "raw": "", "evidence": " ", @@ -146,7 +146,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": " ", @@ -159,7 +159,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": " ", @@ -172,7 +172,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": " ", @@ -185,7 +185,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ class ] must be in double quotes.", "raw": " class=''", "evidence": "
", @@ -198,7 +198,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ what ] must be in double quotes.", "raw": " what=''", "evidence": "
", @@ -211,7 +211,7 @@ } }, { - "type": "error", + "type": "warning", "message": "The value of attribute [ something ] must be in double quotes.", "raw": " something=''", "evidence": "
", @@ -224,7 +224,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": " ", @@ -237,7 +237,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": "", @@ -250,7 +250,7 @@ } }, { - "type": "error", + "type": "warning", "message": "Tag must be paired, no start tag: [ ]", "raw": "", "evidence": "", @@ -263,6 +263,6 @@ } } ], - "time": 2 + "time": 17 } ] diff --git a/test/cli/formatters/json.spec.js b/test/cli/formatters/json.spec.js index 7f73e35c2..85d21a3ec 100644 --- a/test/cli/formatters/json.spec.js +++ b/test/cli/formatters/json.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: json', () => { - it('should have stdout output with formatter json', (done) => { + it('Should have stdout output with formatter json', (done) => { const expectedFileContent = fs .readFileSync(path.resolve(__dirname, 'json.json'), 'utf8') .replace( diff --git a/test/cli/formatters/junit.spec.js b/test/cli/formatters/junit.spec.js index 1954fe49d..2d60a6710 100644 --- a/test/cli/formatters/junit.spec.js +++ b/test/cli/formatters/junit.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: junit', () => { - it('should have stdout output with formatter junit', (done) => { + it('Should have stdout output with formatter junit', (done) => { ChildProcess.exec( [ 'node', diff --git a/test/cli/formatters/markdown.spec.js b/test/cli/formatters/markdown.spec.js index ed9d7fe02..61d759d34 100644 --- a/test/cli/formatters/markdown.spec.js +++ b/test/cli/formatters/markdown.spec.js @@ -5,7 +5,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: markdown', () => { - it('should have stdout output with formatter markdown', (done) => { + it('Should have stdout output with formatter markdown', (done) => { ChildProcess.exec( [ 'node', @@ -19,7 +19,7 @@ describe('CLI', () => { expect(error.code).to.be.equal(1) expect(stdout).to.contain('# TOC') - expect(stdout).to.contain('Found 20 errors, 0 warnings') + expect(stdout).to.contain('Found 2 errors, 18 warnings') expect(stdout).to.contain('example.html') expect(stdout).to.contain( '^ Tag must be paired, no start tag: [ ] (tag-pair)' diff --git a/test/cli/formatters/unix.spec.js b/test/cli/formatters/unix.spec.js index bee9348b6..aded1403a 100644 --- a/test/cli/formatters/unix.spec.js +++ b/test/cli/formatters/unix.spec.js @@ -6,7 +6,7 @@ const path = require('path') describe('CLI', () => { describe('Formatter: unix', () => { - it('should have stdout output with formatter unix', (done) => { + it('Should have stdout output with formatter unix', (done) => { const expected = fs .readFileSync(path.resolve(__dirname, 'unix.txt'), 'utf8') .replace( diff --git a/test/cli/formatters/unix.txt b/test/cli/formatters/unix.txt index decd9aef9..5e2ad2d4a 100644 --- a/test/cli/formatters/unix.txt +++ b/test/cli/formatters/unix.txt @@ -1,94 +1,94 @@ -{{path}}:8:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:8:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] {{path}}:8:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:9:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:9:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:8:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:8:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:9:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:10:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:10:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:9:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:9:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:10:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:11:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:11:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:10:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:10:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:11:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:12:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:12:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:11:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:11:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:12:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:13:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:13:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:12:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:12:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:13:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:14:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:14:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:13:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:13:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:14:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:15:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:15:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:14:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:14:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:15:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:16:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:16:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:15:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:15:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:16:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:17:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:17:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:16:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:16:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:17:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:18:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:18:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:17:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:17:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:18:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:19:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:19:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:18:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:18:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:19:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:20:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:20:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:19:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:19:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:20:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:21:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:21:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:20:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:20:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:21:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:22:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:22:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:21:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:21:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:22:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:23:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:23:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:22:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:22:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:23:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:24:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:24:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes] +{{path}}:23:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:23:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] {{path}}:24:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication] -{{path}}:25:22: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:26:3: Special characters must be escaped : [ < ]. [error/spec-char-escape] -{{path}}:26:18: Special characters must be escaped : [ > ]. [error/spec-char-escape] -{{path}}:28:11: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:29:9: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:30:7: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:31:5: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:32:3: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:38:19: The value of attribute [ class ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:38:28: The value of attribute [ what ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:38:36: The value of attribute [ something ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:44:3: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:50:19: The value of attribute [ class ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:50:28: The value of attribute [ what ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:50:36: The value of attribute [ something ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:56:3: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:62:19: The value of attribute [ class ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:62:28: The value of attribute [ what ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:62:36: The value of attribute [ something ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:68:3: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:74:19: The value of attribute [ class ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:74:28: The value of attribute [ what ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:74:36: The value of attribute [ something ] must be in double quotes. [error/attr-value-double-quotes] -{{path}}:80:3: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:81:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:82:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:83:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:84:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:85:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:86:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:87:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:88:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:89:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:90:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:91:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:92:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:93:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:94:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:95:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:96:1: Tag must be paired, no start tag: [ ] [error/tag-pair] -{{path}}:97:1: Tag must be paired, no start tag: [ ] [error/tag-pair] +{{path}}:24:7: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:24:14: The value of attribute [ bad ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:25:22: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:26:3: Special characters must be escaped : [ < ]. [warning/spec-char-escape] +{{path}}:26:18: Special characters must be escaped : [ > ]. [warning/spec-char-escape] +{{path}}:28:11: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:29:9: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:30:7: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:31:5: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:32:3: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:38:19: The value of attribute [ class ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:38:28: The value of attribute [ what ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:38:36: The value of attribute [ something ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:44:3: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:50:19: The value of attribute [ class ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:50:28: The value of attribute [ what ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:50:36: The value of attribute [ something ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:56:3: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:62:19: The value of attribute [ class ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:62:28: The value of attribute [ what ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:62:36: The value of attribute [ something ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:68:3: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:74:19: The value of attribute [ class ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:74:28: The value of attribute [ what ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:74:36: The value of attribute [ something ] must be in double quotes. [warning/attr-value-double-quotes] +{{path}}:80:3: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:81:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:82:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:83:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:84:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:85:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:86:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:87:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:88:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:89:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:90:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:91:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:92:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:93:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:94:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:95:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:96:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] +{{path}}:97:1: Tag must be paired, no start tag: [ ] [warning/tag-pair] \u001b[31m92 problems\u001b[39m diff --git a/test/core.spec.js b/test/core.spec.js index b7eddb548..c719911fa 100644 --- a/test/core.spec.js +++ b/test/core.spec.js @@ -1,95 +1,129 @@ const expect = require('expect.js') +/** @type import('../src/core/core').HTMLHint */ const HTMLHint = require('../dist/htmlhint.js').HTMLHint describe('Core', () => { - it('Set false to rule no effected should result in an error', () => { - const code = '' - const messages = HTMLHint.verify(code, { rules: { 'alt-require': 'off' } }) - expect(messages.length).to.be(0) - }) - - it('Not load default ruleset when use undefined ruleset should result in an error', () => { - const code = - '

>

' - const messages = HTMLHint.verify(code) - expect(messages.length).to.be(9) - }) + describe('Defaults', () => { + it('Should use the recommended ruleset, if configuration is not defined', () => { + const code = + '

>

' + const messages = HTMLHint.verify(code) + expect(messages.length).to.be(9) + }) - it('Not load default ruleset when use empty ruleset should result in an error', () => { - const code = - '

>

' - const messages = HTMLHint.verify(code, {}) - expect(messages.length).to.be(9) - }) + it('Should use the recommended ruleset, if empty configuration is passed', () => { + const code = + '

>

' + const messages = HTMLHint.verify(code, {}) + expect(messages.length).to.be(9) + }) - it('Inline ruleset not worked should result in an error', () => { - // With value = 'error' - let code = '\r\n' - let messages = HTMLHint.verify(code, { - rules: { - 'alt-require': 'off', - }, + it('Should use the legacy ruleset, if it is passed', () => { + const code = + '

>

' + const messages = HTMLHint.verify(code, { + extends: ['htmlhint:legacy'], + }) + expect(messages.length).to.be(9) }) - expect(messages.length).to.be(1) - expect(messages[0].rule.id).to.be('alt-require') - expect(messages[0].line).to.be(2) - expect(messages[0].col).to.be(5) - - // Without value - code = '\r\n' - messages = HTMLHint.verify(code, { - rules: { - 'alt-require': 'off', - }, + it('Should use the recommended ruleset, if it is passed', () => { + const code = + '

>

' + const messages = HTMLHint.verify(code, { + extends: ['htmlhint:recommended'], + }) + expect(messages.length).to.be(9) }) - expect(messages.length).to.be(1) - expect(messages[0].rule.id).to.be('alt-require') - expect(messages[0].line).to.be(2) - expect(messages[0].col).to.be(5) - - // With value = 'off' - code = '\r\n' - messages = HTMLHint.verify(code, { - rules: { - 'alt-require': 'error', - }, + it('Should use no ruleset, if extends is not defined and empty ruleset is passed', () => { + const code = + '

>

' + const messages = HTMLHint.verify(code, { rules: {} }) + expect(messages.length).to.be(0) }) - expect(messages.length).to.be(0) - - // Without rule - code = '\r\n' - messages = HTMLHint.verify(code, { - rules: { - 'alt-require': 'off', - }, + }) + + describe('Customization', () => { + it('Set false to rule no effected should result in an error', () => { + const code = '' + const messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'off', + }, + }) + expect(messages.length).to.be(0) }) - expect(messages.length).to.be(0) - }) + it('Inline ruleset not worked should result in an error', () => { + // With value = 'error' + let code = '\r\n' + let messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'off', + }, + }) + + expect(messages.length).to.be(1) + expect(messages[0].rule.id).to.be('alt-require') + expect(messages[0].line).to.be(2) + expect(messages[0].col).to.be(5) + + // Without value + code = '\r\n' + messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'off', + }, + }) + + expect(messages.length).to.be(1) + expect(messages[0].rule.id).to.be('alt-require') + expect(messages[0].line).to.be(2) + expect(messages[0].col).to.be(5) - it('Show formated result should not result in an error', () => { - const code = - 'tttttttttttttttttttttttttttttttttttt
中文tttttttttttttttttttttttttttttttttttttttttttttt' - const messages = HTMLHint.verify(code, { - rules: { - 'tag-pair': 'error', - 'alt-require': 'error', - }, + // With value = 'off' + code = '\r\n' + messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'error', + }, + }) + expect(messages.length).to.be(0) + + // Without rule + code = '\r\n' + messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'off', + }, + }) + + expect(messages.length).to.be(0) }) - let arrLogs = HTMLHint.format(messages) - expect(arrLogs.length).to.be(4) - arrLogs = HTMLHint.format(messages, { - colors: true, - indent: 4, + it('Show formated result should not result in an error', () => { + const code = + 'tttttttttttttttttttttttttttttttttttt
中文tttttttttttttttttttttttttttttttttttttttttttttt' + const messages = HTMLHint.verify(code, { + rules: { + 'alt-require': 'error', + 'tag-pair': 'error', + }, + }) + let arrLogs = HTMLHint.format(messages) + expect(arrLogs.length).to.be(4) + + arrLogs = HTMLHint.format(messages, { + colors: true, + indent: 4, + }) + const log = arrLogs[0] + expect(/\[37m/.test(log)).to.be(true) + expect(/ {4}L1 /.test(log)).to.be(true) + expect(/|\.\.\./.test(log)).to.be(true) + expect(/t\.\.\./.test(log)).to.be(true) }) - const log = arrLogs[0] - expect(/\[37m/.test(log)).to.be(true) - expect(/ {4}L1 /.test(log)).to.be(true) - expect(/|\.\.\./.test(log)).to.be(true) - expect(/t\.\.\./.test(log)).to.be(true) }) }) diff --git a/test/htmlparser.spec.js b/test/htmlparser.spec.js index 1b5f8e743..2dcadfde1 100644 --- a/test/htmlparser.spec.js +++ b/test/htmlparser.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../src/core/core').HTMLParser */ const HTMLParser = require('../dist/htmlhint.js').HTMLParser expect.Assertion.prototype.event = function (type, attr) { diff --git a/test/rules/alt-require.spec.js b/test/rules/alt-require.spec.js index f79347e5b..067b90d46 100644 --- a/test/rules/alt-require.spec.js +++ b/test/rules/alt-require.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'alt-require' diff --git a/test/rules/attr-lowercase.spec.js b/test/rules/attr-lowercase.spec.js index 3164cdfb7..0654f8325 100644 --- a/test/rules/attr-lowercase.spec.js +++ b/test/rules/attr-lowercase.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-lowercase' diff --git a/test/rules/attr-no-duplication.spec.js b/test/rules/attr-no-duplication.spec.js index e1fba4edb..974c3fbdf 100644 --- a/test/rules/attr-no-duplication.spec.js +++ b/test/rules/attr-no-duplication.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-no-duplication' diff --git a/test/rules/attr-no-unnecessary-whitespace.spec.js b/test/rules/attr-no-unnecessary-whitespace.spec.js index 0a8e1d79e..ddd9726d4 100644 --- a/test/rules/attr-no-unnecessary-whitespace.spec.js +++ b/test/rules/attr-no-unnecessary-whitespace.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-no-unnecessary-whitespace' diff --git a/test/rules/attr-sort.spec.js b/test/rules/attr-sort.spec.js index a12f2269a..06b4dd919 100644 --- a/test/rules/attr-sort.spec.js +++ b/test/rules/attr-sort.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruleId = 'attr-sorted' diff --git a/test/rules/attr-unsafe-chars.spec.js b/test/rules/attr-unsafe-chars.spec.js index 1ca55ef0b..db539c528 100644 --- a/test/rules/attr-unsafe-chars.spec.js +++ b/test/rules/attr-unsafe-chars.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-unsafe-chars' diff --git a/test/rules/attr-value-double-quotes.spec.js b/test/rules/attr-value-double-quotes.spec.js index 06ea4a030..3d778e4a5 100644 --- a/test/rules/attr-value-double-quotes.spec.js +++ b/test/rules/attr-value-double-quotes.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-value-double-quotes' diff --git a/test/rules/attr-value-not-empty.spec.js b/test/rules/attr-value-not-empty.spec.js index ced884191..66ef4b10b 100644 --- a/test/rules/attr-value-not-empty.spec.js +++ b/test/rules/attr-value-not-empty.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-value-not-empty' diff --git a/test/rules/attr-value-single-quotes.spec.js b/test/rules/attr-value-single-quotes.spec.js index 2660c9b70..8440be096 100644 --- a/test/rules/attr-value-single-quotes.spec.js +++ b/test/rules/attr-value-single-quotes.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-value-single-quotes' diff --git a/test/rules/attr-whitespace.spec.js b/test/rules/attr-whitespace.spec.js index 5f0ba5f62..d27e91ff6 100644 --- a/test/rules/attr-whitespace.spec.js +++ b/test/rules/attr-whitespace.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'attr-whitespace' diff --git a/test/rules/default.spec.js b/test/rules/default.spec.js index a8b6f213b..e729b27d1 100644 --- a/test/rules/default.spec.js +++ b/test/rules/default.spec.js @@ -1,11 +1,12 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint describe('Rules: default', () => { - it('should result 3 errors', () => { + it('should result 2 errors', () => { const code = '

' const messages = HTMLHint.verify(code) - expect(messages.length).to.be(3) + expect(messages.length).to.be(2) }) }) diff --git a/test/rules/doctype-first.spec.js b/test/rules/doctype-first.spec.js index 630541c1f..b1831bde6 100644 --- a/test/rules/doctype-first.spec.js +++ b/test/rules/doctype-first.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'doctype-first' diff --git a/test/rules/doctype-html5.spec.js b/test/rules/doctype-html5.spec.js index b796ddb28..d11570ef7 100644 --- a/test/rules/doctype-html5.spec.js +++ b/test/rules/doctype-html5.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'doctype-html5' diff --git a/test/rules/head-require.spec.js b/test/rules/head-require.spec.js index 576efc041..6505f3976 100644 --- a/test/rules/head-require.spec.js +++ b/test/rules/head-require.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'head-script-disabled' diff --git a/test/rules/head-script-disabled.spec.js b/test/rules/head-script-disabled.spec.js index 576efc041..6505f3976 100644 --- a/test/rules/head-script-disabled.spec.js +++ b/test/rules/head-script-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'head-script-disabled' diff --git a/test/rules/href-abs-or-rel.spec.js b/test/rules/href-abs-or-rel.spec.js index 3a7420c2b..77fe35864 100644 --- a/test/rules/href-abs-or-rel.spec.js +++ b/test/rules/href-abs-or-rel.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'href-abs-or-rel' diff --git a/test/rules/id-class-ad-disabled.spec.js b/test/rules/id-class-ad-disabled.spec.js index 599e2f37a..c5ea2f29a 100644 --- a/test/rules/id-class-ad-disabled.spec.js +++ b/test/rules/id-class-ad-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'id-class-ad-disabled' diff --git a/test/rules/id-class-value.spec.js b/test/rules/id-class-value.spec.js index a28cce0f1..c6978bf50 100644 --- a/test/rules/id-class-value.spec.js +++ b/test/rules/id-class-value.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'id-class-value' diff --git a/test/rules/id-unique.spec.js b/test/rules/id-unique.spec.js index 75fc84868..c85abc94e 100644 --- a/test/rules/id-unique.spec.js +++ b/test/rules/id-unique.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'id-unique' diff --git a/test/rules/inline-script-disabled.spec.js b/test/rules/inline-script-disabled.spec.js index 869eb53c1..7a66c988d 100644 --- a/test/rules/inline-script-disabled.spec.js +++ b/test/rules/inline-script-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'inline-script-disabled' diff --git a/test/rules/inline-style-disabled.spec.js b/test/rules/inline-style-disabled.spec.js index fec36f2d2..a0cb5f972 100644 --- a/test/rules/inline-style-disabled.spec.js +++ b/test/rules/inline-style-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'inline-style-disabled' diff --git a/test/rules/input-requires-label.spec.js b/test/rules/input-requires-label.spec.js index 8d2637e92..d747ad9a5 100644 --- a/test/rules/input-requires-label.spec.js +++ b/test/rules/input-requires-label.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruleId = 'input-requires-label' diff --git a/test/rules/script-disabled.spec.js b/test/rules/script-disabled.spec.js index 5a0ae5b07..a803c5951 100755 --- a/test/rules/script-disabled.spec.js +++ b/test/rules/script-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'script-disabled' diff --git a/test/rules/space-tab-mixed-disabled.spec.js b/test/rules/space-tab-mixed-disabled.spec.js index 6542c414d..ab3621246 100644 --- a/test/rules/space-tab-mixed-disabled.spec.js +++ b/test/rules/space-tab-mixed-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'space-tab-mixed-disabled' diff --git a/test/rules/spec-char-escape.spec.js b/test/rules/spec-char-escape.spec.js index b22bf84cd..fddc62df2 100644 --- a/test/rules/spec-char-escape.spec.js +++ b/test/rules/spec-char-escape.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'spec-char-escape' diff --git a/test/rules/src-not-empty.spec.js b/test/rules/src-not-empty.spec.js index 895d0b352..ddbf9b655 100644 --- a/test/rules/src-not-empty.spec.js +++ b/test/rules/src-not-empty.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'src-not-empty' diff --git a/test/rules/style-disabled.spec.js b/test/rules/style-disabled.spec.js index dcbc001d2..4c5ef6d55 100644 --- a/test/rules/style-disabled.spec.js +++ b/test/rules/style-disabled.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'style-disabled' diff --git a/test/rules/tag-pair.spec.js b/test/rules/tag-pair.spec.js index 84dcd916b..72a99fc0e 100644 --- a/test/rules/tag-pair.spec.js +++ b/test/rules/tag-pair.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'tag-pair' diff --git a/test/rules/tag-self-close.spec.js b/test/rules/tag-self-close.spec.js index a66699246..945226a96 100644 --- a/test/rules/tag-self-close.spec.js +++ b/test/rules/tag-self-close.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'tag-self-close' diff --git a/test/rules/tagname-lowercase.spec.js b/test/rules/tagname-lowercase.spec.js index 0f6116f94..d1fed87fa 100644 --- a/test/rules/tagname-lowercase.spec.js +++ b/test/rules/tagname-lowercase.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'tagname-lowercase' diff --git a/test/rules/tagname-specialchars.spec.js b/test/rules/tagname-specialchars.spec.js index 583f6a3ba..a9c8b1246 100644 --- a/test/rules/tagname-specialchars.spec.js +++ b/test/rules/tagname-specialchars.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'tagname-specialchars' diff --git a/test/rules/tags-check.spec.js b/test/rules/tags-check.spec.js index cb20f71c0..5b66f4bb0 100644 --- a/test/rules/tags-check.spec.js +++ b/test/rules/tags-check.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'tags-check' diff --git a/test/rules/title-require.spec.js b/test/rules/title-require.spec.js index 0ee456249..958f6a01d 100644 --- a/test/rules/title-require.spec.js +++ b/test/rules/title-require.spec.js @@ -1,5 +1,6 @@ const expect = require('expect.js') +/** @type import('../../src/core/core').HTMLHint */ const HTMLHint = require('../../dist/htmlhint.js').HTMLHint const ruldId = 'title-require'