Skip to content

Commit

Permalink
Merge pull request #179 from kellyselden/cache_ajv
Browse files Browse the repository at this point in the history
fix: cache the ajv object creation
  • Loading branch information
kellyselden authored Aug 21, 2024
2 parents 8d6a481 + 3bb14cd commit 6a39c59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rules/validate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const Ajv = require('ajv');
const { default: betterAjvErrors } = require('better-ajv-errors');

let ajv;

module.exports = {
meta: {
docs: {
Expand Down Expand Up @@ -30,7 +32,9 @@ module.exports = {

let sourceCode = context.getSourceCode();

let ajv = new Ajv();
if (!ajv) {
ajv = new Ajv();
}

let schema = JSON.parse(options.schema);

Expand Down

0 comments on commit 6a39c59

Please sign in to comment.