(errorMessage)
| 3 | |
| 4 | class UndefinedVariableFixer extends BaseFixer { |
| 5 | async run(errorMessage) { |
| 6 | const varName = this.getUndefinedVariableName(errorMessage); |
| 7 | const value = await this.guessVariableValue(varName); |
| 8 | const scss = fs.readFileSync(this.filePath, 'utf8'); |
| 9 | const processedFile = await this.processCss(scss, this.transform(varName, value)); |
| 10 | return [{ filePath: this.filePath, data: processedFile.css }]; |
| 11 | } |
| 12 | |
| 13 | getUndefinedVariableName(errorMessage) { |
| 14 | const match = errorMessage.match(/\$[a-zA-Z_-]+/gi); |
no test coverage detected