✨ 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
105 lines
2.9 KiB
JavaScript
105 lines
2.9 KiB
JavaScript
/**
|
|
* @fileoverview Prevent extra closing tags for components without children
|
|
* @author Yannick Croissant
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const docsUrl = require('../util/docsUrl');
|
|
const jsxUtil = require('../util/jsx');
|
|
const report = require('../util/report');
|
|
|
|
const optionDefaults = { component: true, html: true };
|
|
|
|
function isComponent(node) {
|
|
return (
|
|
node.name
|
|
&& (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')
|
|
&& !jsxUtil.isDOMComponent(node)
|
|
);
|
|
}
|
|
|
|
function childrenIsEmpty(node) {
|
|
return node.parent.children.length === 0;
|
|
}
|
|
|
|
function childrenIsMultilineSpaces(node) {
|
|
const childrens = node.parent.children;
|
|
|
|
return (
|
|
childrens.length === 1
|
|
&& (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText')
|
|
&& childrens[0].value.indexOf('\n') !== -1
|
|
&& childrens[0].value.replace(/(?!\xA0)\s/g, '') === ''
|
|
);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
// ------------------------------------------------------------------------------
|
|
|
|
const messages = {
|
|
notSelfClosing: 'Empty components are self-closing',
|
|
};
|
|
|
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
module.exports = {
|
|
meta: {
|
|
docs: {
|
|
description: 'Disallow extra closing tags for components without children',
|
|
category: 'Stylistic Issues',
|
|
recommended: false,
|
|
url: docsUrl('self-closing-comp'),
|
|
},
|
|
fixable: 'code',
|
|
|
|
messages,
|
|
|
|
schema: [{
|
|
type: 'object',
|
|
properties: {
|
|
component: {
|
|
default: optionDefaults.component,
|
|
type: 'boolean',
|
|
},
|
|
html: {
|
|
default: optionDefaults.html,
|
|
type: 'boolean',
|
|
},
|
|
},
|
|
additionalProperties: false,
|
|
}],
|
|
},
|
|
|
|
create(context) {
|
|
function isShouldBeSelfClosed(node) {
|
|
const configuration = Object.assign({}, optionDefaults, context.options[0]);
|
|
return (
|
|
(configuration.component && isComponent(node))
|
|
|| (configuration.html && jsxUtil.isDOMComponent(node))
|
|
) && !node.selfClosing && (childrenIsEmpty(node) || childrenIsMultilineSpaces(node));
|
|
}
|
|
|
|
return {
|
|
JSXOpeningElement(node) {
|
|
if (!isShouldBeSelfClosed(node)) {
|
|
return;
|
|
}
|
|
report(context, messages.notSelfClosing, 'notSelfClosing', {
|
|
node,
|
|
fix(fixer) {
|
|
// Represents the last character of the JSXOpeningElement, the '>' character
|
|
const openingElementEnding = node.range[1] - 1;
|
|
// Represents the last character of the JSXClosingElement, the '>' character
|
|
const closingElementEnding = node.parent.closingElement.range[1];
|
|
|
|
// Replace />.*<\/.*>/ with '/>'
|
|
const range = [openingElementEnding, closingElementEnding];
|
|
return fixer.replaceTextRange(range, ' />');
|
|
},
|
|
});
|
|
},
|
|
};
|
|
},
|
|
};
|