Commit 5d2b45eb authored by David Sveningsson's avatar David Sveningsson

feat: enable typescript strict mode (excect strict null)

parent 67bb8e02
......@@ -42,9 +42,11 @@ describe("ConfigLoader", () => {
});
it("should load configuration", () => {
jest.spyOn(fs, "existsSync").mockImplementation((filename: string) => {
return filename === path.resolve("/path/to/.htmlvalidate.json");
});
jest
.spyOn(fs, "existsSync")
.mockImplementation((filename: fs.PathLike) => {
return filename === path.resolve("/path/to/.htmlvalidate.json");
});
const config = loader.fromTarget("/path/to/target.html");
expect(config.get()).toEqual(
expect.objectContaining({
......@@ -57,9 +59,11 @@ describe("ConfigLoader", () => {
});
it("should load configuration from parent directory", () => {
jest.spyOn(fs, "existsSync").mockImplementation((filename: string) => {
return filename === path.resolve("/path/.htmlvalidate.json");
});
jest
.spyOn(fs, "existsSync")
.mockImplementation((filename: fs.PathLike) => {
return filename === path.resolve("/path/.htmlvalidate.json");
});
const config = loader.fromTarget("/path/to/target.html");
expect(config.get()).toEqual(
expect.objectContaining({
......
......@@ -31,7 +31,10 @@ function flattenMessages(report: Report): Message[] {
}, []);
}
function toBeValid(report: Report): jest.CustomMatcherResult {
function toBeValid(
this: jest.MatcherUtils,
report: Report
): jest.CustomMatcherResult {
if (report.valid) {
return {
pass: true,
......@@ -48,7 +51,10 @@ function toBeValid(report: Report): jest.CustomMatcherResult {
}
}
function toBeInvalid(report: Report): jest.CustomMatcherResult {
function toBeInvalid(
this: jest.MatcherUtils,
report: Report
): jest.CustomMatcherResult {
if (report.valid) {
return {
pass: false,
......@@ -64,6 +70,7 @@ function toBeInvalid(report: Report): jest.CustomMatcherResult {
}
function toHaveError(
this: jest.MatcherUtils,
report: Report,
ruleId: any,
message: any,
......@@ -93,6 +100,7 @@ function toHaveError(
}
function toHaveErrors(
this: jest.MatcherUtils,
report: Report,
errors: Array<[string, string] | {}>
): jest.CustomMatcherResult {
......@@ -121,7 +129,11 @@ function toHaveErrors(
return { pass, message: resultMessage };
}
function toBeToken(actual: any, expected: any): jest.CustomMatcherResult {
function toBeToken(
this: jest.MatcherUtils,
actual: any,
expected: any
): jest.CustomMatcherResult {
const token = actual.value;
// istanbul ignore next: TokenMatcher requires "type" property to be set, this is just a failsafe
......
......@@ -50,6 +50,7 @@ export interface MetaElement extends MetaData {
tagName: string;
[key: string]:
| undefined
| boolean
| PropertyExpression
| Permitted
......
......@@ -9,7 +9,9 @@
"noImplicitAny": true,
"outDir": "build",
"sourceMap": false,
"target": "es2017"
"target": "es2017",
"strict": true,
"strictNullChecks": false
},
"sourceMap": true,
"include": ["src/**/*.ts"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment