Détail du package

eslint-plugin-sf-plugin

salesforcecli43.6kBSD-3-Clause1.20.31

Helpful eslint rules for sf plugins.

force, salesforce, sf, plugins

readme

eslint-plugin-sf-plugin

Helpful eslint rules for sf plugins.

Use these rules in a sf plugin

yarn add --dev eslint-plugin-sf-plugin

Then, in your plugin's .eslintrc.js, add "plugin:sf-plugin/recommended" to your extends property.

example:

module.exports = {
  extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
};

To override how an individual rules behaves, add the plugin name and change the its rules value.

plugins: ['sf-plugin'],
rules: {
  'sf-plugin/no-hardcoded-messages': 'error'
}

Use these rules to migrate a plugin based on sfdxCommand to use sfCommand

These eslint rules are experimental and cause significant code changes. Please use with caution and test changes thoroughly

yarn add @salesforce/sf-plugins-core
yarn add --dev eslint-plugin-sf-plugin

[migration includes all of the recommended rules, so you don't have to include both]

module.exports = {
  extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/migration'],
};

Rules

💼 Configurations enabled in.\ ⚠️ Configurations set to warn in.\ 🚫 Configurations disabled in.\ 📚 Set in the library configuration.\ ✈️ Set in the migration configuration.\ ✅ Set in the recommended configuration.\ 🔧 Automatically fixable by the --fix CLI option.\ 💡 Manually fixable by editor suggestions.

Name Description 💼 ⚠️ 🚫 🔧 💡
command-example Ensure commands have a summary, description, and examples ✈️ ✅
command-summary Ensure commands have a summary ✈️ ✅ 🔧
dash-o Warn on a flag that uses -o ✈️ ✅
encourage-alias-deprecation Commands and flags aliases probably want to deprecate their old names to provide more warnings to users 🔧 💡
esm-message-import Looks for the verbose Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url))) to offer a simpler alternative 📚 ✈️ ✅ 🔧
flag-case Enforce lowercase kebab-case flag names ✈️ ✅ 🔧
flag-cross-references Enforce flag cross references for dependOn,exclusive,exactlyOne ✈️ ✅
flag-min-max-default Enforce that flags with min/max values have a default value ✈️ ✅
flag-summary Enforce that flags have a summary property and that longDescription is renamed to description ✈️ ✅ 🔧
get-connection-with-version Calls to getConnection should pass in a version ✈️ ✅
id-flag-suggestions Create better salesforceId flags with length and startsWith properties ✈️ ✅ 🔧 💡
no-args-parse-without-strict-false If you parse args/argv, the class should have strict set to false ✈️ ✅ 🔧
no-builtin-flags Handling for sfdxCommand's flags.builtin ✈️ 🔧
no-classes-in-command-return-type The return type of the run method should not contain a class. ✈️ ✅ 🔧
no-default-and-depends-on-flags Do not allow creation of a flag with default value and dependsOn ✈️ ✅
no-depends-on-boolean-flag Do not allow flags to depend on boolean flags ✈️ ✅
no-deprecated-properties Removes non-existent properties left over from SfdxCommand ✈️ 🔧
no-duplicate-short-characters Prevent duplicate use of short characters or conflicts between aliases and flags ✈️ ✅
no-execcmd-double-quotes Do not use double quotes in NUT examples. They will not work on windows 📚 ✈️ ✅ 🔧
no-filepath-flags Change filepath flag to file flag 🔧
no-h-short-char Do not allow creation of a flag with short char -h ✈️ ✅
no-hardcoded-messages-commands Use loaded messages and separate files for messages ✈️ ✅
no-hardcoded-messages-flags Use loaded messages and separate files for messages. Follow the message naming guidelines ✈️ ✅ 🔧
no-hyphens-aliases Mark when an alias starts with a hyphen, like -f or --foo ✈️ ✅ 🔧
no-id-flags Change Id flag to salesforceId ✈️ 🔧
no-json-flag Do not allow creation of json flag ✈️ ✅
no-messages-load Use Messages.loadMessages() instead of Messages.load() 📚 ✈️ ✅ 🔧
no-missing-messages Checks core Messages usage for correct usage of named messages and message tokens 📚 ✈️ ✅
no-number-flags Change number flag to integer 🔧
no-oclif-flags-command-import Change import of flags and Command from oclif to use sf-plugins-core ✈️ ✅ 🔧
no-sfdx-command-import Change import and base class from SfdxCommand to sfCommand ✈️ 🔧
no-split-examples Arrays of messags should use getMessages instead of getMessage followed by EOL splitting ✈️ ✅ 🔧
no-this-flags Fix references to this.org (property on SfdxCommand) ✈️ 🔧 💡
no-this-org Fix references to this.org (property on SfdxCommand) ✈️ 🔧 💡
no-this-ux SfCommand does not have a ux property ✈️ 🔧
no-time-flags Migrate time flags to Flags.duration ✈️ 🔧
no-unnecessary-aliases Mark when an alias is unnecessary because its only an order permutation, not really a different name ✈️ ✅ 🔧
no-unnecessary-properties Boolean properties are false by default, so they should not be set to false ✈️ ✅ 🔧
no-username-properties Convert requiresUsername and supportusername to username flags ✈️ 🔧
only-extend-SfCommand Only allow commands that directly extend SfCommand ✈️ ✅
read-only-properties Class-level static properties, like flags or descriptions, should be marked public and read-only ✈️ ✅ 🔧
run-matches-class-type The return type of the run method should match the Type passed to sfCommand ✈️ ✅ 🔧
sfdx-flags-property Change flag definitions to SfCommand version ✈️ 🔧
should-parse-flags The run method should call this.parse when there are flags ✈️ 🔧
spread-base-flags When not directly extending SfCommand, the parent's flags must be spread like flags = { ...{{parent}}.{{property}} } ✈️
use-sf-command-flags Use Flags export from sf-plugins-core ✈️ 🔧

changelog

1.20.31 (2025-08-17)

Bug Fixes

  • deps: bump @salesforce/core from 8.18.5 to 8.19.1 (983f0a8)

1.20.30 (2025-07-26)

Bug Fixes

  • deps: bump @salesforce/core from 8.18.1 to 8.18.5 (a854936)

1.20.29 (2025-07-22)

Bug Fixes

  • deps: bump form-data from 4.0.0 to 4.0.4 (31c0d24)

1.20.28 (2025-07-19)

Bug Fixes

  • deps: bump @salesforce/core from 8.17.0 to 8.18.1 (589988b)

1.20.27 (2025-07-05)

Bug Fixes

  • deps: bump @salesforce/core from 8.14.0 to 8.17.0 (4d67618)

1.20.26 (2025-06-21)

Bug Fixes

  • deps: bump @salesforce/core from 8.12.0 to 8.14.0 (4628d50)

1.20.25 (2025-06-07)

Bug Fixes

  • deps: bump @salesforce/core from 8.11.1 to 8.12.0 (6039bea)

1.20.24 (2025-05-24)

Bug Fixes

  • deps: bump @salesforce/core from 8.10.3 to 8.11.1 (5fb419f)

1.20.23 (2025-05-11)

Bug Fixes

  • deps: bump @salesforce/core from 8.10.1 to 8.10.3 (d32335d)

1.20.22 (2025-05-03)

Bug Fixes

  • deps: bump @salesforce/core from 8.10.0 to 8.10.1 (7a08153)

1.20.21 (2025-04-26)

Bug Fixes

  • deps: bump @salesforce/core from 8.9.1 to 8.10.0 (f0fc2b5)

1.20.20 (2025-04-19)

Bug Fixes

  • deps: bump @salesforce/core from 8.9.0 to 8.9.1 (5f53d9b)

1.20.19 (2025-04-12)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.7 to 8.9.0 (11af429)

1.20.18 (2025-03-29)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.6 to 8.8.7 (329aab4)

1.20.17 (2025-03-23)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.5 to 8.8.6 (9aa3ad3)

1.20.16 (2025-03-08)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.3 to 8.8.5 (ea86f0c)

1.20.15 (2025-02-22)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.2 to 8.8.3 (0cbd391)

1.20.14 (2025-01-18)

Bug Fixes

  • deps: bump @salesforce/core from 8.8.0 to 8.8.2 (231fe1d)

1.20.13 (2024-11-17)

Bug Fixes

  • deps: bump cross-spawn from 7.0.3 to 7.0.5 (09a2820)

1.20.12 (2024-11-16)

Bug Fixes

  • deps: bump @salesforce/core from 8.6.4 to 8.8.0 (853298c)

1.20.11 (2024-11-02)

Bug Fixes

  • deps: bump @salesforce/core from 8.6.3 to 8.6.4 (4f113eb)

1.20.10 (2024-10-27)

Bug Fixes

  • deps: bump @salesforce/core from 8.6.2 to 8.6.3 (2371af4)

1.20.9 (2024-10-13)

Bug Fixes

  • deps: bump @salesforce/core from 8.6.1 to 8.6.2 (9662686)

1.20.8 (2024-09-28)

Bug Fixes

  • deps: bump @salesforce/core from 8.5.4 to 8.6.1 (55cc4da)

1.20.7 (2024-09-08)

Bug Fixes

  • deps: bump @salesforce/core from 8.5.1 to 8.5.4 (7cbcd3b)

1.20.6 (2024-09-01)

Bug Fixes

  • deps: bump @salesforce/core from 8.4.0 to 8.5.1 (74c369f)

1.20.5 (2024-08-17)

Bug Fixes

  • deps: bump @salesforce/core from 8.3.0 to 8.4.0 (4ef7881)

1.20.4 (2024-08-10)

Bug Fixes

  • deps: bump @salesforce/core from 8.2.8 to 8.3.0 (2aef063)

1.20.3 (2024-08-04)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 7.17.0 to 7.18.0 (32329c1)

1.20.2 (2024-08-04)

Bug Fixes

  • deps: bump @salesforce/core from 8.2.3 to 8.2.8 (90ae59c)

1.20.1 (2024-07-28)

Bug Fixes

  • deps: bump @salesforce/core from 8.2.1 to 8.2.3 (7c524c7)

1.20.0 (2024-07-26)

Features

1.19.1 (2024-07-23)

Bug Fixes

1.19.0 (2024-07-22)

Features

  • add spread-flags/only-extend-SfCommand/no-default-and-depends-on-flags rules (#440) (d4e7391), closes #441

1.18.12 (2024-07-20)

Bug Fixes

  • deps: bump @salesforce/core from 8.1.1 to 8.2.1 (cad6d9b)

1.18.11 (2024-07-06)

Bug Fixes

  • deps: bump @salesforce/core from 8.1.0 to 8.1.1 (37c218d)

1.18.10 (2024-06-30)

Bug Fixes

  • deps: bump @salesforce/core from 8.0.3 to 8.1.0 (2595a7b)

1.18.9 (2024-06-22)

Bug Fixes

  • deps: bump @salesforce/core from 8.0.1 to 8.0.3 (fb306c3)

1.18.8 (2024-06-19)

Bug Fixes

1.18.7 (2024-06-15)

Bug Fixes

  • deps: bump @salesforce/core from 7.3.9 to 7.4.1 (a23d2ba)

1.18.6 (2024-06-13)

Bug Fixes

  • deps: bump braces from 3.0.2 to 3.0.3 (e1ffaac)

1.18.5 (2024-05-26)

Bug Fixes

  • deps: bump @salesforce/core from 7.3.8 to 7.3.9 (263d383)

1.18.4 (2024-05-18)

Bug Fixes

  • deps: bump @salesforce/core from 7.3.1 to 7.3.8 (aedb2dd)

1.18.3 (2024-04-28)

Bug Fixes

  • deps: bump @salesforce/core from 7.3.0 to 7.3.1 (34ecd3d)

1.18.2 (2024-04-21)

Bug Fixes

  • deps: bump @salesforce/core from 7.2.0 to 7.3.0 (c61a24e)

1.18.1 (2024-04-14)

Bug Fixes

  • deps: bump @salesforce/core from 7.0.0 to 7.2.0 (6f299db)

1.18.0 (2024-04-10)

Features

1.17.5 (2024-03-29)

Bug Fixes

  • deps: bump @salesforce/core from 6.7.0 to 6.7.3 (d136933)

1.17.4 (2024-03-02)

Bug Fixes

  • deps: bump @salesforce/core from 6.5.1 to 6.7.0 (e1a8b58)

1.17.3 (2024-02-03)

Bug Fixes

  • deps: bump @salesforce/core from 6.4.7 to 6.5.1 (3ec1636)

1.17.2 (2024-01-14)

Bug Fixes

  • deps: bump @salesforce/core from 6.4.4 to 6.4.7 (64891b8)

1.17.1 (2024-01-06)

Bug Fixes

  • deps: bump @salesforce/core from 6.4.0 to 6.4.4 (95a711b)

1.17.0 (2023-12-14)

1.16.16-qa.0 (2023-12-14)

Features

  • simplify ESM message imports (e749190)

1.16.15 (2023-11-12)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.17 to 5.3.20 (726c9d1)

1.16.14 (2023-11-05)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.14 to 5.3.17 (c2e144d)

1.16.13 (2023-10-29)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.10 to 5.3.14 (d7564b6)

1.16.12 (2023-10-22)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.9 to 5.3.10 (c2eb63a)

1.16.11 (2023-10-18)

Bug Fixes

  • deps: bump @babel/traverse from 7.18.2 to 7.23.2 (3e8abe6)

1.16.10 (2023-10-15)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.5 to 5.3.9 (bd437d3)

1.16.9 (2023-10-07)

Bug Fixes

  • deps: bump @salesforce/core from 5.3.1 to 5.3.5 (8ca05f0)

1.16.8 (2023-10-01)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.10 to 5.3.1 (257724e)

1.16.7 (2023-09-24)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.9 to 5.2.10 (c3191db)

1.16.6 (2023-09-23)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.7 to 5.2.9 (711e300)

1.16.5 (2023-09-09)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.5 to 5.2.7 (fb99c01)

1.16.4 (2023-09-03)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.1 to 5.2.5 (6103e18)

1.16.3 (2023-08-20)

Bug Fixes

  • deps: bump @salesforce/core from 5.2.0 to 5.2.1 (04a3aba)

1.16.2 (2023-08-07)

Bug Fixes

1.16.1 (2023-07-30)

Bug Fixes

  • deps: bump @salesforce/core from 4.3.7 to 4.3.11 (1bf7d2f)

1.16.0 (2023-07-26)

Bug Fixes

  • handle flag that are 'literals' (surrounded by single quotes) instead of a basic identifier (ab5689b)

Features

  • enforce message naming for flags (8056be8)

1.15.13 (2023-07-12)

Bug Fixes

  • deps: bump semver from 6.3.0 to 6.3.1 (6f6089f)

1.15.12 (2023-07-09)

Bug Fixes

  • deps: bump @salesforce/core from 4.3.5 to 4.3.7 (e7fa6aa)

1.15.11 (2023-07-09)

Bug Fixes

  • deps: bump tough-cookie from 4.1.2 to 4.1.3 (a3dc424)

1.15.10 (2023-07-02)

Bug Fixes

  • deps: bump @salesforce/core from 4.1.0 to 4.3.5 (fee3882)

1.15.9 (2023-06-17)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.59.9 to 5.59.11 (301f4bd)

1.15.8 (2023-06-04)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.59.7 to 5.59.8 (63442f2)

1.15.7 (2023-06-04)

Bug Fixes

  • deps: bump @salesforce/core from 4.0.1 to 4.1.0 (6cbf394)

1.15.6 (2023-05-31)

Bug Fixes

  • deps: core4, other deps (91703df)

1.15.5 (2023-05-28)

Bug Fixes

  • deps: bump @salesforce/core from 3.36.1 to 3.36.2 (75f4bb6)

1.15.4 (2023-05-28)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.59.6 to 5.59.7 (eef599b)

1.15.3 (2023-05-14)

Bug Fixes

  • deps: bump @salesforce/core from 3.36.0 to 3.36.1 (52f5f2b)

1.15.2 (2023-05-06)

Bug Fixes

  • deps: bump @salesforce/core from 3.34.6 to 3.36.0 (c84fdc4)

1.15.1 (2023-04-12)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.57.1 to 5.58.0 (eabd452)

1.15.0 (2023-04-12)

Features

  • add aliases to readonly props (3fd5eaf)

1.14.1 (2023-04-12)

Bug Fixes

  • deps: bump @salesforce/core from 3.33.6 to 3.34.6 (cf91ef0)

1.14.0 (2023-03-16)

Features

  • disable nut double-quote rule (0dea4d3)

1.13.0 (2023-03-13)

Bug Fixes

  • only remove username properties after flags and imports are created (d0f65db)
  • recognize protected flag prop (a8bf8ba)

Features

  • convert protected props to public (4c3ba46)

1.12.0 (2023-03-13)

Features

1.11.1 (2023-03-11)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.54.0 to 5.54.1 (0729333)

1.11.0 (2023-03-09)

Bug Fixes

  • handle noSymbol scenario (13cc585)

Features

  • no classes in return type (0227af2)

1.10.0 (2023-03-09)

Features

  • no-execCmd-double-quotes (336c773)

1.9.3 (2023-03-05)

Bug Fixes

  • deps: bump @salesforce/core from 3.33.4 to 3.33.6 (16ad8f0)

1.9.2 (2023-02-26)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.52.0 to 5.53.0 (427dc76)

1.9.1 (2023-02-25)

Bug Fixes

  • deps: bump @salesforce/core from 3.33.1 to 3.33.4 (15d0628)

1.9.0 (2023-02-23)

Features

  • prevent hyphens in aliases (b8d3fe4)

1.8.1 (2023-02-05)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.49.0 to 5.50.0 (dee5173)

1.8.0 (2023-01-30)

Bug Fixes

  • hande potential undefined (abstract class stuff) (94147bb)
  • handle non-literal tokens (0d3cdac)
  • make core a normal dep (d075e95)
  • underlying could be an abstract method (0d136e1)

Features

1.7.0 (2023-01-23)

Bug Fixes

  • exclude things that don't extend sfCommand or use args (5c42964)

Features

  • strict-false checks, docs catchup (3c56c59)

1.6.3 (2023-01-15)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.48.0 to 5.48.1 (82f0f93)

1.6.2 (2023-01-12)

Bug Fixes

1.6.1 (2023-01-11)

Bug Fixes

1.6.0 (2023-01-11)

Features

1.5.3 (2023-01-10)

Bug Fixes

  • add rule for salesforceId len both (61bdebf)

1.5.2 (2023-01-08)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.47.1 to 5.48.0 (d5526c4)

1.5.1 (2023-01-04)

Bug Fixes

  • deps: bump json5 from 1.0.1 to 1.0.2 (214a8fa)

1.5.0 (2023-01-03)

Features

1.4.0 (2023-01-03)

Features

  • username property conversion and removal of unnecessary default props (ceebd69)

1.3.1 (2022-12-26)

Bug Fixes

1.3.0 (2022-12-22)

Bug Fixes

  • suggestion not working as expected for adding private prop for org (cf4beea)

Features

  • autofix this.flags inside run method (94fab3b)
  • convert time flags (d8e39c3)
  • deprecate args (041f704)
  • following naming/casing conventions, add docs (fb75e49)
  • migration of and suggestions for id flags (bfbf6c4)
  • readonly properties for static class (ex: summary) (7b60766)

1.2.3 (2022-12-18)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.45.0 to 5.46.1 (d681a09)

1.2.2 (2022-12-16)

Bug Fixes

1.2.1 (2022-12-09)

1.2.0-beta.7 (2022-12-09)

Bug Fixes

1.2.0-beta.6 (2022-12-08)

Features

  • detect duplicate aliases (5ed9a39)

1.2.0-beta.5 (2022-12-08)

Features

  • also handle requiresProject (9a4dd96)
  • no builtin boolean flags (f3aadc8)

1.2.0-beta.4 (2022-12-08)

Features

1.2.0-beta.3 (2022-12-07)

Bug Fixes

  • proper replacements on this.ux (1a134ab)

Features

  • stop oclif/command or flags import (8f87695)

1.2.0-beta.2 (2022-12-05)

Bug Fixes

  • cause release (03a0d41)
  • cause release (69fa0b7)
  • don't do charnode twice (902dfe1)
  • only underline the class identifier, not the entire class (2db9e7d)

Features

Performance Improvements

  • don't return rules when outside of commands dir (fbc44d1)

1.2.0-beta.1 (2022-12-02)

Bug Fixes

  • description on import/base rule (fdbaa54)

Features

1.1.5 (2022-10-30)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.40.1 to 5.41.0 (68c5c50)

1.1.4 (2022-10-22)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.40.0 to 5.40.1 (b862d98)

1.1.3 (2022-10-15)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.39.0 to 5.40.0 (ddeedc6)

1.1.2 (2022-10-08)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.38.1 to 5.39.0 (ba80bda)

1.1.1 (2022-09-23)

Bug Fixes

  • deps: bump @typescript-eslint/utils from 5.36.1 to 5.38.0 (a4ee673)

1.1.0 (2022-08-15)

Bug Fixes

  • cause release (a9051f3)
  • correct validation for duration flags's default value (9fd41be)
  • force release (2824a62)
  • module.exports from outermost (c6e2670)
  • plugin naming conventions with namespace (fff3db3)
  • ts exports (8dc541f)
  • unit tests (c8f55d9)

Features