unplugin-auto-import
unplugin-auto-import copied to clipboard
Failed parsing of `.eslintrc-auto-import.json`
Describe the bug
webpack
+ unplugin-auto-import
combination sometimes fail on parsing .eslintrc-auto-import.json
.
From quick checks I've managed to find 2 conditions for this error to occur.
- Sometimes eslint file is read while it's being written to (case from the screenshot).
- Sometimes there are multiple concurrent writes to this file. Then
.eslintrc-auto-import.json
is corrupted.
{
"globals": {
"IconPhLinkBreak": true,
"IconPhLinkSimpleHorizontalBreak": true
}
}
"IconHeroiconsShoppingCart20Solid": true,
"IconPhLinkBreak": true,
"IconPhLinkSimpleHorizontalBreak": true
}
}
Both of these cases fail on the parseESLint
, as there isn't any try {} catch
around parsing and fallback return.
There was already one issue #143 about this, but it was closed due to lack of info. Hope these details will be enough.
Not sure how to fix the file locking which I guess would be the best fix, but even error handling in JSON parsing generally helps to recover from this problem.
Reproduction
It's hard to reproduce as typical race conditions problems. I can't reproduce it locally on my machine. It only happens on the basic GH Actions runner. Maybe that's because of the slower disk and bigger chance of double write or write with read occuring at the same time.
System Info
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Pro
Memory: 239.06 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.4.0 - ~/code/proj-devbox/.devbox/nix/profile/default/bin/node
Yarn: 1.18.0 - ~/code/proj-devbox/.devbox/nix/profile/default/bin/yarn
npm: 9.7.2 - ~/code/proj-devbox/.devbox/nix/profile/default/bin/npm
Browsers:
Chrome: 119.0.6045.159
Safari: 17.0
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
same here