2 * @fileoverview Rule to flag use of certain node types
3 * @author Burak Yigit Kaya
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
16 description: "disallow specified syntax",
17 category: "Stylistic Issues",
19 url: "https://eslint.org/docs/rules/no-restricted-syntax"
32 selector: { type: "string" },
33 message: { type: "string" }
35 required: ["selector"],
36 additionalProperties: false
46 return context.options.reduce((result, selectorOrObject) => {
47 const isStringFormat = (typeof selectorOrObject === "string");
48 const hasCustomMessage = !isStringFormat && Boolean(selectorOrObject.message);
50 const selector = isStringFormat ? selectorOrObject : selectorOrObject.selector;
51 const message = hasCustomMessage ? selectorOrObject.message : "Using '{{selector}}' is not allowed.";
53 return Object.assign(result, {
58 data: hasCustomMessage ? {} : { selector }