Skip to content
This repository has been archived by the owner on May 31, 2019. It is now read-only.

CoffeeLint rule that warns you about overwriting outer scope variable.

License

Notifications You must be signed in to change notification settings

pwlmaciejewski/coffeelint-variable-scope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coffeelint-variable-scope NPM version Build Status

Packagecoffeelint-variable-scope
Description CoffeeLint rule that warns you about overwriting outer scope variable.
Node Version >= 0.10

Example

  ✗ ./level.coffee
     ⚡ #1-8: Outer scope variable overwrite. a.

✗ Lint! » 2 errors and 1 warning in 2 files

Means: Variable a assigned in 1st line and overwriten in 8th line of level.coffee file.

Installation

npm install coffeelint-variable-scope

Usage

Put this in your coffeelint config:

"variable_scope": {
    "module": "coffeelint-variable-scope",
    "scopeDiff": 1
}

Options

scopeDiff - Reports an error if upper and lower variable assign scope level difference is equal/bigger than scopeDiff. Default: 1.

Ignore errors

You can "bless" certain assignments as intentional via a special coffeelint-variable-scope-ignore annotation in code. Below code will not produce any coffeelint errors:

    a = 1
    ###coffeelint-variable-scope-ignore###
    a = 2

Notes:

  • It needs to be a block comment
  • It will ignore the next assignment (not line) in the code block

Test

npm test

Changelog

https://github.com/pwlmaciejewski/coffeelint-variable-scope/releases

About

CoffeeLint rule that warns you about overwriting outer scope variable.

Resources

License

Stars

Watchers

Forks

Packages