Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00b2bb0
commit d394aa6
Showing
15 changed files
with
3,198 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"use strict"; | ||
|
||
const { | ||
defineInMemoryFs, | ||
defineConfigArrayFactoryWithInMemoryFileSystem, | ||
defineCascadingConfigArrayFactoryWithInMemoryFileSystem, | ||
defineFileEnumeratorWithInMemoryFileSystem, | ||
defineCLIEngineWithInMemoryFileSystem, | ||
defineESLintWithInMemoryFileSystem | ||
} = require("./in-memory-fs"); | ||
|
||
|
||
/** | ||
* Prevents leading spaces in a multiline template literal from appearing in the resulting string | ||
* @param {string[]} strings The strings in the template literal | ||
* @param {any[]} values The interpolation values in the template literal. | ||
* @returns {string} The template literal, with spaces removed from all lines | ||
*/ | ||
function unIndent(strings, ...values) { | ||
const text = strings | ||
.map((s, i) => (i === 0 ? s : values[i - 1] + s)) | ||
.join(""); | ||
const lines = text.replace(/^\n/u, "").replace(/\n\s*$/u, "").split("\n"); | ||
const lineIndents = lines.filter(line => line.trim()).map(line => line.match(/ */u)[0].length); | ||
const minLineIndent = Math.min(...lineIndents); | ||
|
||
return lines.map(line => line.slice(minLineIndent)).join("\n"); | ||
} | ||
|
||
|
||
module.exports = { | ||
unIndent, | ||
defineInMemoryFs, | ||
defineConfigArrayFactoryWithInMemoryFileSystem, | ||
defineCascadingConfigArrayFactoryWithInMemoryFileSystem, | ||
defineFileEnumeratorWithInMemoryFileSystem, | ||
defineCLIEngineWithInMemoryFileSystem, | ||
defineESLintWithInMemoryFileSystem | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.