Registry / devops / eslint-plugin-sf-plugin

eslint-plugin-sf-plugin

JSON →
library1.20.33jsnpmunverified

ESLint plugin providing rules for Salesforce CLI plugins development. Current stable version is 1.20.33, with frequent patch releases following @salesforce/core dependencies. It offers recommended and migration configurations to enforce best practices like command summaries, flag naming conventions, and hardcoded message detection. Differentiates by integrating with Salesforce toolchain and easing migration from sfdxCommand to sfCommand.

npm install eslint-plugin-sf-plugin
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-SF-P
E
eslint-plugin-sf-plugin
devopsjavascriptv1.20.33
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
module.exports = { plugins: ['sf-plugin'] };
module.exports = { plugins: ['eslint-plugin-sf-plugin'] };
ESLint strips the 'eslint-plugin-' prefix. Use 'sf-plugin' in plugins array.
configs.recommended
extends: ['plugin:sf-plugin/recommended']
extends: ['sf-plugin/recommended']
Use the full config name 'plugin:sf-plugin/recommended' in extends.
configs.migration
extends: ['plugin:sf-plugin/migration']
extends: ['eslint-plugin-sf-plugin/migration']
Migration config includes recommended rules. Use 'plugin:sf-plugin/migration'.

Shows how to install and configure the plugin with recommended rules in an ESLint config file.

// Install // yarn add --dev eslint-plugin-sf-plugin // .eslintrc.js module.exports = { extends: ['eslint-config-salesforce-typescript', 'plugin:sf-plugin/recommended'], rules: { 'sf-plugin/no-hardcoded-messages': 'error' } };
Debug
Known issues
breakingVersion 1.x requires Node >=18.0.0. Older Node versions are not supported.
fix
Update Node.js to version 18.0.0 or later.
affects: >=1.0.0
deprecatedThe 'sfdxCommand' pattern is deprecated. Use 'sfCommand' instead.
fix
Apply the migration config ('plugin:sf-plugin/migration') to auto-fix many issues.
affects: >=1.0.0
gotchaRules like 'no-hardcoded-messages' may require additional setup (e.g., message bundle files) and can produce false positives if not configured.
fix
Ensure your project follows the Salesforce message bundle conventions or disable the rule.
affects: >=1.0.0
gotchaUsing 'plugin:sf-plugin/migration' will auto-fix rule violations, which may cause unexpected code changes. Review changes carefully.
fix
Run ESLint with --fix and then commit changes after thorough testing.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'sf-plugin' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-sf-plugin'
Plugin not installed as a dev dependency.
fix
Run 'yarn add --dev eslint-plugin-sf-plugin' or 'npm install --save-dev eslint-plugin-sf-plugin'.
Parsing error: The keyword 'const' is reserved
ESLint parser is not set to handle TypeScript or modern JavaScript.
fix
Add '@typescript-eslint/parser' as the parser and ensure 'parserOptions.ecmaVersion' is >= 2020.
Definition for rule 'sf-plugin/command-summary' was not found
Incorrect plugin name in rules section (e.g., 'sfplugin' instead of 'sf-plugin').
fix
Use 'sf-plugin' as the plugin prefix in rules. Example: 'sf-plugin/command-summary': 'error'.
Upgrade
Version history
1.20.33latest on npm
Audit
Dependencies
@salesforce/corerequiredRequired for Salesforce core utilities, notably in migration rules.
Agent activity
4 hits · last 30 days
node
4
Resources