diff --git a/lib/lint/file.js b/lib/lint/file.js index 68dcca80..6baf25fb 100644 --- a/lib/lint/file.js +++ b/lib/lint/file.js @@ -252,6 +252,7 @@ export class LintFile { #path; #fullPath; #useDefaults; + #originalData; #data; #type; #hash; @@ -301,7 +302,7 @@ export class LintFile { this.#fullPath = this.path; // read file content - this.#data = await this.#file.text( "utf8" ); + this.#originalData = this.#data = await this.#file.text( "utf8" ); // detect type { @@ -563,7 +564,7 @@ export class LintFile { } } - async #runEslint ( { configs, editorConfig } ) { + async #runEslint ( { configs, editorConfig, fatalError } ) { if ( !this.#type?.eslint ) return result( 200 ); const fullPath = this.#fullPath; @@ -627,7 +628,17 @@ export class LintFile { "warnIgnored": true, } ); - if ( report[ 0 ].output != null ) this.#data = report[ 0 ].output; + // fatal error + if ( !fatalError && report[ 0 ].output == null ) { + + // repeat with the original data + this.#data = this.#originalData; + + return this.#runEslint( { configs, editorConfig, "fatalError": true } ); + } + else if ( report[ 0 ].output ) { + this.#data = report[ 0 ].output; + } // append log var log = "",