Socket
Socket
Sign inDemoInstall

eslint-plugin-sf-plugin

Package Overview
Dependencies
254
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-sf-plugin

Helpful eslint rules for sf plugins.


Version published
Weekly downloads
15K
decreased by-2.68%
Maintainers
1
Install size
24.3 MB
Created
Weekly downloads
Β 

Readme

Source

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-exampleEnsure commands have a summary, description, and examples✈️ βœ…
command-summaryEnsure commands have a summary✈️ βœ…πŸ”§
dash-oWarn on a flag that uses -o✈️ βœ…
encourage-alias-deprecationCommands and flags aliases probably want to deprecate their old names to provide more warnings to usersβœˆοΈπŸ”§πŸ’‘
esm-message-importLooks for the verbose Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url))) to offer a simpler alternativeπŸ“š ✈️ βœ…πŸ”§
flag-caseEnforce lowercase kebab-case flag names✈️ βœ…πŸ”§
flag-cross-referencesEnforce flag cross references for dependOn,exclusive,exactlyOne✈️ βœ…
flag-min-max-defaultEnforce that flags with min/max values have a default value✈️ βœ…
flag-summaryEnforce that flags have a summary property and that longDescription is renamed to description✈️ βœ…πŸ”§
get-connection-with-versionCalls to getConnection should pass in a version✈️ βœ…
id-flag-suggestionsCreate better salesforceId flags with length and startsWith properties✈️ βœ…πŸ”§πŸ’‘
no-args-parse-without-strict-falseIf you parse args/argv, the class should have strict set to false✈️ βœ…πŸ”§
no-builtin-flagsHandling for sfdxCommand's flags.builtinβœˆοΈπŸ”§
no-classes-in-command-return-typeThe return type of the run method should not contain a class.✈️ βœ…πŸ”§
no-deprecated-propertiesRemoves non-existent properties left over from SfdxCommandβœˆοΈπŸ”§
no-duplicate-short-charactersPrevent duplicate use of short characters or conflicts between aliases and flags✈️ βœ…
no-execcmd-double-quotesDo not use double quotes in NUT examples. They will not work on windowsπŸ“š ✈️ βœ…πŸ”§
no-filepath-flagsChange filepath flag to file flagπŸ”§
no-h-short-charDo not allow creation of a flag with short char -h✈️ βœ…
no-hardcoded-messages-commandsUse loaded messages and separate files for messages✈️ βœ…
no-hardcoded-messages-flagsUse loaded messages and separate files for messages. Follow the message naming guidelines✈️ βœ…πŸ”§
no-hyphens-aliasesMark when an alias starts with a hyphen, like -f or --foo✈️ βœ…πŸ”§
no-id-flagsChange Id flag to salesforceIdβœˆοΈπŸ”§
no-json-flagDo not allow creation of json flag✈️ βœ…
no-messages-loadUse Messages.loadMessages() instead of Messages.load()πŸ“š ✈️ βœ…πŸ”§
no-missing-messagesChecks core Messages usage for correct usage of named messages and message tokensπŸ“š ✈️ βœ…
no-number-flagsChange number flag to integerπŸ”§
no-oclif-flags-command-importChange import of flags and Command from oclif to use sf-plugins-core✈️ βœ…πŸ”§
no-sfdx-command-importChange import and base class from SfdxCommand to sfCommandβœˆοΈπŸ”§
no-split-examplesArrays of messags should use getMessages instead of getMessage followed by EOL splitting✈️ βœ…πŸ”§
no-this-flagsFix references to this.org (property on SfdxCommand)βœˆοΈπŸ”§πŸ’‘
no-this-orgFix references to this.org (property on SfdxCommand)βœˆοΈπŸ”§πŸ’‘
no-this-uxSfCommand does not have a ux propertyβœˆοΈπŸ”§
no-time-flagsMigrate time flags to Flags.durationβœˆοΈπŸ”§
no-unnecessary-aliasesMark when an alias is unnecessary because its only an order permutation, not really a different name✈️ βœ…πŸ”§
no-unnecessary-propertiesBoolean properties are false by default, so they should not be set to false✈️ βœ…πŸ”§
no-username-propertiesConvert requiresUsername and supportusername to username flagsβœˆοΈπŸ”§
read-only-propertiesClass-level static properties, like flags or descriptions, should be marked public and read-only✈️ βœ…πŸ”§
run-matches-class-typeThe return type of the run method should match the Type passed to sfCommand✈️ βœ…πŸ”§
sfdx-flags-propertyChange flag definitions to SfCommand versionβœˆοΈπŸ”§
should-parse-flagsThe run method should call this.parse when there are flagsβœˆοΈπŸ”§
use-sf-command-flagsUse Flags export from sf-plugins-coreβœˆοΈπŸ”§

Keywords

FAQs

Last updated on 28 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc