Skip to content

Commit

Permalink
fix: useSchemastoreCatalog is enabled by default according to docs. (
Browse files Browse the repository at this point in the history
…#305)

* fix: `useSchemastoreCatalog` is enabled by default according to docs.

* Create sixty-mice-arrive.md

* add test
  • Loading branch information
ota-meshi committed Mar 23, 2024
1 parent f65a640 commit ada5a08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sixty-mice-arrive.md
@@ -0,0 +1,5 @@
---
"eslint-plugin-json-schema-validator": major
---

fix: `useSchemastoreCatalog` is enabled by default according to docs.
3 changes: 2 additions & 1 deletion src/rules/no-invalid.ts
Expand Up @@ -403,7 +403,8 @@ export default createRule("no-invalid", {
relativeFilename: string,
): Validator[] | null {
const option = context.options[0] || {};
if (!option.useSchemastoreCatalog) {
const useSchemastoreCatalog = option.useSchemastoreCatalog !== false;
if (!useSchemastoreCatalog) {
return null;
}

Expand Down
9 changes: 9 additions & 0 deletions tests/src/rules/no-invalid.ts
Expand Up @@ -42,6 +42,15 @@ tester.run(
},
],
invalid: [
{
filename: ".eslintrc.json",
code: '{ "extends": [ 42 ] }',
errors: [
'"extends" must be string.',
'"extends" must match exactly one schema in oneOf.',
'"extends[0]" must be string.',
],
},
{
filename: ".eslintrc.json",
code: '{ "extends": [ 42 ] }',
Expand Down

0 comments on commit ada5a08

Please sign in to comment.