eslint-plugin-json-schema-validator
Advanced tools
Comparing version 4.7.4 to 4.8.0
@@ -8,2 +8,2 @@ declare const _default: { | ||
}; | ||
export = _default; | ||
export default _default; |
"use strict"; | ||
module.exports = { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = { | ||
plugins: ["json-schema-validator"], | ||
@@ -4,0 +5,0 @@ overrides: [ |
@@ -7,2 +7,2 @@ declare const _default: { | ||
}; | ||
export = _default; | ||
export default _default; |
@@ -5,2 +5,3 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -11,3 +12,3 @@ const base = require.resolve("./base"); | ||
: base; | ||
module.exports = { | ||
exports.default = { | ||
extends: [baseExtend], | ||
@@ -14,0 +15,0 @@ rules: { |
@@ -149,6 +149,6 @@ "use strict"; | ||
for (const p of error.path) { | ||
const next = target === null || target === void 0 ? void 0 : target.children.get(p); | ||
const next = target?.children.get(p); | ||
target = typeof next === "symbol" ? undefined : next; | ||
} | ||
const key = target === null || target === void 0 ? void 0 : target.key; | ||
const key = target?.key; | ||
const range = typeof key === "function" ? key(sourceCode) : key; | ||
@@ -236,4 +236,3 @@ if (!range) { | ||
function findSchemaPathFromYAML(node) { | ||
var _a; | ||
const rootExpr = (_a = node.body[0]) === null || _a === void 0 ? void 0 : _a.content; | ||
const rootExpr = node.body[0]?.content; | ||
if (!rootExpr || rootExpr.type !== "YAMLMapping") { | ||
@@ -363,4 +362,3 @@ return null; | ||
function createValidator(context, filename) { | ||
var _a; | ||
const mergeSchemas = parseMergeSchemasOption((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.mergeSchemas); | ||
const mergeSchemas = parseMergeSchemasOption(context.options[0]?.mergeSchemas); | ||
const validatorsCtx = createValidatorsContext(context, filename); | ||
@@ -367,0 +365,0 @@ if (mergeSchemas && mergeSchemas.some((kind) => validatorsCtx[kind])) { |
@@ -18,3 +18,6 @@ "use strict"; | ||
} | ||
const pathData = Object.assign({ key: rootRange }, data); | ||
const pathData = { | ||
key: rootRange, | ||
...data, | ||
}; | ||
const result = { | ||
@@ -58,3 +61,3 @@ object: data.data, | ||
instanceof: (v1, v2) => v1 instanceof v2, | ||
"**": (v1, v2) => Math.pow(v1, v2), | ||
"**": (v1, v2) => v1 ** v2, | ||
}; | ||
@@ -72,3 +75,6 @@ const VISITORS = { | ||
data[keyName] = propData.data; | ||
children.set(keyName, Object.assign({ key: prop.key.range }, propData)); | ||
children.set(keyName, { | ||
key: prop.key.range, | ||
...propData, | ||
}); | ||
} | ||
@@ -104,3 +110,6 @@ else { | ||
data[index] = propData.data; | ||
children.set(String(index), Object.assign({ key: element.range }, propData)); | ||
children.set(String(index), { | ||
key: element.range, | ||
...propData, | ||
}); | ||
} | ||
@@ -356,3 +365,2 @@ else { | ||
TemplateLiteral(node, context) { | ||
var _a, _b; | ||
const expressions = []; | ||
@@ -366,6 +374,6 @@ for (const e of node.expressions) { | ||
} | ||
let data = (_a = node.quasis[0].value.cooked) !== null && _a !== void 0 ? _a : node.quasis[0].value.raw; | ||
let data = node.quasis[0].value.cooked ?? node.quasis[0].value.raw; | ||
for (let i = 0; i < expressions.length; ++i) { | ||
data += String(expressions[i]); | ||
data += (_b = node.quasis[i + 1].value.cooked) !== null && _b !== void 0 ? _b : node.quasis[i + 1].value.raw; | ||
data += node.quasis[i + 1].value.cooked ?? node.quasis[i + 1].value.raw; | ||
} | ||
@@ -372,0 +380,0 @@ return { data, children: EMPTY_MAP }; |
@@ -61,3 +61,8 @@ "use strict"; | ||
: url.hostname; | ||
const options = Object.assign(Object.assign({}, baseOptions), { protocol: url.protocol, hostname, path: `${url.pathname || ""}${url.search || ""}` }); | ||
const options = { | ||
...baseOptions, | ||
protocol: url.protocol, | ||
hostname, | ||
path: `${url.pathname || ""}${url.search || ""}`, | ||
}; | ||
if (url.port !== "") { | ||
@@ -77,3 +82,3 @@ options.port = Number(url.port); | ||
]; | ||
const proxyStr = (options === null || options === void 0 ? void 0 : options.proxy) || | ||
const proxyStr = options?.proxy || | ||
PROXY_ENV.map((k) => process.env[k]).find((v) => v); | ||
@@ -80,0 +85,0 @@ if (proxyStr) { |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const synckit_1 = require("synckit"); | ||
const http_1 = require("./http"); | ||
(0, synckit_1.runAsWorker)((url, options, httpModulePath) => __awaiter(void 0, void 0, void 0, function* () { | ||
(0, synckit_1.runAsWorker)(async (url, options, httpModulePath) => { | ||
return (0, http_1.get)(url, options, httpModulePath); | ||
})); | ||
}); |
@@ -37,3 +37,11 @@ "use strict"; | ||
return { | ||
meta: Object.assign(Object.assign({}, rule.meta), { docs: Object.assign(Object.assign({}, rule.meta.docs), { url: `https://ota-meshi.github.io/eslint-plugin-json-schema-validator/rules/${ruleName}.html`, ruleId: `json-schema-validator/${ruleName}`, ruleName }) }), | ||
meta: { | ||
...rule.meta, | ||
docs: { | ||
...rule.meta.docs, | ||
url: `https://ota-meshi.github.io/eslint-plugin-json-schema-validator/rules/${ruleName}.html`, | ||
ruleId: `json-schema-validator/${ruleName}`, | ||
ruleName, | ||
}, | ||
}, | ||
create(context) { | ||
@@ -85,7 +93,6 @@ const sourceCode = (0, compat_1.getSourceCode)(context); | ||
function getBlockFileName(customBlock, langFallback) { | ||
var _a, _b; | ||
const attrs = {}; | ||
for (const attr of customBlock.startTag.attributes) { | ||
if (!attr.directive) { | ||
attrs[attr.key.name] = (_b = (_a = attr.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null; | ||
attrs[attr.key.name] = attr.value?.value ?? null; | ||
} | ||
@@ -92,0 +99,0 @@ } |
@@ -37,10 +37,10 @@ "use strict"; | ||
return loadJsonFromURL(url, context, (orig) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
const result = (_a = edit === null || edit === void 0 ? void 0 : edit(orig)) !== null && _a !== void 0 ? _a : orig; | ||
const result = edit?.(orig) ?? orig; | ||
if (jsonPath === "vscode://schemas/settings/machine") { | ||
const target = (_d = (_c = (_b = result === null || result === void 0 ? void 0 : result.properties) === null || _b === void 0 ? void 0 : _b["workbench.externalUriOpeners"]) === null || _c === void 0 ? void 0 : _c.additionalProperties) === null || _d === void 0 ? void 0 : _d.anyOf; | ||
const target = result?.properties?.["workbench.externalUriOpeners"]?.additionalProperties?.anyOf; | ||
removeEmptyEnum(target); | ||
} | ||
else if (jsonPath === "vscode://schemas/launch") { | ||
const target = (_k = (_j = (_h = (_g = (_f = (_e = result === null || result === void 0 ? void 0 : result.properties) === null || _e === void 0 ? void 0 : _e.compounds) === null || _f === void 0 ? void 0 : _f.items) === null || _g === void 0 ? void 0 : _g.properties) === null || _h === void 0 ? void 0 : _h.configurations) === null || _j === void 0 ? void 0 : _j.items) === null || _k === void 0 ? void 0 : _k.oneOf; | ||
const target = result?.properties?.compounds?.items?.properties | ||
?.configurations?.items?.oneOf; | ||
removeEmptyEnum(target); | ||
@@ -77,3 +77,2 @@ } | ||
function loadJsonFromURL(jsonPath, context, edit) { | ||
var _a, _b, _c; | ||
let jsonFileName = jsonPath.replace(/^https?:\/\//u, ""); | ||
@@ -84,5 +83,5 @@ if (!jsonFileName.endsWith(".json")) { | ||
const jsonFilePath = path_1.default.join(__dirname, `../../.cached_schemastore/${jsonFileName}`); | ||
const options = (_b = (_a = context.settings) === null || _a === void 0 ? void 0 : _a["json-schema-validator"]) === null || _b === void 0 ? void 0 : _b.http; | ||
const httpRequestOptions = (_c = options === null || options === void 0 ? void 0 : options.requestOptions) !== null && _c !== void 0 ? _c : {}; | ||
const httpGetModulePath = resolvePath(options === null || options === void 0 ? void 0 : options.getModulePath, context); | ||
const options = context.settings?.["json-schema-validator"]?.http; | ||
const httpRequestOptions = options?.requestOptions ?? {}; | ||
const httpGetModulePath = resolvePath(options?.getModulePath, context); | ||
makeDirs(path_1.default.dirname(jsonFilePath)); | ||
@@ -94,3 +93,3 @@ let data, timestamp; | ||
} | ||
catch (_d) { | ||
catch { | ||
} | ||
@@ -124,3 +123,3 @@ if (data != null && typeof timestamp === "number") { | ||
} | ||
catch (_a) { | ||
catch { | ||
context.report({ | ||
@@ -127,0 +126,0 @@ loc: { line: 1, column: 0 }, |
{ | ||
"name": "eslint-plugin-json-schema-validator", | ||
"version": "4.7.4", | ||
"version": "4.8.0", | ||
"description": "ESLint plugin that validates data using JSON Schema Validator.", | ||
@@ -56,7 +56,7 @@ "repository": "git+https://github.com/ota-meshi/eslint-plugin-json-schema-validator.git", | ||
"debug": "^4.3.1", | ||
"eslint-compat-utils": "^0.1.2", | ||
"eslint-compat-utils": "^0.2.0", | ||
"json-schema-migrate": "^2.0.0", | ||
"jsonc-eslint-parser": "^2.0.0", | ||
"minimatch": "^8.0.0", | ||
"synckit": "^0.8.0", | ||
"synckit": "^0.9.0", | ||
"toml-eslint-parser": "^0.9.0", | ||
@@ -72,3 +72,3 @@ "tunnel-agent": "^0.6.0", | ||
"@types/debug": "^4.1.5", | ||
"@types/eslint": "^8.0.0", | ||
"@types/eslint": "^8.56.2", | ||
"@types/eslint-scope": "^3.7.0", | ||
@@ -85,3 +85,3 @@ "@types/eslint-visitor-keys": "^1.0.0", | ||
"esbuild-register": "^3.3.3", | ||
"eslint": "^8.0.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
@@ -97,3 +97,3 @@ "eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-regexp": "^2.0.0", | ||
"eslint-plugin-toml": "^0.7.0", | ||
"eslint-plugin-toml": "^0.8.0", | ||
"eslint-plugin-vue": "^9.0.0", | ||
@@ -110,6 +110,6 @@ "eslint-plugin-yml": "^1.0.0", | ||
"semver": "^7.3.2", | ||
"stylelint": "^15.0.0", | ||
"stylelint": "^16.0.0", | ||
"stylelint-config-recommended-vue": "^1.0.0", | ||
"stylelint-config-standard": "^34.0.0", | ||
"stylelint-stylus": "^0.18.0", | ||
"stylelint-config-standard": "^36.0.0", | ||
"stylelint-stylus": "^1.0.0", | ||
"typescript": "^5.0.0", | ||
@@ -116,0 +116,0 @@ "vue-eslint-editor": "^1.1.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2495
106708
+ Addedeslint-compat-utils@0.2.1(transitive)
+ Addedsynckit@0.9.1(transitive)
- Removedeslint-compat-utils@0.1.2(transitive)
- Removedsynckit@0.8.8(transitive)
Updatedeslint-compat-utils@^0.2.0
Updatedsynckit@^0.9.0