mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
Enable ESLint no-require-imports rule
This commit is contained in:
parent
65e331ae26
commit
e1e57f2cfd
@ -24,7 +24,6 @@ export default defineConfig(
|
|||||||
"@typescript-eslint/ban-ts-comment": "off", // Temporarily disabled until codebase conformant
|
"@typescript-eslint/ban-ts-comment": "off", // Temporarily disabled until codebase conformant
|
||||||
"@typescript-eslint/no-empty-object-type": "off", // Temporarily disabled until codebase conformant
|
"@typescript-eslint/no-empty-object-type": "off", // Temporarily disabled until codebase conformant
|
||||||
"@typescript-eslint/no-explicit-any": "off", // Temporarily disabled until codebase conformant
|
"@typescript-eslint/no-explicit-any": "off", // Temporarily disabled until codebase conformant
|
||||||
"@typescript-eslint/no-require-imports": "off", // Temporarily disabled until codebase conformant
|
|
||||||
"@typescript-eslint/no-unused-expressions": "off", // Temporarily disabled until codebase conformant
|
"@typescript-eslint/no-unused-expressions": "off", // Temporarily disabled until codebase conformant
|
||||||
"@typescript-eslint/no-unused-vars": "off", // Temporarily disabled until codebase conformant
|
"@typescript-eslint/no-unused-vars": "off", // Temporarily disabled until codebase conformant
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
|
import postcss from '@tailwindcss/postcss';
|
||||||
|
import autoprefixer from 'autoprefixer';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
require('@tailwindcss/postcss'),
|
postcss,
|
||||||
require('autoprefixer'),
|
autoprefixer,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const { icons } = require('@iconify-json/material-symbols');
|
import { icons } from '@iconify-json/material-symbols';
|
||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
|
|
||||||
// Check for verbose flag
|
// Check for verbose flag
|
||||||
const isVerbose = process.argv.includes('--verbose') || process.argv.includes('-v');
|
const isVerbose = process.argv.includes('--verbose') || process.argv.includes('-v');
|
||||||
@ -19,27 +19,27 @@ const debug = (message) => {
|
|||||||
function scanForUsedIcons() {
|
function scanForUsedIcons() {
|
||||||
const usedIcons = new Set();
|
const usedIcons = new Set();
|
||||||
const srcDir = path.join(__dirname, '..', 'src');
|
const srcDir = path.join(__dirname, '..', 'src');
|
||||||
|
|
||||||
info('🔍 Scanning codebase for LocalIcon usage...');
|
info('🔍 Scanning codebase for LocalIcon usage...');
|
||||||
|
|
||||||
if (!fs.existsSync(srcDir)) {
|
if (!fs.existsSync(srcDir)) {
|
||||||
console.error('❌ Source directory not found:', srcDir);
|
console.error('❌ Source directory not found:', srcDir);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursively scan all .tsx and .ts files
|
// Recursively scan all .tsx and .ts files
|
||||||
function scanDirectory(dir) {
|
function scanDirectory(dir) {
|
||||||
const files = fs.readdirSync(dir);
|
const files = fs.readdirSync(dir);
|
||||||
|
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
const filePath = path.join(dir, file);
|
const filePath = path.join(dir, file);
|
||||||
const stat = fs.statSync(filePath);
|
const stat = fs.statSync(filePath);
|
||||||
|
|
||||||
if (stat.isDirectory()) {
|
if (stat.isDirectory()) {
|
||||||
scanDirectory(filePath);
|
scanDirectory(filePath);
|
||||||
} else if (file.endsWith('.tsx') || file.endsWith('.ts')) {
|
} else if (file.endsWith('.tsx') || file.endsWith('.ts')) {
|
||||||
const content = fs.readFileSync(filePath, 'utf8');
|
const content = fs.readFileSync(filePath, 'utf8');
|
||||||
|
|
||||||
// Match LocalIcon usage: <LocalIcon icon="icon-name" ...>
|
// Match LocalIcon usage: <LocalIcon icon="icon-name" ...>
|
||||||
const localIconMatches = content.match(/<LocalIcon\s+[^>]*icon="([^"]+)"/g);
|
const localIconMatches = content.match(/<LocalIcon\s+[^>]*icon="([^"]+)"/g);
|
||||||
if (localIconMatches) {
|
if (localIconMatches) {
|
||||||
@ -51,7 +51,7 @@ function scanForUsedIcons() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match old material-symbols-rounded spans: <span className="material-symbols-rounded">icon-name</span>
|
// Match old material-symbols-rounded spans: <span className="material-symbols-rounded">icon-name</span>
|
||||||
const spanMatches = content.match(/<span[^>]*className="[^"]*material-symbols-rounded[^"]*"[^>]*>([^<]+)<\/span>/g);
|
const spanMatches = content.match(/<span[^>]*className="[^"]*material-symbols-rounded[^"]*"[^>]*>([^<]+)<\/span>/g);
|
||||||
if (spanMatches) {
|
if (spanMatches) {
|
||||||
@ -64,7 +64,7 @@ function scanForUsedIcons() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match Icon component usage: <Icon icon="material-symbols:icon-name" ...>
|
// Match Icon component usage: <Icon icon="material-symbols:icon-name" ...>
|
||||||
const iconMatches = content.match(/<Icon\s+[^>]*icon="material-symbols:([^"]+)"/g);
|
const iconMatches = content.match(/<Icon\s+[^>]*icon="material-symbols:([^"]+)"/g);
|
||||||
if (iconMatches) {
|
if (iconMatches) {
|
||||||
@ -79,12 +79,12 @@ function scanForUsedIcons() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
scanDirectory(srcDir);
|
scanDirectory(srcDir);
|
||||||
|
|
||||||
const iconArray = Array.from(usedIcons).sort();
|
const iconArray = Array.from(usedIcons).sort();
|
||||||
info(`📋 Found ${iconArray.length} unique icons across codebase`);
|
info(`📋 Found ${iconArray.length} unique icons across codebase`);
|
||||||
|
|
||||||
return iconArray;
|
return iconArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ async function main() {
|
|||||||
const existingSet = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
|
const existingSet = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
|
||||||
const existingIcons = Object.keys(existingSet.icons || {}).sort();
|
const existingIcons = Object.keys(existingSet.icons || {}).sort();
|
||||||
const currentIcons = [...usedIcons].sort();
|
const currentIcons = [...usedIcons].sort();
|
||||||
|
|
||||||
if (JSON.stringify(existingIcons) === JSON.stringify(currentIcons)) {
|
if (JSON.stringify(existingIcons) === JSON.stringify(currentIcons)) {
|
||||||
needsRegeneration = false;
|
needsRegeneration = false;
|
||||||
info(`✅ Icon set already up-to-date (${usedIcons.length} icons, ${Math.round(fs.statSync(outputPath).size / 1024)}KB)`);
|
info(`✅ Icon set already up-to-date (${usedIcons.length} icons, ${Math.round(fs.statSync(outputPath).size / 1024)}KB)`);
|
||||||
@ -122,7 +122,7 @@ async function main() {
|
|||||||
|
|
||||||
// Dynamic import of ES module
|
// Dynamic import of ES module
|
||||||
const { getIcons } = await import('@iconify/utils');
|
const { getIcons } = await import('@iconify/utils');
|
||||||
|
|
||||||
// Extract only our used icons from the full set
|
// Extract only our used icons from the full set
|
||||||
const extractedIcons = getIcons(icons, usedIcons);
|
const extractedIcons = getIcons(icons, usedIcons);
|
||||||
|
|
||||||
@ -183,4 +183,4 @@ export default iconSet;
|
|||||||
main().catch(error => {
|
main().catch(error => {
|
||||||
console.error('❌ Script failed:', error);
|
console.error('❌ Script failed:', error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const { execSync } = require('child_process');
|
import { execSync } from 'child_process';
|
||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate 3rd party licenses for frontend dependencies
|
* Generate 3rd party licenses for frontend dependencies
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
conversionDiscovery,
|
conversionDiscovery,
|
||||||
type ConversionEndpoint
|
type ConversionEndpoint
|
||||||
} from '../helpers/conversionEndpointDiscovery';
|
} from '../helpers/conversionEndpointDiscovery';
|
||||||
import * as path from 'path';
|
import path from 'path';
|
||||||
import * as fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
// Test configuration
|
// Test configuration
|
||||||
const BASE_URL = process.env.BASE_URL || 'http://localhost:5173';
|
const BASE_URL = process.env.BASE_URL || 'http://localhost:5173';
|
||||||
@ -239,7 +239,6 @@ async function testConversion(page: Page, conversion: ConversionEndpoint) {
|
|||||||
// Save and verify file is not empty
|
// Save and verify file is not empty
|
||||||
const path = await download.path();
|
const path = await download.path();
|
||||||
if (path) {
|
if (path) {
|
||||||
const fs = require('fs');
|
|
||||||
const stats = fs.statSync(path);
|
const stats = fs.statSync(path);
|
||||||
expect(stats.size).toBeGreaterThan(0);
|
expect(stats.size).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user