chore: standardised the eslint config structure accross the project (#11814)

This commit is contained in:
Mridang Agarwalla
2026-03-12 11:02:52 +01:00
committed by GitHub
parent 621fd9bdec
commit 7cdee1703f
61 changed files with 1025 additions and 2011 deletions
@@ -10,7 +10,6 @@ register('fumadocs-mdx/node/loader', import.meta.url);
import {
type FileObject,
printErrors,
scanURLs,
validateFiles,
} from 'next-validate-link';
@@ -1,6 +1,5 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import yaml from 'js-yaml';
const V1_BASE_PATHS: Record<string, string> = {
'admin.openapi.json': '/admin/v1',
+1 -1
View File
@@ -32,7 +32,7 @@ async function run() {
}
// Versioned content and protos
const cleanVersioned = (dir, pattern) => {
const cleanVersioned = (dir) => {
if (!fs.existsSync(dir)) return;
const files = fs.readdirSync(dir);
for (const file of files) {
+6 -6
View File
@@ -71,7 +71,7 @@ function getCurrentRef() {
cachedRef = branch;
return cachedRef;
}
} catch (e) {
} catch {
// Ignore git errors
}
console.log(`[ref] Defaulting to ${FALLBACK_BRANCH}`);
@@ -143,7 +143,7 @@ function copyDirectorySafely(src, dest) {
if (versionDirPattern.test(item) && fs.statSync(join(src, item)).isDirectory()) {
isVersionDir = true;
}
} catch (e) {
} catch {
// Ignore stat errors
}
@@ -281,7 +281,7 @@ async function downloadFileContent(tagOrBranch, repoPath) {
let decodedRepoPath;
try {
decodedRepoPath = decodeURIComponent(repoPath.replace(/\\/g, '/'));
} catch (e) {
} catch {
// If decoding fails (malformed escape sequences), fall back to original
decodedRepoPath = repoPath;
}
@@ -370,7 +370,7 @@ async function fixRelativeImports(versionDir, tagOrBranch) {
});
// 2. Markdown Images: ![alt](src)
const mdImgRegex = /(!\[.*?\]\()([^\)]+)(\))/g;
const mdImgRegex = /(!\[.*?\]\()([^)]+)(\))/g;
content = content.replace(mdImgRegex, (match, p1, p2, p3) => {
if (!p2.startsWith('.')) return match;
const rewritten = rewritePath(filePath, p2);
@@ -452,7 +452,7 @@ function getLocalVersion() {
if (!branch) {
try {
branch = execSync('git branch --show-current').toString().trim();
} catch (e) {}
} catch { /* ignore git errors */ }
}
if (branch && branch !== 'main' && branch !== 'master') {
@@ -467,7 +467,7 @@ function getLocalVersion() {
if (semver.valid(tag) && semver.gt(tag, CUTOFF)) {
return { label: tag, isUnreleased: false };
}
} catch (e) { }
} catch { /* ignore git errors */ }
return { label: 'v4.11.0', isUnreleased: true };
}
@@ -4,7 +4,6 @@ import { writeFileSync, mkdirSync, readdirSync, lstatSync, readFileSync, existsS
import path, { join, dirname, basename } from 'path';
import { fileURLToPath } from 'url';
import { glob } from 'glob';
import yaml from 'js-yaml';
// Suppress "Generated: ..." logs to avoid Vercel log limits
const originalLog = console.log;
@@ -147,7 +146,7 @@ async function fixAllGeneratedLinks() {
const versionMap = fileIndex.get(version);
// [Text](apis/resources/service_name/file_name.api.mdx)
const linkRegex = /\[([^\]]+)\]\(([\/]?apis\/resources\/([^\/]+)\/([^\/)]+)\.api\.mdx)\)/g;
const linkRegex = /\[([^\]]+)\]\(([/]?apis\/resources\/([^/]+)\/([^/)]+)\.api\.mdx)\)/g;
let modified = false;
let newContent = content.replace(linkRegex, (match, text, fullLink, serviceSlug, fileSlug) => {
@@ -178,7 +177,7 @@ async function fixAllGeneratedLinks() {
// Fix v2beta links that were likely in the source proto comments
// and also remove potential double /docs prefixing from source comments
const internalLinkRegex = /\[([^\]]+)\]\(([\/]?docs\/)?reference\/api\/([^\/]+)\/([^\s)]+)\)/g;
const internalLinkRegex = /\[([^\]]+)\]\(([/]?docs\/)?reference\/api\/([^/]+)\/([^\s)]+)\)/g;
newContent = newContent.replace(internalLinkRegex, (match, text, docsPrefix, service, fileSlug) => {
let targetFileSlug = fileSlug;
let isV2Beta = fileSlug.includes('.v2beta.');
@@ -87,6 +87,7 @@ async function run() {
// Use spawn (async) instead of spawnSync to avoid blocking the event loop
// eslint-disable-next-line no-async-promise-executor
await new Promise(async (resolvePromise, rejectPromise) => {
// Dynamic discovery of excluded paths
const getExcludedPaths = async () => {
-4
View File
@@ -43,10 +43,6 @@ walk(CONTENT_DIR, (filepath) => {
// Replaces /docs/img/ -> correctPrefix + img/
// Replaces /docs/vX.Y/ -> correctPrefix + vX.Y/
const PUBLIC_PREFIX = '/docs/img/';
const VERSION_PREFIXES = ['/docs/v4.10/', '/docs/v4.9/', '/docs/v4.8/'];
const TARGET_PATHS = [PUBLIC_PREFIX, ...VERSION_PREFIXES];
// Pattern: (!\[.*?\]\(|src=["'])(/docs/(?:img|v\d+\.\d+)/.*?)(\)|["'])
const pattern = /(!\[.*?\]\(|src=["'])\/docs\/((?:img|v\d+\.\d+)\/.*?)(\)|["'])/g;
-2
View File
@@ -1,5 +1,4 @@
import fs from 'fs';
import path from 'path';
const REDIRECTS_PATH = '/home/ffo/git/zitadel/zitadel/apps/docs/redirects.json';
@@ -37,7 +36,6 @@ function validateRedirects() {
});
// 2. Circular & Chains
const checked = new Set();
sources.forEach((value, source) => {
let currentSource = source;
const path = [currentSource];