Skip to content

Commit

Permalink
fix: cache the ajv object creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Aug 21, 2024
1 parent 8d6a481 commit 3bb14cd
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 3bb14cd

Please sign in to comment.