Files
Laca-City/frontend/node_modules/eslint/lib/rules/no-await-in-loop.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

107 lines
2.7 KiB
JavaScript

/**
* @fileoverview Rule to disallow uses of await inside of loops.
* @author Nat Mote (nmote)
*/
"use strict";
/**
* Check whether it should stop traversing ancestors at the given node.
* @param {ASTNode} node A node to check.
* @returns {boolean} `true` if it should stop traversing.
*/
function isBoundary(node) {
const t = node.type;
return (
t === "FunctionDeclaration" ||
t === "FunctionExpression" ||
t === "ArrowFunctionExpression" ||
/*
* Don't report the await expressions on for-await-of loop since it's
* asynchronous iteration intentionally.
*/
(t === "ForOfStatement" && node.await === true)
);
}
/**
* Check whether the given node is in loop.
* @param {ASTNode} node A node to check.
* @param {ASTNode} parent A parent node to check.
* @returns {boolean} `true` if the node is in loop.
*/
function isLooped(node, parent) {
switch (parent.type) {
case "ForStatement":
return (
node === parent.test ||
node === parent.update ||
node === parent.body
);
case "ForOfStatement":
case "ForInStatement":
return node === parent.body;
case "WhileStatement":
case "DoWhileStatement":
return node === parent.test || node === parent.body;
default:
return false;
}
}
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow `await` inside of loops",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-await-in-loop"
},
schema: [],
messages: {
unexpectedAwait: "Unexpected `await` inside a loop."
}
},
create(context) {
/**
* Validate an await expression.
* @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate.
* @returns {void}
*/
function validate(awaitNode) {
if (awaitNode.type === "ForOfStatement" && !awaitNode.await) {
return;
}
let node = awaitNode;
let parent = node.parent;
while (parent && !isBoundary(parent)) {
if (isLooped(node, parent)) {
context.report({
node: awaitNode,
messageId: "unexpectedAwait"
});
return;
}
node = parent;
parent = parent.parent;
}
}
return {
AwaitExpression: validate,
ForOfStatement: validate
};
}
};