Files
Laca-City/frontend/node_modules/eslint-plugin-react/lib/rules/no-set-state.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

89 lines
2.3 KiB
JavaScript

/**
* @fileoverview Prevent usage of setState
* @author Mark Dalgleish
*/
'use strict';
const values = require('object.values');
const Components = require('../util/Components');
const docsUrl = require('../util/docsUrl');
const report = require('../util/report');
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
const messages = {
noSetState: 'Do not use setState',
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow usage of setState',
category: 'Stylistic Issues',
recommended: false,
url: docsUrl('no-set-state'),
},
messages,
schema: [],
},
create: Components.detect((context, components, utils) => {
/**
* Checks if the component is valid
* @param {Object} component The component to process
* @returns {boolean} True if the component is valid, false if not.
*/
function isValid(component) {
return !!component && !component.useSetState;
}
/**
* Reports usages of setState for a given component
* @param {Object} component The component to process
*/
function reportSetStateUsages(component) {
for (let i = 0, j = component.setStateUsages.length; i < j; i++) {
const setStateUsage = component.setStateUsages[i];
report(context, messages.noSetState, 'noSetState', {
node: setStateUsage,
});
}
}
return {
CallExpression(node) {
const callee = node.callee;
if (
callee.type !== 'MemberExpression'
|| callee.object.type !== 'ThisExpression'
|| callee.property.name !== 'setState'
) {
return;
}
const component = components.get(utils.getParentComponent(node));
const setStateUsages = (component && component.setStateUsages) || [];
setStateUsages.push(callee);
components.set(node, {
useSetState: true,
setStateUsages,
});
},
'Program:exit'() {
values(components.list())
.filter((component) => !isValid(component))
.forEach((component) => {
reportSetStateUsages(component);
});
},
};
}),
};