主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
123 lines
4.1 KiB
JavaScript
123 lines
4.1 KiB
JavaScript
/**
|
|
* @fileoverview Rule to enforce the position of line comments
|
|
* @author Alberto Rodríguez
|
|
*/
|
|
"use strict";
|
|
|
|
const astUtils = require("./utils/ast-utils");
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
/** @type {import('../shared/types').Rule} */
|
|
module.exports = {
|
|
meta: {
|
|
type: "layout",
|
|
|
|
docs: {
|
|
description: "Enforce position of line comments",
|
|
recommended: false,
|
|
url: "https://eslint.org/docs/latest/rules/line-comment-position"
|
|
},
|
|
|
|
schema: [
|
|
{
|
|
oneOf: [
|
|
{
|
|
enum: ["above", "beside"]
|
|
},
|
|
{
|
|
type: "object",
|
|
properties: {
|
|
position: {
|
|
enum: ["above", "beside"]
|
|
},
|
|
ignorePattern: {
|
|
type: "string"
|
|
},
|
|
applyDefaultPatterns: {
|
|
type: "boolean"
|
|
},
|
|
applyDefaultIgnorePatterns: {
|
|
type: "boolean"
|
|
}
|
|
},
|
|
additionalProperties: false
|
|
}
|
|
]
|
|
}
|
|
],
|
|
messages: {
|
|
above: "Expected comment to be above code.",
|
|
beside: "Expected comment to be beside code."
|
|
}
|
|
},
|
|
|
|
create(context) {
|
|
const options = context.options[0];
|
|
|
|
let above,
|
|
ignorePattern,
|
|
applyDefaultIgnorePatterns = true;
|
|
|
|
if (!options || typeof options === "string") {
|
|
above = !options || options === "above";
|
|
|
|
} else {
|
|
above = !options.position || options.position === "above";
|
|
ignorePattern = options.ignorePattern;
|
|
|
|
if (Object.prototype.hasOwnProperty.call(options, "applyDefaultIgnorePatterns")) {
|
|
applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns;
|
|
} else {
|
|
applyDefaultIgnorePatterns = options.applyDefaultPatterns !== false;
|
|
}
|
|
}
|
|
|
|
const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN;
|
|
const fallThroughRegExp = /^\s*falls?\s?through/u;
|
|
const customIgnoreRegExp = new RegExp(ignorePattern, "u");
|
|
const sourceCode = context.sourceCode;
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Public
|
|
//--------------------------------------------------------------------------
|
|
|
|
return {
|
|
Program() {
|
|
const comments = sourceCode.getAllComments();
|
|
|
|
comments.filter(token => token.type === "Line").forEach(node => {
|
|
if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) {
|
|
return;
|
|
}
|
|
|
|
if (ignorePattern && customIgnoreRegExp.test(node.value)) {
|
|
return;
|
|
}
|
|
|
|
const previous = sourceCode.getTokenBefore(node, { includeComments: true });
|
|
const isOnSameLine = previous && previous.loc.end.line === node.loc.start.line;
|
|
|
|
if (above) {
|
|
if (isOnSameLine) {
|
|
context.report({
|
|
node,
|
|
messageId: "above"
|
|
});
|
|
}
|
|
} else {
|
|
if (!isOnSameLine) {
|
|
context.report({
|
|
node,
|
|
messageId: "beside"
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}
|
|
};
|