import colors from 'colors' import { spawn } from 'node:child_process' export const Lint = async () => { console.info(colors.green('\n Run Lint on all files in the API folder \n\n')) let errorLength = 0 try { const test = spawn( 'eslint', [ './API/**', '--no-error-on-unmatched-pattern', ], { shell: true, }, ) test.stdout.on('data', (data) => { errorLength += 1 console.info(`${data}`) }) test.stderr.on('data', (data) => { errorLength += 1 console.error(`${data}`) }) test.on('close', (code) => { if (errorLength === 0) { console.info(colors.green('\n No Linting errors. Nice work! \n\n')) } if (code !== 0) { console.info(`Something went wrong.. Exit code: ${code}`) } }) } catch (error) { console.info('Error in LINT', error) } } export default Lint