This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
3 changed files
with
35 additions
and
3 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,34 @@ | ||
// Do this as the first thing so that any code reading it knows the right env. | ||
process.env.BABEL_ENV = 'test'; | ||
process.env.NODE_ENV = 'test'; | ||
process.env.PUBLIC_URL = ''; | ||
|
||
// Makes the script crash on unhandled rejections instead of silently | ||
// ignoring them. In the future, promise rejections that are not handled will | ||
// terminate the Node.js process with a non-zero exit code. | ||
process.on('unhandledRejection', err => { | ||
throw err; | ||
}); | ||
|
||
// Ensure environment variables are read. | ||
require('../config/env'); | ||
|
||
const { ESLint } = require("eslint"); | ||
|
||
(async function main() { | ||
// 1. Create an instance. | ||
const eslint = new ESLint(); | ||
|
||
// 2. Lint files. | ||
const results = await eslint.lintFiles(["**/*{.js, .ts, .jsx, .tsx, .css}"]); | ||
|
||
// 3. Format the results. | ||
const formatter = await eslint.loadFormatter("stylish"); | ||
const resultText = formatter.format(results); | ||
|
||
// 4. Output it. | ||
console.log(resultText); | ||
})().catch((error) => { | ||
process.exitCode = 1; | ||
console.error(error); | ||
}); |