UNPKG

eslint-plugin-sf-plugin

Version:
49 lines (48 loc) 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.noDeprecatedProperties = void 0; /* * Copyright (c) 2020, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ const eslint_utils_1 = require("@typescript-eslint/utils/eslint-utils"); const utils_1 = require("@typescript-eslint/utils"); const commands_1 = require("../../shared/commands"); exports.noDeprecatedProperties = eslint_utils_1.RuleCreator.withoutDocs({ meta: { docs: { description: 'Removes non-existent properties left over from SfdxCommand', recommended: 'recommended', }, messages: { property: 'Class property {{property}} is not available on SfCommand and should be removed', }, type: 'problem', schema: [], fixable: 'code', }, defaultOptions: [], create(context) { return (0, commands_1.isInCommandDirectory)(context) ? { PropertyDefinition(node) { if ((0, commands_1.ancestorsContainsSfCommand)(context)) { if (node.key.type === utils_1.AST_NODE_TYPES.Identifier && ['supportsDevhubUsername', 'varargs'].includes(node.key.name)) { context.report({ node, messageId: 'property', data: { property: node.key.name, }, fix: (fixer) => fixer.remove(node), }); } } }, } : {}; }, });