mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 21:24:26 +08:00
This pulls in version 8, which covers numerous breaking changes. Most notably, the `CLIEngine` class has been removed, for which we should now use `ESLint`. R=jacktfranklin@chromium.org Bug: none Change-Id: I3b64600e690f073d4db19fb34539db7200f3b561 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3268298 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
35 lines
993 B
JavaScript
35 lines
993 B
JavaScript
/**
|
|
* @fileoverview The instance of Ajv validator.
|
|
* @author Evgeny Poberezkin
|
|
*/
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Requirements
|
|
//------------------------------------------------------------------------------
|
|
|
|
const Ajv = require("ajv"),
|
|
metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Public Interface
|
|
//------------------------------------------------------------------------------
|
|
|
|
module.exports = (additionalOptions = {}) => {
|
|
const ajv = new Ajv({
|
|
meta: false,
|
|
useDefaults: true,
|
|
validateSchema: false,
|
|
missingRefs: "ignore",
|
|
verbose: true,
|
|
schemaId: "auto",
|
|
...additionalOptions
|
|
});
|
|
|
|
ajv.addMetaSchema(metaSchema);
|
|
// eslint-disable-next-line no-underscore-dangle -- Ajv's API
|
|
ajv._opts.defaultMeta = metaSchema.id;
|
|
|
|
return ajv;
|
|
};
|