Files
NapCatQQ/.pnpm-store/v3/files/0d/47917dc7eb11afc42b66171b013db62c8d6289914d023b10b0ba70e2e785d9123dbfc3a397cef6ec5f3ec48fb95a611927fddb6924c0cd70b3ad6038640516
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

46 lines
1.4 KiB
Plaintext

import { createRule } from '../utils/index.js';
export default createRule({
name: 'no-amd',
meta: {
type: 'suggestion',
docs: {
category: 'Module systems',
description: 'Forbid AMD `require` and `define` calls.',
},
schema: [],
messages: {
amd: 'Expected imports instead of AMD {{type}}().',
},
},
defaultOptions: [],
create(context) {
return {
CallExpression(node) {
if (context.sourceCode.getScope(node).type !== 'module') {
return;
}
if (node.callee.type !== 'Identifier') {
return;
}
if (node.callee.name !== 'require' && node.callee.name !== 'define') {
return;
}
if (node.arguments.length !== 2) {
return;
}
const modules = node.arguments[0];
if (modules.type !== 'ArrayExpression') {
return;
}
context.report({
node,
messageId: 'amd',
data: {
type: node.callee.name,
},
});
},
};
},
});
//# sourceMappingURL=no-amd.js.map