Last active
November 17, 2022 23:38
-
-
Save mikeerickson/fcdcf33f89f57c3e0cecba574e1126bb to your computer and use it in GitHub Desktop.
script to execute linter and use pretty output
This file contains hidden or 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
#!/usr/bin/env node | |
const execa = require('execa'); | |
const msg = require('@codedungeon/messenger'); | |
const findMatches = (str = '', findStr = '') => { | |
const re = new RegExp(findStr, 'g'); | |
return str.match(re); | |
}; | |
execa('npx', ['eslint', '.'], { env: { FORCE_COLOR: 'true' } }) | |
.then((data) => { | |
if (data.stdout.length === 0) { | |
console.log(''); | |
msg.success('No linting errors found', 'SUCCESS'); | |
} else { | |
console.log(data.stdout); | |
} | |
}) | |
.catch((data) => { | |
console.log(data.stdout); | |
// msg.error('An error occurred executing linter', 'ERROR'); | |
console.log(''); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment