Skip to content

Commit b0e5521

Browse files
committed
chore: upgrade to html-validate 4.0
BREAKING CHANGES: `html-validate` no longer supports node 8 See https://html-validate.org/changelog/index.html#4-0-0- for more information.
1 parent 040f293 commit b0e5521

File tree

7 files changed

+554
-596
lines changed

7 files changed

+554
-596
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"rollup-plugin-esbuild": "2.3.0"
3636
},
3737
"dependencies": {
38-
"defu": "^3.1.0",
39-
"html-validate": "^3.5.0"
38+
"defu": "^3.2.1",
39+
"html-validate": "^4.0.0"
4040
},
4141
"devDependencies": {
4242
"@babel/plugin-transform-runtime": "latest",
@@ -49,13 +49,13 @@
4949
"@release-it/conventional-changelog": "^2.0.0",
5050
"@types/jest": "latest",
5151
"babel-eslint": "latest",
52-
"babel-jest": "latest",
53-
"eslint": "^7.12.1",
52+
"babel-jest": "26.6.3",
53+
"eslint": "^7.13.0",
5454
"husky": "4.3.0",
55-
"jest": "latest",
56-
"lint-staged": "10.5.0",
57-
"nuxt-edge": "latest",
58-
"release-it": "^14.2.0",
55+
"jest": "26.6.3",
56+
"lint-staged": "10.5.1",
57+
"nuxt-edge": "2.14.8-26748031.2c6610cf",
58+
"release-it": "^14.2.1",
5959
"siroc": "latest"
6060
},
6161
"peerDependencies": {

siroc.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"rollup": {
3-
"externals": ["html-validate/build/formatters/codeframe", "html-validate/build/formatters/stylish"]
3+
"externals": ["html-validate/dist/formatters/codeframe", "html-validate/dist/formatters/stylish"]
44
}
55
}

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface ModuleOptions {
2626
options?: ConfigData
2727
}
2828

29-
export const DEFAULTS: ModuleOptions = {
29+
export const DEFAULTS: Required<ModuleOptions> = {
3030
usePrettier: false,
3131
options: defaultHtmlValidateConfig
3232
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const nuxtModule: Module<ModuleOptions> = function (moduleOptions) {
1313
`Using ${chalk.bold('html-validate')} to validate server-rendered HTML`
1414
)
1515

16-
const { usePrettier, options } = defu<ModuleOptions>(this.options[CONFIG_KEY], moduleOptions, DEFAULTS)
16+
const { usePrettier, options } = defu(this.options[CONFIG_KEY] || {}, moduleOptions, DEFAULTS)
1717
const { validator } = useValidator(options)
1818

1919
const checkHTML = useChecker(validator, usePrettier)

src/validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export const useChecker = (validator: HtmlValidate, usePrettier = false, reporte
4343
}
4444

4545
const formatter = couldFormat
46-
? await import('html-validate/build/formatters/codeframe').then(r => r.default || /* istanbul ignore next */ r)
47-
: await import('html-validate/build/formatters/stylish').then(r => r.default || /* istanbul ignore next */ r)
46+
? await import('html-validate/dist/formatters/codeframe').then(r => r.default || /* istanbul ignore next */ r)
47+
: await import('html-validate/dist/formatters/stylish').then(r => r.default || /* istanbul ignore next */ r)
4848

4949
const formattedResult = formatter(results)
5050
reporter.error(

test/checker.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import consola from 'consola'
22
import prettier from 'prettier'
3-
import prettierPrinter from 'html-validate/build/formatters/codeframe'
4-
import normalPrinter from 'html-validate/build/formatters/stylish'
3+
import prettierPrinter from 'html-validate/dist/formatters/codeframe'
4+
import normalPrinter from 'html-validate/dist/formatters/stylish'
55

66
import { useChecker } from '../src/validator'
77

@@ -16,8 +16,8 @@ jest.mock('prettier', () => ({
1616
jest.mock('consola', () => ({
1717
withTag: jest.fn().mockImplementation(() => mockReporter)
1818
}))
19-
jest.mock('html-validate/build/formatters/codeframe')
20-
jest.mock('html-validate/build/formatters/stylish')
19+
jest.mock('html-validate/dist/formatters/codeframe')
20+
jest.mock('html-validate/dist/formatters/stylish')
2121

2222
const mockReporter = {
2323
success: jest.fn(),

0 commit comments

Comments
 (0)