Skip to content

Commit

Permalink
Fix nits/typos from "Allow specs to be represented by a simple string" (
Browse files Browse the repository at this point in the history
  • Loading branch information
foolip authored Jan 31, 2020
1 parent dd12ab4 commit 8fed617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const ajv = new Ajv();

// When an entry is invalid, the schema validator returns one error for each
// "oneOf" option and one error on overall "oneOf" problem. This is confusing
// for humans. the following function improves the error being returned.
// for humans. The following function improves the error being returned.
const clarifyErrors = errors => {
if (!errors || (errors.length < 2)) {
if (!errors || errors.length < 2) {
return errors;
}

Expand All @@ -23,8 +23,8 @@ const clarifyErrors = errors => {
}

// Otherwise, if second error is a type error for second oneOf choice,
// it means the itme is actually a string that represents an invalid URL,
// which the first error should capture
// it means the item is actually a string that represents an invalid URL,
// which the first error should capture.
if (errors[1].schemaPath === "#/items/oneOf/1/type") {
return [errors[0]];
}
Expand Down Expand Up @@ -128,4 +128,4 @@ else {
// Code imported to another JS module, export lint functions
module.exports.lintStr = lintStr;
module.exports.lint = lint;
}
}
2 changes: 1 addition & 1 deletion test/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ describe("Linter", () => {
/^specs\[0\] should not have additional property 'invalid'$/);
});
});
});
});

0 comments on commit 8fed617

Please sign in to comment.