forked from tabarra/txAdmin
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(core): small typescript fixes + formatter
- Loading branch information
Showing
4 changed files
with
88 additions
and
32 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
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,41 @@ | ||
#!/usr/bin/env node | ||
// npx tsc -p core/tsconfig.json --noEmit | ./scripts/typecheck-formatter.js | ||
|
||
import chalk from 'chalk'; | ||
|
||
const filterOut = [ | ||
`Cannot find name 'globals'.`, | ||
`Property 'body' does not exist on type 'Request'.`, | ||
`has not been built from source file`, | ||
]; | ||
|
||
let rawInput = ''; | ||
process.stdin.on('data', (data) => { | ||
rawInput += data.toString('utf8'); | ||
}); | ||
process.stdin.on('end', () => { | ||
processInput(rawInput.trim()); | ||
}); | ||
|
||
|
||
function processInput(rawInput) { | ||
let errorCount = 0; | ||
const allLines = rawInput.split('\n'); | ||
const filtered = allLines | ||
.filter(errorLine => errorLine.includes('error TS')) | ||
.filter(errorLine => !filterOut.some(filter => errorLine.includes(filter))); | ||
for (const errorLine of filtered) { | ||
// console.log(errorLine); | ||
const [file, tsError, desc] = errorLine.split(': ', 3); | ||
|
||
if (tsError) { | ||
errorCount++; | ||
console.log(chalk.yellow(file)); | ||
console.log(`\t${chalk.red(desc)}`); | ||
} else { | ||
console.log(`\t${chalk.red(errorLine)}`); | ||
} | ||
} | ||
console.log('==========================='); | ||
console.log('errorCount', errorCount); | ||
} |