Debian Codegraph @

eslint/plugin-fig-linter/rules/no-arg-in-option-name.js

raw symbols SCIP
1 module.exports = {
2 meta: {
3 type: "problem",
4 },
5 create(context) {
6 function report (node) {
7 context.report({
8 node: node,
9 message:
10 "Args should be separated from the option name, see https://fig.io/docs/reference/option#args",
11 });
12 }
13 return {
14 'ObjectExpression > Property[key.name="options"] > ArrayExpression > ObjectExpression > Property[key.name="name"]': function (node) {
15 const optionNameNode = node.value;
16 const optNameElementNodes =
17 optionNameNode.type === "ArrayExpression"
18 ? optionNameNode.elements // name: ["--one", "--two"]
19 : [optionNameNode]; // name: "--one"
20
21 for (const node of optNameElementNodes) {
22 if (node.type === "Literal" && typeof node.value === "string" && node.value.indexOf(" ") >= 0) {
23 report(node);
24 }
25 }
26 },
27 };
28 },
29 };