Fix ESLint errors for successful deployment
- Fixed mixed operators in contentExtractor.js with proper parentheses - Removed unused variables and imports across all components - Fixed useCallback dependencies in ObjectEditor.js - Corrected == to === comparisons in TableEditor.js - Fixed undefined variable references - Wrapped serializeToPhp in useCallback to resolve dependency warning - Updated table column width styling from min-w to w for consistent layout Build now passes successfully with only non-blocking warnings remaining.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import React, { useState, useRef, useCallback } from 'react';
|
import React, { useState, useRef, useCallback } from 'react';
|
||||||
import { Edit3, Upload, FileText, Workflow, Table, Globe, Plus, AlertTriangle, BrushCleaning, Code, Braces, Download } from 'lucide-react';
|
import { Upload, FileText, Workflow, Table, Globe, Plus, AlertTriangle, BrushCleaning, Code, Braces, Download, Edit3 } from 'lucide-react';
|
||||||
import ToolLayout from '../components/ToolLayout';
|
import ToolLayout from '../components/ToolLayout';
|
||||||
import CopyButton from '../components/CopyButton';
|
|
||||||
import StructuredEditor from '../components/StructuredEditor';
|
import StructuredEditor from '../components/StructuredEditor';
|
||||||
import MindmapView from '../components/MindmapView';
|
import MindmapView from '../components/MindmapView';
|
||||||
import PostmanTable from '../components/PostmanTable';
|
import PostmanTable from '../components/PostmanTable';
|
||||||
@@ -102,10 +101,6 @@ const ObjectEditor = () => {
|
|||||||
setCreateNewCompleted(false);
|
setCreateNewCompleted(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create initial empty object with one property
|
|
||||||
const createInitialEmptyObject = () => {
|
|
||||||
return { "": "" };
|
|
||||||
};
|
|
||||||
|
|
||||||
// Confirm input method change and clear data
|
// Confirm input method change and clear data
|
||||||
const confirmInputChange = () => {
|
const confirmInputChange = () => {
|
||||||
@@ -390,7 +385,7 @@ const ObjectEditor = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Simple PHP serialization function
|
// Simple PHP serialization function
|
||||||
const serializeToPhp = (data) => {
|
const serializeToPhp = useCallback((data) => {
|
||||||
if (data === null) return 'N;';
|
if (data === null) return 'N;';
|
||||||
if (data === undefined) return 'N;';
|
if (data === undefined) return 'N;';
|
||||||
if (typeof data === 'boolean') return data ? 'b:1;' : 'b:0;';
|
if (typeof data === 'boolean') return data ? 'b:1;' : 'b:0;';
|
||||||
@@ -418,7 +413,7 @@ const ObjectEditor = () => {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return 'N;';
|
return 'N;';
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
// Generate output formats
|
// Generate output formats
|
||||||
const generateOutputs = useCallback((data) => {
|
const generateOutputs = useCallback((data) => {
|
||||||
@@ -452,7 +447,7 @@ const ObjectEditor = () => {
|
|||||||
serialized: 'Error generating PHP serialized data'
|
serialized: 'Error generating PHP serialized data'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, []);
|
}, [serializeToPhp]);
|
||||||
|
|
||||||
// Handle file import
|
// Handle file import
|
||||||
const handleFileImport = (event) => {
|
const handleFileImport = (event) => {
|
||||||
@@ -469,50 +464,6 @@ const ObjectEditor = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load sample data
|
|
||||||
const loadSample = () => {
|
|
||||||
const sample = {
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "John Doe",
|
|
||||||
"email": "john@example.com",
|
|
||||||
"age": 30,
|
|
||||||
"role": "admin",
|
|
||||||
"active": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"name": "Jane Smith",
|
|
||||||
"email": "jane@example.com",
|
|
||||||
"age": 28,
|
|
||||||
"role": "user",
|
|
||||||
"active": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"name": "Bob Wilson",
|
|
||||||
"email": "bob@example.com",
|
|
||||||
"age": 35,
|
|
||||||
"role": "moderator",
|
|
||||||
"active": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"settings": {
|
|
||||||
"theme": "dark",
|
|
||||||
"language": "en",
|
|
||||||
"timezone": "UTC",
|
|
||||||
"features": {
|
|
||||||
"notifications": true,
|
|
||||||
"darkMode": true,
|
|
||||||
"autoSave": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": ["developer", "javascript", "react", "nodejs"]
|
|
||||||
};
|
|
||||||
setStructuredData(sample);
|
|
||||||
generateOutputs(sample);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Fetch data from URL
|
// Fetch data from URL
|
||||||
const handleFetchData = async () => {
|
const handleFetchData = async () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
Database,
|
Database,
|
||||||
@@ -7,13 +7,10 @@ import {
|
|||||||
FileText,
|
FileText,
|
||||||
Search,
|
Search,
|
||||||
Plus,
|
Plus,
|
||||||
Minus,
|
|
||||||
X,
|
X,
|
||||||
Edit,
|
|
||||||
Braces,
|
Braces,
|
||||||
Code,
|
Code,
|
||||||
Eye,
|
Eye,
|
||||||
Columns,
|
|
||||||
Trash2,
|
Trash2,
|
||||||
ArrowUpDown,
|
ArrowUpDown,
|
||||||
Edit3,
|
Edit3,
|
||||||
@@ -51,7 +48,6 @@ const TableEditor = () => {
|
|||||||
const [availableTables, setAvailableTables] = useState([]); // List of discovered table names
|
const [availableTables, setAvailableTables] = useState([]); // List of discovered table names
|
||||||
const [currentTable, setCurrentTable] = useState(""); // Currently active table name
|
const [currentTable, setCurrentTable] = useState(""); // Currently active table name
|
||||||
const [originalFileName, setOriginalFileName] = useState(""); // For export naming
|
const [originalFileName, setOriginalFileName] = useState(""); // For export naming
|
||||||
const [editingTableName, setEditingTableName] = useState(false); // For single table name editing
|
|
||||||
const [isTableFullscreen, setIsTableFullscreen] = useState(false); // For fullscreen table view
|
const [isTableFullscreen, setIsTableFullscreen] = useState(false); // For fullscreen table view
|
||||||
const [frozenColumns, setFrozenColumns] = useState(0); // Number of columns to freeze on horizontal scroll
|
const [frozenColumns, setFrozenColumns] = useState(0); // Number of columns to freeze on horizontal scroll
|
||||||
const [showClearConfirmModal, setShowClearConfirmModal] = useState(false); // For clear confirmation modal
|
const [showClearConfirmModal, setShowClearConfirmModal] = useState(false); // For clear confirmation modal
|
||||||
@@ -174,10 +170,10 @@ const TableEditor = () => {
|
|||||||
const expected = expectedSampleData[index];
|
const expected = expectedSampleData[index];
|
||||||
return (
|
return (
|
||||||
expected &&
|
expected &&
|
||||||
row.col_0 == expected.id &&
|
row.col_0 === expected.id &&
|
||||||
row.col_1 === expected.name &&
|
row.col_1 === expected.name &&
|
||||||
row.col_2 === expected.email &&
|
row.col_2 === expected.email &&
|
||||||
row.col_3 == expected.age &&
|
row.col_3 === expected.age &&
|
||||||
row.col_4 === expected.city
|
row.col_4 === expected.city
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -646,7 +642,6 @@ const TableEditor = () => {
|
|||||||
|
|
||||||
// Open Object Editor modal for structured data
|
// Open Object Editor modal for structured data
|
||||||
const openObjectEditor = (rowId, columnId, value, format) => {
|
const openObjectEditor = (rowId, columnId, value, format) => {
|
||||||
const row = data.find((r) => r.id === rowId);
|
|
||||||
const column = columns.find((c) => c.id === columnId);
|
const column = columns.find((c) => c.id === columnId);
|
||||||
|
|
||||||
// Value should already be properly unescaped by the SQL parser
|
// Value should already be properly unescaped by the SQL parser
|
||||||
@@ -793,7 +788,6 @@ const TableEditor = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableName = tableMatch[1];
|
|
||||||
const columnsPart = tableMatch[2];
|
const columnsPart = tableMatch[2];
|
||||||
|
|
||||||
// Parse column names
|
// Parse column names
|
||||||
@@ -1619,7 +1613,7 @@ const TableEditor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Phone detection (basic)
|
// Phone detection (basic)
|
||||||
if (/^[\+\d\s\-\(\)]{10,}$/.test(strVal)) {
|
if (/^[+\d\s\-()]{10,}$/.test(strVal)) {
|
||||||
hasPhone = true;
|
hasPhone = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1835,7 +1829,6 @@ const TableEditor = () => {
|
|||||||
setAvailableTables([]);
|
setAvailableTables([]);
|
||||||
setCurrentTable("");
|
setCurrentTable("");
|
||||||
setOriginalFileName("");
|
setOriginalFileName("");
|
||||||
setEditingTableName(false);
|
|
||||||
setFrozenColumns(0);
|
setFrozenColumns(0);
|
||||||
|
|
||||||
// Close modal
|
// Close modal
|
||||||
@@ -2141,7 +2134,7 @@ const TableEditor = () => {
|
|||||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2">
|
<h3 className="text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2">
|
||||||
{availableTables.length > 1 ? "Multi-Table Database" : "Table Editor"}
|
{availableTables.length > 1 ? "Multi-Table Database" : "Table Editor"}
|
||||||
</h3>
|
</h3>
|
||||||
{availableTables.length == 1 && (
|
{availableTables.length === 1 && (
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400">
|
<p className="text-sm text-gray-600 dark:text-gray-400">
|
||||||
{data.length} rows, {columns.length} columns
|
{data.length} rows, {columns.length} columns
|
||||||
</p>
|
</p>
|
||||||
@@ -2398,7 +2391,7 @@ const TableEditor = () => {
|
|||||||
})}
|
})}
|
||||||
|
|
||||||
{/* System Column - Add Column */}
|
{/* System Column - Add Column */}
|
||||||
<th className="px-4 py-3 text-center border-l-2 border-dashed border-gray-300 dark:border-gray-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 min-w-[60px]">
|
<th className="px-4 py-3 text-center border-l-2 border-dashed border-gray-300 dark:border-gray-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 w-[60px]">
|
||||||
<button
|
<button
|
||||||
onClick={addColumn}
|
onClick={addColumn}
|
||||||
className="flex items-center justify-center text-gray-500 hover:text-blue-600 p-2 rounded-lg transition-colors group"
|
className="flex items-center justify-center text-gray-500 hover:text-blue-600 p-2 rounded-lg transition-colors group"
|
||||||
@@ -2576,7 +2569,7 @@ const TableEditor = () => {
|
|||||||
})}
|
})}
|
||||||
|
|
||||||
{/* Empty cell for system column alignment */}
|
{/* Empty cell for system column alignment */}
|
||||||
<td className="px-4 py-3 border-l-2 border-dashed border-gray-300 dark:border-gray-600 min-w-[60px]">
|
<td className="px-4 py-3 border-l-2 border-dashed border-gray-300 dark:border-gray-600 w-[60px]">
|
||||||
{/* Empty cell to align with system column header */}
|
{/* Empty cell to align with system column header */}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Type, Copy, RotateCcw, Globe, Download, AlertCircle, CheckCircle, Clock, X } from 'lucide-react';
|
import { Type, Copy, RotateCcw, Globe, Download, AlertCircle, Clock, X } from 'lucide-react';
|
||||||
import ToolLayout from '../components/ToolLayout';
|
import ToolLayout from '../components/ToolLayout';
|
||||||
import CopyButton from '../components/CopyButton';
|
import CopyButton from '../components/CopyButton';
|
||||||
import { extractContentFromUrl, CONTENT_TYPE_INFO } from '../utils/contentExtractor';
|
import { extractContentFromUrl, CONTENT_TYPE_INFO } from '../utils/contentExtractor';
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export const detectArticleStructure = (doc) => {
|
|||||||
// Check meta tags for articles
|
// Check meta tags for articles
|
||||||
const metaTags = doc.querySelectorAll('meta[property^="og:"], meta[name^="article:"]');
|
const metaTags = doc.querySelectorAll('meta[property^="og:"], meta[name^="article:"]');
|
||||||
structure.hasMetaArticle = Array.from(metaTags).some(meta =>
|
structure.hasMetaArticle = Array.from(metaTags).some(meta =>
|
||||||
meta.getAttribute('property') === 'og:type' && meta.getAttribute('content') === 'article' ||
|
(meta.getAttribute('property') === 'og:type' && meta.getAttribute('content') === 'article') ||
|
||||||
meta.getAttribute('name')?.startsWith('article:')
|
meta.getAttribute('name')?.startsWith('article:')
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ export const classifyContent = (structure, metrics, articleText) => {
|
|||||||
export const extractContentFromUrl = async (url) => {
|
export const extractContentFromUrl = async (url) => {
|
||||||
try {
|
try {
|
||||||
// Fetch content
|
// Fetch content
|
||||||
const { html, url: finalUrl, contentType } = await fetchUrlContent(url);
|
const { html, url: finalUrl } = await fetchUrlContent(url);
|
||||||
|
|
||||||
// Parse HTML
|
// Parse HTML
|
||||||
const doc = parseHtml(html);
|
const doc = parseHtml(html);
|
||||||
|
|||||||
Reference in New Issue
Block a user