mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
chore: application prettier
This commit is contained in:
@ -29,7 +29,7 @@ const TAILWIND_PATTERNS = [
|
||||
// États
|
||||
/^(hover|focus|active|disabled|group|dark):/,
|
||||
// Couleurs
|
||||
/-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-[0-9]+$/
|
||||
/-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-[0-9]+$/,
|
||||
];
|
||||
|
||||
// Nouveaux patterns pour ignorer les logs et imports
|
||||
@ -58,7 +58,7 @@ function isHardcodedString(str) {
|
||||
|
||||
// Vérifier si la chaîne fait partie d'un console.log ou d'un import
|
||||
const context = str.trim();
|
||||
if (CODE_PATTERNS.some(pattern => pattern.test(context))) {
|
||||
if (CODE_PATTERNS.some((pattern) => pattern.test(context))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -68,19 +68,20 @@ function isHardcodedString(str) {
|
||||
}
|
||||
|
||||
// Vérifier si c'est une chaîne dans un import
|
||||
if (context.includes('from \'') || context.includes('from "')) {
|
||||
if (context.includes("from '") || context.includes('from "')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vérifier si c'est une classe Tailwind
|
||||
const classes = str.split(' ');
|
||||
if (classes.some(cls =>
|
||||
TAILWIND_PATTERNS.some(pattern => pattern.test(cls))
|
||||
)) {
|
||||
if (
|
||||
classes.some((cls) =>
|
||||
TAILWIND_PATTERNS.some((pattern) => pattern.test(cls))
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Autres patterns à ignorer
|
||||
const IGNORE_PATTERNS = [
|
||||
/^[A-Z][A-Za-z]+$/, // Noms de composants
|
||||
@ -95,7 +96,7 @@ function isHardcodedString(str) {
|
||||
/^className=/, // className attributes
|
||||
];
|
||||
|
||||
return !IGNORE_PATTERNS.some(pattern => pattern.test(str));
|
||||
return !IGNORE_PATTERNS.some((pattern) => pattern.test(str));
|
||||
}
|
||||
|
||||
async function scanFile(filePath) {
|
||||
@ -106,7 +107,7 @@ async function scanFile(filePath) {
|
||||
const ast = babel.parse(content, {
|
||||
sourceType: 'module',
|
||||
plugins: ['jsx', 'typescript'],
|
||||
locations: true // Active le tracking des positions
|
||||
locations: true, // Active le tracking des positions
|
||||
});
|
||||
|
||||
traverse(ast, {
|
||||
@ -140,7 +141,11 @@ async function scanDirectory(dir) {
|
||||
const filePath = path.join(dir, file);
|
||||
const stat = fs.statSync(filePath);
|
||||
|
||||
if (stat.isDirectory() && !file.startsWith('.') && file !== 'node_modules') {
|
||||
if (
|
||||
stat.isDirectory() &&
|
||||
!file.startsWith('.') &&
|
||||
file !== 'node_modules'
|
||||
) {
|
||||
Object.assign(results, await scanDirectory(filePath));
|
||||
} else if (
|
||||
stat.isFile() &&
|
||||
@ -189,4 +194,4 @@ async function main() {
|
||||
await logStringsToFile(results);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
main().catch(console.error);
|
||||
|
||||
Reference in New Issue
Block a user