Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

eslint-plugin-sf-plugin

Package Overview
Dependencies
Maintainers
0
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sf-plugin

Helpful eslint rules for sf plugins.

  • 1.20.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6K
decreased by-15.53%
Maintainers
0
Weekly downloads
Β 
Created
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-default-and-depends-on-flagsDo not allow creation of a flag with default value and dependsOn✈️ βœ…
no-depends-on-boolean-flagDo not allow flags to depend on boolean flags✈️ βœ…
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βœˆοΈπŸ”§
only-extend-SfCommandOnly allow commands that directly extend SfCommand✈️ βœ…
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βœˆοΈπŸ”§
spread-base-flagsWhen not directly extending SfCommand, the parent's flags must be spread like flags = { ...{{parent}}.{{property}} }βœˆοΈβœ…
use-sf-command-flagsUse Flags export from sf-plugins-coreβœˆοΈπŸ”§

Keywords

FAQs

Package last updated on 17 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc