table-to-excel-react
Version:
Export table data to Excel file using ReactJS
36 lines (28 loc) ⢠1.04 kB
JavaScript
/**
* This script formats all source files using Prettier and ESLint
*/
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
// Get the project root directory
const rootDir = path.resolve(__dirname);
console.log('š Starting code formatting process...');
try {
// Run Prettier on all source files
console.log('\nš Running Prettier on source files...');
execSync('npx prettier --write "src/**/*.{ts,tsx,js,jsx,json,md}"', {
cwd: rootDir,
stdio: 'inherit',
});
// Run ESLint with auto-fix (--max-warnings=9999 to ignore warnings)
console.log('\nš ļø Running ESLint with auto-fix...');
execSync('npx eslint --config eslint.config.js src --ext .ts,.tsx --fix --max-warnings=9999', {
cwd: rootDir,
stdio: 'inherit',
});
console.log('\nā
Code formatting completed successfully!');
} catch (error) {
console.error('\nā Error during code formatting:', error.message);
process.exit(1);
}