Files
NapCatQQ/.pnpm-store/v3/files/83/eba1811ffe5f86fa7af4745c21765d38f071266bbe681f36936075ec32b07608cd62a7720009c622fd77af8e3c7e597b19b8a94750dedec641c9d10b67b69e
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

41 lines
1.3 KiB
Plaintext

/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("@eslint-community/eslint-utils")
const { getSourceCode } = require("eslint-compat-utils")
module.exports = {
meta: {
docs: {
description: "disallow `Promise.allSettled` function",
category: "ES2020",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-promise-all-settled.html",
},
fixable: null,
messages: {
forbidden: "ES2020 'Promise.allSettled' function is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"(program) {
const sourceCode = getSourceCode(context)
const tracker = new ReferenceTracker(
sourceCode.getScope(program),
)
for (const { node } of tracker.iterateGlobalReferences({
Promise: { allSettled: { [READ]: true } },
})) {
context.report({ node, messageId: "forbidden" })
}
},
}
},
}