standard / standard-engine

:fire_engine: The guts of `standard` modularized for reuse
MIT License
146 stars 39 forks source link

lintFiles() to await on ESLint.outputFixes() #318

Closed fskreuz closed 1 year ago

fskreuz commented 1 year ago

This ensures that fixes are written before resolving.

Without this, the file may be in a weird state if consumed right after calling lintFiles() (e.g. reading the files right after calling lintFiles() would return an empty string, stat would show a zero-sized file).

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update [x] Bug fix [ ] New feature [ ] Other, please explain:

What changes did you make? (Give an overview)

Added await to this.eslint.ESLint.outputFixes(result) to ensure the fixed files are written before lintFiles() returns.

Under the hood, ESLint.outputFixes() is an async function that awaits on a promisified fs.writeFile().

Which issue (if any) does this pull request address?

None.

Is there anything you'd like reviewers to focus on?

Cross-platform testing. Issue may be OS-dependent because it deals with the filesystem. This issue happened on a Windows machine, I cannot verify on other platforms.

welcome[bot] commented 1 year ago

🙌 Thanks for opening this pull request! You're awesome.

welcome[bot] commented 1 year ago

🎉 Congrats on getting your first pull request landed!

voxpelli commented 1 year ago

Released in 15.1.0, thanks 🙏