Debian Codegraph @

eslint/plugin-fig-linter/rules/no-missing-get-version-export.js

raw symbols SCIP
1 module.exports = {
2 meta: {
3 type: "problem",
4 },
5 create(context) {
6 let hasExport = false;
7
8 return {
9 'ExportNamedDeclaration > FunctionDeclaration[id.name="getVersionCommand"]'() {
10 hasExport = true;
11 },
12 'ExportNamedDeclaration > VariableDeclaration > VariableDeclarator[id.name="getVersionCommand"]'() {
13 hasExport = true;
14 },
15 'ExportSpecifier[exported.name="getVersionCommand"]'() {
16 hasExport = true;
17 },
18 "Program:exit": function (node) {
19 if (!hasExport) {
20 context.report({
21 node,
22 message: "File should have an exported function named `getVersionCommand`",
23 });
24 }
25 },
26 };
27 },
28 };