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 { 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 CopyButton from '../components/CopyButton';
|
||||
import StructuredEditor from '../components/StructuredEditor';
|
||||
import MindmapView from '../components/MindmapView';
|
||||
import PostmanTable from '../components/PostmanTable';
|
||||
@@ -102,10 +101,6 @@ const ObjectEditor = () => {
|
||||
setCreateNewCompleted(false);
|
||||
};
|
||||
|
||||
// Create initial empty object with one property
|
||||
const createInitialEmptyObject = () => {
|
||||
return { "": "" };
|
||||
};
|
||||
|
||||
// Confirm input method change and clear data
|
||||
const confirmInputChange = () => {
|
||||
@@ -390,7 +385,7 @@ const ObjectEditor = () => {
|
||||
};
|
||||
|
||||
// Simple PHP serialization function
|
||||
const serializeToPhp = (data) => {
|
||||
const serializeToPhp = useCallback((data) => {
|
||||
if (data === null) return 'N;';
|
||||
if (data === undefined) return 'N;';
|
||||
if (typeof data === 'boolean') return data ? 'b:1;' : 'b:0;';
|
||||
@@ -418,7 +413,7 @@ const ObjectEditor = () => {
|
||||
return result;
|
||||
}
|
||||
return 'N;';
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Generate output formats
|
||||
const generateOutputs = useCallback((data) => {
|
||||
@@ -452,7 +447,7 @@ const ObjectEditor = () => {
|
||||
serialized: 'Error generating PHP serialized data'
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
}, [serializeToPhp]);
|
||||
|
||||
// Handle file import
|
||||
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
|
||||
const handleFetchData = async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import React, { useState } from "react";
|
||||
import {
|
||||
Table,
|
||||
Database,
|
||||
@@ -7,13 +7,10 @@ import {
|
||||
FileText,
|
||||
Search,
|
||||
Plus,
|
||||
Minus,
|
||||
X,
|
||||
Edit,
|
||||
Braces,
|
||||
Code,
|
||||
Eye,
|
||||
Columns,
|
||||
Trash2,
|
||||
ArrowUpDown,
|
||||
Edit3,
|
||||
@@ -51,7 +48,6 @@ const TableEditor = () => {
|
||||
const [availableTables, setAvailableTables] = useState([]); // List of discovered table names
|
||||
const [currentTable, setCurrentTable] = useState(""); // Currently active table name
|
||||
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 [frozenColumns, setFrozenColumns] = useState(0); // Number of columns to freeze on horizontal scroll
|
||||
const [showClearConfirmModal, setShowClearConfirmModal] = useState(false); // For clear confirmation modal
|
||||
@@ -174,10 +170,10 @@ const TableEditor = () => {
|
||||
const expected = expectedSampleData[index];
|
||||
return (
|
||||
expected &&
|
||||
row.col_0 == expected.id &&
|
||||
row.col_0 === expected.id &&
|
||||
row.col_1 === expected.name &&
|
||||
row.col_2 === expected.email &&
|
||||
row.col_3 == expected.age &&
|
||||
row.col_3 === expected.age &&
|
||||
row.col_4 === expected.city
|
||||
);
|
||||
});
|
||||
@@ -646,7 +642,6 @@ const TableEditor = () => {
|
||||
|
||||
// Open Object Editor modal for structured data
|
||||
const openObjectEditor = (rowId, columnId, value, format) => {
|
||||
const row = data.find((r) => r.id === rowId);
|
||||
const column = columns.find((c) => c.id === columnId);
|
||||
|
||||
// Value should already be properly unescaped by the SQL parser
|
||||
@@ -793,7 +788,6 @@ const TableEditor = () => {
|
||||
);
|
||||
}
|
||||
|
||||
const tableName = tableMatch[1];
|
||||
const columnsPart = tableMatch[2];
|
||||
|
||||
// Parse column names
|
||||
@@ -1619,7 +1613,7 @@ const TableEditor = () => {
|
||||
}
|
||||
|
||||
// Phone detection (basic)
|
||||
if (/^[\+\d\s\-\(\)]{10,}$/.test(strVal)) {
|
||||
if (/^[+\d\s\-()]{10,}$/.test(strVal)) {
|
||||
hasPhone = true;
|
||||
}
|
||||
});
|
||||
@@ -1835,7 +1829,6 @@ const TableEditor = () => {
|
||||
setAvailableTables([]);
|
||||
setCurrentTable("");
|
||||
setOriginalFileName("");
|
||||
setEditingTableName(false);
|
||||
setFrozenColumns(0);
|
||||
|
||||
// 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">
|
||||
{availableTables.length > 1 ? "Multi-Table Database" : "Table Editor"}
|
||||
</h3>
|
||||
{availableTables.length == 1 && (
|
||||
{availableTables.length === 1 && (
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400">
|
||||
{data.length} rows, {columns.length} columns
|
||||
</p>
|
||||
@@ -2398,7 +2391,7 @@ const TableEditor = () => {
|
||||
})}
|
||||
|
||||
{/* 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
|
||||
onClick={addColumn}
|
||||
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 */}
|
||||
<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 */}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 CopyButton from '../components/CopyButton';
|
||||
import { extractContentFromUrl, CONTENT_TYPE_INFO } from '../utils/contentExtractor';
|
||||
|
||||
@@ -173,7 +173,7 @@ export const detectArticleStructure = (doc) => {
|
||||
// Check meta tags for articles
|
||||
const metaTags = doc.querySelectorAll('meta[property^="og:"], meta[name^="article:"]');
|
||||
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:')
|
||||
);
|
||||
|
||||
@@ -325,7 +325,7 @@ export const classifyContent = (structure, metrics, articleText) => {
|
||||
export const extractContentFromUrl = async (url) => {
|
||||
try {
|
||||
// Fetch content
|
||||
const { html, url: finalUrl, contentType } = await fetchUrlContent(url);
|
||||
const { html, url: finalUrl } = await fetchUrlContent(url);
|
||||
|
||||
// Parse HTML
|
||||
const doc = parseHtml(html);
|
||||
|
||||
Reference in New Issue
Block a user