Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
eslint-plugin-sf-plugin
Advanced tools
Helpful eslint rules for sf plugins.
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'
}
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'],
};
πΌ 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 | βοΈ | π§ |
FAQs
Helpful eslint rules for sf plugins.
The npm package eslint-plugin-sf-plugin receives a total of 5,407 weekly downloads. As such, eslint-plugin-sf-plugin popularity was classified as popular.
We found that eslint-plugin-sf-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.