1.20.16 β€’ Published 6 months ago

eslint-plugin-sf-plugin v1.20.16

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
6 months ago

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βœˆοΈπŸ”§
1.20.16

6 months ago

1.20.15

6 months ago

1.20.14

7 months ago

1.20.12

9 months ago

1.20.13

9 months ago

1.20.11

10 months ago

1.20.10

10 months ago

1.20.6

12 months ago

1.20.9

10 months ago

1.20.7

12 months ago

1.20.8

11 months ago

1.20.5

1 year ago

1.20.4

1 year ago

1.20.2

1 year ago

1.20.3

1 year ago

1.20.1

1 year ago

1.20.0

1 year ago

1.19.0

1 year ago

1.19.1

1 year ago

1.18.12

1 year ago

1.18.9

1 year ago

1.18.8

1 year ago

1.18.11

1 year ago

1.18.10

1 year ago

1.18.7

1 year ago

1.18.6

1 year ago

1.18.5

1 year ago

1.18.4

1 year ago

1.18.3

1 year ago

1.18.2

1 year ago

1.18.1

1 year ago

1.18.0

1 year ago

1.17.5

1 year ago

1.17.4

1 year ago

1.17.3

2 years ago

1.17.2

2 years ago

1.17.1

2 years ago

1.16.16-qa.0

2 years ago

1.17.0

2 years ago

1.16.10

2 years ago

1.16.14

2 years ago

1.16.13

2 years ago

1.16.12

2 years ago

1.16.11

2 years ago

1.16.15

2 years ago

1.16.7

2 years ago

1.16.6

2 years ago

1.16.5

2 years ago

1.16.4

2 years ago

1.16.9

2 years ago

1.16.8

2 years ago

1.16.3

2 years ago

1.16.2

2 years ago

1.16.1

2 years ago

1.16.0

2 years ago

1.15.10

2 years ago

1.15.11

2 years ago

1.15.12

2 years ago

1.15.13

2 years ago

1.15.4

2 years ago

1.15.3

2 years ago

1.15.8

2 years ago

1.15.7

2 years ago

1.15.6

2 years ago

1.15.5

2 years ago

1.15.9

2 years ago

1.14.1

2 years ago

1.15.0

2 years ago

1.15.2

2 years ago

1.15.1

2 years ago

1.14.0

2 years ago

1.13.0

2 years ago

1.12.0

2 years ago

1.11.1

2 years ago

1.9.1

2 years ago

1.9.3

2 years ago

1.9.2

2 years ago

1.11.0

2 years ago

1.10.0

2 years ago

1.8.1

3 years ago

1.6.3

3 years ago

1.8.0

3 years ago

1.6.2

3 years ago

1.5.3

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.5.2

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.1.5

3 years ago

1.5.0

3 years ago

1.2.3

3 years ago

1.1.4

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.2.2

3 years ago

1.1.3

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.1.2

3 years ago

1.2.0-beta.1

3 years ago

1.2.0-beta.3

3 years ago

1.2.0-beta.2

3 years ago

1.2.0-beta.5

3 years ago

1.2.0-beta.4

3 years ago

1.2.0-beta.7

3 years ago

1.2.0-beta.6

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago