From 67e3236a2de06bd5f7a5b4a2d1fead3b619b1d90 Mon Sep 17 00:00:00 2001 From: Takashi Arai Date: Mon, 6 May 2024 16:33:43 -0700 Subject: [PATCH] Rough draft of apex rule. --- lib/rules/apex/import-apex.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/rules/apex/import-apex.js diff --git a/lib/rules/apex/import-apex.js b/lib/rules/apex/import-apex.js new file mode 100644 index 0000000..d96c278 --- /dev/null +++ b/lib/rules/apex/import-apex.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024, salesforce.com, inc. + * All rights reserved. + * SPDX-License-Identifier: MIT + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT + */ + +'use strict'; + +// TODO: This sample rule would be removed. +// The import-apex rule definition +module.exports = { + meta: { + type: 'problem', + docs: { + description: + "Importing apex modules can have issue for offline." + }, + fixable: 'code', + schema: [] + }, + create(context) { + return { + ImportDeclaration(node) { + if (node.source.includes('apex')) { + context.report({ + node, + message: + 'Watch out for importing apex!' + }); + } + } + }; + } +};