generated from kuraydev/react-native-typescript-library-starter
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlint.mjs
More file actions
19 lines (16 loc) · 627 Bytes
/
lint.mjs
File metadata and controls
19 lines (16 loc) · 627 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { exec } from 'child_process';
import chalk from 'chalk';
import ora from 'ora';
const spinner = ora(chalk.magenta('Linting code...')).start();
spinner.color = 'magenta';
// Adjust the ESLint command and glob pattern as needed for your project.
exec('npx eslint "lib/**/*.{js,ts,tsx}" --fix', (error, stdout, stderr) => {
// Clear the spinner line before outputting the final message.
process.stdout.write('\r\x1b[K');
if (error) {
spinner.fail(chalk.bgRed(`ESLint error: ${stderr || stdout}`));
process.exit(1);
} else {
spinner.succeed(chalk.magentaBright('Code linted successfully!'));
}
});