Files
NapCatQQ/.pnpm-store/v3/files/18/b7bcd7d70483150be5257056ed3d0c0d5a1f2dc015d709347592cbc82bd62a4234233e217e71279cb5fd3effc40a8698dee0d2bad57544c3ef2c0589423cba
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

52 lines
1.4 KiB
Plaintext

/**
* @author Yosuke Ota
* See LICENSE file in root directory for full license.
*/
"use strict"
/**
* Remove the numeric separators.
* @param {string} raw The raw string of numeric literals
* @returns {string} The string with the separators removed.
*/
function removeNumericSeparators(raw) {
return raw.replace(/_/gu, "")
}
module.exports = {
meta: {
docs: {
description: "disallow numeric separators.",
category: "ES2021",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-numeric-separators.html",
},
fixable: "code",
messages: {
forbidden: "ES2021 numeric separators are forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
Literal(node) {
if (
(typeof node.value === "number" || node.bigint != null) &&
node.raw.includes("_")
) {
context.report({
node,
messageId: "forbidden",
fix: (fixer) =>
fixer.replaceText(
node,
removeNumericSeparators(node.raw),
),
})
}
},
}
},
}