Skip to content

Commit 9de62f9

Browse files
committed
lint fix
1 parent ebbfb8a commit 9de62f9

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

scripts/remove_sentry_domain.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ function isInCommentBlock(lines, currentIndex) {
8686
function processMdxFile(filePath, dryRun = false) {
8787
try {
8888
const content = fs.readFileSync(filePath, 'utf8');
89-
const originalContent = content;
9089
const lines = content.split('\n');
9190
const modifiedLines = [];
9291
let replacements = 0;
@@ -117,10 +116,11 @@ function processMdxFile(filePath, dryRun = false) {
117116
// Reset regex state for each line
118117
urlPattern.lastIndex = 0;
119118

120-
while ((match = urlPattern.exec(line)) !== null) {
119+
match = urlPattern.exec(line);
120+
while (match !== null) {
121121
const fullUrl = match[0];
122-
const path = match[1];
123-
const newUrl = path;
122+
const urlPath = match[1];
123+
const newUrl = urlPath;
124124

125125
// Replace the URL
126126
newLine = newLine.replace(fullUrl, newUrl);
@@ -129,6 +129,8 @@ function processMdxFile(filePath, dryRun = false) {
129129
if (dryRun) {
130130
console.log(` Would replace: ${fullUrl} -> ${newUrl}`);
131131
}
132+
133+
match = urlPattern.exec(line);
132134
}
133135

134136
modifiedLines.push(newLine);
@@ -168,27 +170,27 @@ function processMdxFile(filePath, dryRun = false) {
168170
function findMdxFiles(folders) {
169171
const mdxFiles = [];
170172

173+
function walkDir(dir) {
174+
const files = fs.readdirSync(dir);
175+
176+
for (const file of files) {
177+
const filePath = path.join(dir, file);
178+
const stat = fs.statSync(filePath);
179+
180+
if (stat.isDirectory()) {
181+
walkDir(filePath);
182+
} else if (file.endsWith('.mdx')) {
183+
mdxFiles.push(filePath);
184+
}
185+
}
186+
}
187+
171188
for (const folder of folders) {
172189
if (!fs.existsSync(folder)) {
173190
console.log(`Warning: Folder ${folder} does not exist`);
174191
continue;
175192
}
176193

177-
function walkDir(dir) {
178-
const files = fs.readdirSync(dir);
179-
180-
for (const file of files) {
181-
const filePath = path.join(dir, file);
182-
const stat = fs.statSync(filePath);
183-
184-
if (stat.isDirectory()) {
185-
walkDir(filePath);
186-
} else if (file.endsWith('.mdx')) {
187-
mdxFiles.push(filePath);
188-
}
189-
}
190-
}
191-
192194
walkDir(folder);
193195
}
194196

0 commit comments

Comments
 (0)