yeoman / configstore

Easily load and persist config without having to think about where and how
BSD 2-Clause "Simplified" License
868 stars 56 forks source link

Make rewriting of JSONs with syntax errors optional #90

Open KrFreeFly opened 1 year ago

KrFreeFly commented 1 year ago

https://github.com/yeoman/configstore/blob/c70d76c19abe75920bdbb8c294b64f6bae68c15b/index.js#L46C49-L46C49

if (error.name === 'SyntaxError') {
                writeFileAtomic.sync(this._path, '', writeFileOptions);
                return {};
            }

Maybe add an option to leave .json with syntax errors untouched? We have large config files and sometimes lose them completely in case of error