Registry / devops / eslint-plugin-varspacing

eslint-plugin-varspacing

JSON →
library1.2.2jsnpmunverified

An ESLint plugin that provides a single fixable rule to enforce proper alignment of variable declarations. Version 1.2.2 is the latest stable release, with infrequent updates. It focuses exclusively on vertical spacing between var/let/const statements, offering automated fixes. Unlike general formatting tools like Prettier or eslint-plugin-prettier, it targets a specific niche, making it lightweight but limited in scope. The plugin is designed for projects that require consistent alignment of variable declarations.

npm install eslint-plugin-varspacing
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-VARS
E
eslint-plugin-varspacing
devopsjavascriptv1.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

plugin
plugins: ['varspacing']
varspacing: true
Add to plugins array in .eslintrc
config
extends: ['plugin:varspacing/recommended']
extends: ['eslint-plugin-varspacing/recommended']
Use 'plugin:' prefix for ESLint plugin configs
rule
rules: { 'varspacing/var-spacing': 'error' }
rules: { 'varspacing': 'error' }
Rule name includes namespace 'varspacing/'

Configures ESLint to use the varspacing plugin and enforce the var-spacing rule with colon alignment, then shows how variable declarations are linted and auto-fixed.

// .eslintrc.json { "plugins": ["varspacing"], "extends": ["plugin:varspacing/recommended"], "rules": { "varspacing/var-spacing": ["error", {"align": "colon"}] } } // Example code that will be flagged: var x = 1; var yyy = 2; var zz = 3; // After fix: var x = 1; var yyy = 2; var zz = 3;
Debug
Known issues
gotchaThe rule only applies to var/let/const declarations, not function declarations or other statements.
fix
Use additional rules like padding-line-between-statements for broader spacing control.
affects: >=1.0.0
deprecatedESLint deprecated 'indent' rule's variable alignment in favor of this plugin, but this plugin is not actively maintained.
fix
Consider using prettier for formatting instead of specialized rules.
affects: >=1.0.0
gotchaThe rule may conflict with other formatting rules like 'one-var' or 'sort-vars'. Ensure they are compatible.
fix
Disable conflicting rules or adjust configurations accordingly.
affects: >=1.0.0
Errors
Common errors & fixes
Definition for rule 'varspacing/var-spacing' was not found.
Plugin not installed or not added to plugins array.
fix
Run 'npm install eslint-plugin-varspacing --save-dev' and add '"plugins": ["varspacing"]' to .eslintrc.
ESLint configuration error: Cannot read property 'var-spacing' of undefined
Using the rule without registering the plugin in the plugins array.
fix
Add 'plugins: ["varspacing"]' to your ESLint config.
Rule 'varspacing/var-spacing' has been replaced by 'padding-line-between-statements' in newer ESLint
Misunderstanding; this is a dedicated plugin, not a replacement.
fix
No fix needed; the plugin is standalone.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required to run the plugin
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-varspacing — npm install eslint-plugin-varspacing · libregistry