Code Monkey home page Code Monkey logo

coffeelint-variable-scope's Introduction

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

0.0.3 2015-03-05

  • Fix #4: Crash in destructuring assignment with splats

0.0.2 2014-10-13

  • Added coffeelint-variable-scope-ingore blessing
  • Bug fixes

0.0.1 2013-11-07 Initial release

coffeelint-variable-scope's People

Contributors

janraasch avatar pwlmaciejewski avatar rwky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.