Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't crash if schema cache directories already exist #365

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

antitoxic
Copy link
Contributor

👋 Hi there. Thank you for creating the library. It's super useful!

One problem I noticed happening in our GitHub CI process is that it crashed sometimes and the error was:

Error while loading rule 'json-schema-validator/no-invalid': EEXIST: file already exists, mkdir 'node_modules/eslint-plugin-json-schema-validator/.cached_schemastore'

Which was caused by fs.mkdirSync throwing an error when a directory already exists.

I swapped this with fs.mkdirSync('<path to dir>', { recursive: true }) which will not throw if the directory exists AND has the added benefit that it automatically creates any missing parent directory which means you don't need the makeDirs helper function.

Copy link

changeset-bot bot commented Dec 6, 2024

🦋 Changeset detected

Latest commit: 20ca574

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-json-schema-validator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Owner

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@ota-meshi ota-meshi merged commit 0830dcb into ota-meshi:main Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants