-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_eslint.js
More file actions
31 lines (27 loc) · 1.13 KB
/
fix_eslint.js
File metadata and controls
31 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const fs = require('fs');
// Fix apostrophes and quotes in files
const files = [
'src/app/page.tsx',
'src/app/dashboard/page.tsx'
];
files.forEach(file => {
if (fs.existsSync(file)) {
let content = fs.readFileSync(file, 'utf8');
// Replace unescaped apostrophes and quotes in JSX
content = content.replace(/([^\\])'([^s])/g, '$1'$2');
content = content.replace(/([^\\])"([^>])/g, '$1"$2');
content = content.replace(/Don't/g, 'Don't');
content = content.replace(/child's/g, 'child's');
content = content.replace(/Your Child's/g, 'Your Child's');
content = content.replace(/children's/g, 'children's');
content = content.replace(/Let's/g, 'Let's');
content = content.replace(/they're/g, 'they're');
content = content.replace(/you're/g, 'you're');
content = content.replace(/we're/g, 'we're');
content = content.replace(/it's/g, 'it's');
content = content.replace(/that's/g, 'that's');
content = content.replace(/what's/g, 'what's');
fs.writeFileSync(file, content);
console.log(`Fixed ${file}`);
}
});