-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfix_lints.py
More file actions
23 lines (18 loc) · 831 Bytes
/
fix_lints.py
File metadata and controls
23 lines (18 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import re
dir_path = 'public/landing-scripts'
for filename in os.listdir(dir_path):
if not filename.endswith('.js'):
continue
filepath = os.path.join(dir_path, filename)
with open(filepath, 'r') as f:
content = f.read()
# noEmptyBlockStatements
content = content.replace('.catch(() => {});', '.catch(() => { /* ignore */ });')
# forEach with simple arrow function: `items.forEach((item) => {`
# Replace simple patterns where we can
# Note: Regex replacing forEach is tricky, let's try a simpler approach if possible
# Also for loop: `for (let i = 0; i < stepCards.length; i++) { stepCards[i]...`
# We can just write a quick biome configuration ignore or override if we are really stuck.
with open(filepath, 'w') as f:
f.write(content)