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

54 lines
1.8 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 ES2015 typed arrays.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-typed-arrays.html",
},
fixable: null,
messages: {
forbidden: "ES2015 '{{name}}' 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, path } of tracker.iterateGlobalReferences({
Int8Array: { [READ]: true },
Uint8Array: { [READ]: true },
Uint8ClampedArray: { [READ]: true },
Int16Array: { [READ]: true },
Uint16Array: { [READ]: true },
Int32Array: { [READ]: true },
Uint32Array: { [READ]: true },
Float32Array: { [READ]: true },
Float64Array: { [READ]: true },
DataView: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}