...
 
Commits (21)
......@@ -70,13 +70,6 @@ Jest:
script:
- npm test -- src elements tests
TSLint:
stage: test
dependencies: ["NPM"]
needs: ["NPM"]
script:
- npm run tslint
Prettier:
stage: test
dependencies: ["NPM"]
......@@ -144,6 +137,14 @@ Release:
variables:
UPSTREAM_VERSION: "${CI_COMMIT_TAG}"
cypress-html-validate:
<<: *downstream
trigger: html-validate/cypress-html-validate
example-plugin:
<<: *downstream
trigger: html-validate/example-plugin
grunt-html-validate:
<<: *downstream
trigger: html-validate/grunt-html-validate
......@@ -152,6 +153,10 @@ html-validate-angular:
<<: *downstream
trigger: html-validate/html-validate-angular
html-validate-jest-snapshot:
<<: *downstream
trigger: html-validate/html-validate-jest-snapshot
html-validate-vue:
<<: *downstream
trigger: html-validate/html-validate-vue
......@@ -159,3 +164,7 @@ html-validate-vue:
protractor-html-validate:
<<: *downstream
trigger: html-validate/protractor-html-validate
vue-cli-plugin-html-validate:
<<: *downstream
trigger: html-validate/vue-cli-plugin-html-validate
......@@ -9,7 +9,6 @@
/src/
/test-files/
/tsconfig.json
/tslint.json
/scripts
/temp
......
# html-validate changelog
## [2.17.1](https://gitlab.com/html-validate/html-validate/compare/v2.17.0...v2.17.1) (2020-03-02)
### Bug Fixes
- disable `void-style` when using `toHTMLValidate` matcher ([4d6bb3d](https://gitlab.com/html-validate/html-validate/commit/4d6bb3d7fe8f0e174082eb3c39d7f6dcd9109f56))
# [2.17.0](https://gitlab.com/html-validate/html-validate/compare/v2.16.0...v2.17.0) (2020-02-17)
### Bug Fixes
......
......@@ -64,11 +64,11 @@ Some tests are autogenerated from documentation examples, use `npm run build:doc
## Lint
Linting is done using eslint.
Linting is done using ESLint.
npm run lint
npm run eslint
or call `eslint` or `tslint` directly.
or call `eslint` directly.
## Build
......
......@@ -33,6 +33,12 @@ const elem = document.createElement("div");
expect(elem).toHTMLValidate();
```
<div class="alert alert-info">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<strong>Note</strong>
<p>The {@link void-style} rule is disabled by default since jsdom normalizes the style. It can be enabled by passing a custom configuration reenabling it.</p>
</div>
If needed a custom configuration can be passed:
```js
......
This diff is collapsed.
{
"name": "html-validate",
"version": "2.17.0",
"version": "2.17.1",
"description": "html linter",
"keywords": [
"html",
......@@ -47,14 +47,11 @@
"eslint": "eslint --ext js,ts .",
"eslint:fix": "eslint --ext js,ts . --fix",
"htmlvalidate": "./bin/html-validate.js",
"lint": "npm run eslint && npm run tslint",
"prettier:check": "prettier '**/*.{ts,js,json,md,scss}' --list-different",
"prettier:write": "prettier '**/*.{ts,js,json,md,scss}' --write",
"semantic-release": "semantic-release",
"start": "grunt connect",
"test": "jest --ci",
"tslint": "tslint -t verbose *.ts src/**/*.ts",
"tslint:fix": "tslint -t verbose --fix *.ts src/**/*.ts"
"test": "jest --ci"
},
"commitlint": {
"extends": [
......@@ -95,21 +92,21 @@
"minimist": "^1.2.0"
},
"devDependencies": {
"@babel/core": "7.8.4",
"@babel/preset-env": "7.8.4",
"@babel/core": "7.8.6",
"@babel/preset-env": "7.8.6",
"@commitlint/cli": "8.3.5",
"@html-validate/commitlint-config": "1.0.1",
"@html-validate/eslint-config": "1.1.2",
"@html-validate/eslint-config": "1.1.4",
"@html-validate/prettier-config": "1.0.0",
"@html-validate/semantic-release-config": "1.0.9",
"@html-validate/semantic-release-config": "1.0.11",
"@types/babel__code-frame": "7.0.1",
"@types/estree": "0.0.42",
"@types/glob": "7.1.1",
"@types/inquirer": "6.5.0",
"@types/jest": "25.1.2",
"@types/jest": "25.1.3",
"@types/json-merge-patch": "0.0.4",
"@types/minimist": "1.2.0",
"@types/node": "11.15.6",
"@types/node": "11.15.7",
"autoprefixer": "9.7.4",
"babelify": "10.0.0",
"bootstrap-sass": "3.4.1",
......@@ -118,7 +115,7 @@
"dgeni": "0.4.12",
"dgeni-front-matter": "1.0.2",
"dgeni-packages": "0.28.3",
"eslint-plugin-array-func": "3.1.3",
"eslint-plugin-array-func": "3.1.4",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-sonarjs": "0.5.0",
......@@ -137,20 +134,18 @@
"jest-diff": "25.1.0",
"jest-junit": "10.0.0",
"jquery": "3.4.1",
"lint-staged": "10.0.7",
"lint-staged": "10.0.8",
"load-grunt-tasks": "5.1.0",
"marked": "0.8.0",
"minimatch": "3.0.4",
"prettier": "1.19.1",
"sass": "1.25.0",
"semantic-release": "17.0.3",
"sass": "1.26.2",
"semantic-release": "17.0.4",
"serve-static": "1.14.1",
"stringmap": "0.2.2",
"strip-ansi": "6.0.0",
"ts-jest": "25.2.0",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"typescript": "3.7.5"
"ts-jest": "25.2.1",
"typescript": "3.8.3"
},
"jest": {
"collectCoverage": true,
......
......@@ -12,7 +12,6 @@ npm test
echo Run linting
npm run eslint -- --max-warnings 0
npm run tslint
echo Lint documentation
npm run htmlvalidate -- --config docs/htmlvalidate-templates.json 'docs/**/*.html'
......
......@@ -41,7 +41,6 @@ export class Context {
/* poor mans line counter :( */
let consumed = this.string.slice(0, n);
let offset;
/* tslint:disable-next-line:no-conditional-assignment */
while ((offset = consumed.indexOf("\n")) >= 0) {
this.line++;
this.column = 1;
......
......@@ -159,7 +159,6 @@ export class Lexer {
for (let i = 0; i < n; i++) {
const [regex, nextState, tokenType] = tests[i];
/* tslint:disable-next-line:no-conditional-assignment */
if (regex === false || (match = context.string.match(regex))) {
let token: Token = null;
if (tokenType !== false) {
......
......@@ -246,6 +246,11 @@ describe("toHTMLValidate()", () => {
});
});
it("should ignore void-style by default", () => {
expect.assertions(1);
expect("<hr><hr/>").toHTMLValidate();
});
it("should support jsdom", () => {
/* eslint-disable-next-line @typescript-eslint/ban-ts-ignore */
// @ts-ignore DOM library not available
......
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/ban-ts-ignore, prefer-template, sonarjs/no-duplicate-string */
import diff from "jest-diff";
import deepmerge from "deepmerge";
import { TokenType } from "./lexer";
import { Message, Report, Result } from "./reporter";
import { ConfigData } from "./config";
......@@ -144,7 +145,7 @@ function toHTMLValidate(
this: jest.MatcherUtils,
// @ts-ignore DOM library not available
actual: string | HTMLElement,
config?: ConfigData,
userConfig?: ConfigData,
filename?: string
): jest.CustomMatcherResult {
// @ts-ignore DOM library not available
......@@ -152,6 +153,15 @@ function toHTMLValidate(
actual = actual.outerHTML;
}
const defaultConfig = {
rules: {
/* jsdom normalizes style so disabling rule when using this matcher or it
* gets quite noisy when configured with self-closing */
"void-style": "off",
},
};
const config = deepmerge(defaultConfig, userConfig || {});
const actualFilename = filename || this.testPath;
const htmlvalidate = new HtmlValidate();
const report = htmlvalidate.validateString(actual, actualFilename, config);
......
......@@ -13,7 +13,6 @@ export function* parseConditionalComment(
): IterableIterator<ConditionalComment> {
let match: RegExpExecArray;
// tslint:disable-next-line no-conditional-assignment
while ((match = regexp.exec(comment)) !== null) {
const expression = match[1];
const begin = match.index;
......
......@@ -594,7 +594,6 @@ export class Parser {
*/
private closeTree(source: Source, location: Location): void {
let active;
/* tslint:disable-next-line:no-conditional-assignment */
while ((active = this.dom.getActive()) && !active.isRootElement()) {
this.closeElement(source, null, active, location);
this.dom.popActive();
......
{
"defaultSeverity": "error",
"extends": ["tslint:recommended", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"curly": [true, "ignore-same-line"],
"indent": [true, "tabs", 1],
"interface-name": false,
"jsdoc-format": false,
"max-classes-per-file": false,
"max-line-length": false,
"member-access": true,
"member-ordering": false,
"no-console": false,
"no-empty-interface": false,
"no-shadowed-variable": false,
"no-var-requires": false,
"object-literal-sort-keys": false,
"one-line": {
"options": [
"check-catch",
"check-else",
"check-finally",
"check-open-brace"
]
},
"ordered-imports": false,
"unified-signatures": false
},
"rulesDirectory": []
}