Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
40
Frontend-Learner/node_modules/eslint-plugin-regexp/dist/rules/prefer-named-capture-group.js
generated
vendored
Normal file
40
Frontend-Learner/node_modules/eslint-plugin-regexp/dist/rules/prefer-named-capture-group.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("../utils");
|
||||
const mention_1 = require("../utils/mention");
|
||||
exports.default = (0, utils_1.createRule)("prefer-named-capture-group", {
|
||||
meta: {
|
||||
docs: {
|
||||
description: "enforce using named capture groups",
|
||||
category: "Stylistic Issues",
|
||||
recommended: false,
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
required: "Capture group {{group}} should be converted to a named or non-capturing group.",
|
||||
},
|
||||
type: "suggestion",
|
||||
},
|
||||
create(context) {
|
||||
function createVisitor(regexpContext) {
|
||||
const { node, getRegexpLocation } = regexpContext;
|
||||
return {
|
||||
onCapturingGroupEnter(cgNode) {
|
||||
if (cgNode.name === null) {
|
||||
context.report({
|
||||
node,
|
||||
loc: getRegexpLocation(cgNode),
|
||||
messageId: "required",
|
||||
data: {
|
||||
group: (0, mention_1.mention)(cgNode),
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
return (0, utils_1.defineRegexpVisitor)(context, {
|
||||
createVisitor,
|
||||
});
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue