Socket
Socket
Sign inDemoInstall

eslint-plugin-angular

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-angular

ESLint rules for AngularJS projects


Version published
Weekly downloads
70K
decreased by-9.89%
Maintainers
1
Weekly downloads
 
Install size
Created

Readme

Source

Build Status Npm dependencies devDependency Status

This repository will give access to new rules for the ESLint tool. You should use it only if you are developping an AngularJS application.

Usage

  1. Install eslint-plugin-angular as a dev-dependency:

    npm install --save-dev eslint-plugin-angular
    
  2. Enable the plugin by adding it to your .eslintrc:

    plugins:
      - angular
    

Rules

NameDescription
ng_angularelementThe angular.element method should be used of the $ or jQuery object (if you are using jQuery of course). If the jQuery library is imported, angular.element will be a wrapper around the jQuery object.
ng_controller_nameAll your controllers should have a name starting the parameter you can define in your config object ("ng_controller_name": [2, "ng"])
ng_definedundefinedYou should use the angular.isUndefined or angular.isDefined methods instead of using the keyword undefined (myVar === undefined)
ng_directive_nameAll your directives should have a name starting the parameter you can define in your config object ("ng_directive_name": [2, "ng"])
ng_filter_nameAll your filters should have a name starting the parameter you can define in your config object ("ng_filter_name": [2, "ng"])
ng_json_functionsYou should use angular.fromJson or angular.toJson instead of JSON.parse and JSON.stringify
ng_on_watchWatch and On methods on the scope object should be assigned to a variable, in order to be deleted in a $destroy event handler
ng_service_nameAll your services should have a name starting the parameter you can define in your config object ("ng_service_name": [2, "ng"])
ng_timeout_serviceInstead of the default setTimeout function, you should use the AngularJS wrapper service $timeout
ng_typecheck_arrayYou should use the angular.isArray method instead of the default JavaScript implementation (typeof [] === "[object Array]").
ng_typecheck_booleanYou should use the angular.isBoolean method instead of the default JavaScript implementation (typeof true === "[object Boolean]").
ng_typecheck_dateYou should use the angular.isDate method instead of the default JavaScript implementation (typeof new Date() === "[object Date]").
ng_typecheck_functionYou should use the angular.isFunction method instead of the default JavaScript implementation (typeof function(){} ==="[object Function]").
ng_typecheck_numberYou should use the angular.isNumber method instead of the default JavaScript implementation (typeof 3 === "[object Number]").
ng_typecheck_objectYo u should use the angular.isObject method instead of the default JavaScript implementation (typeof {} === "[object Object]").
ng_typecheck_regexpYou should use the angular.isRegexp method instead of the default JavaScript implementation (toString.call(/^A/) === "[object RegExp]").
ng_typecheck_stringYou should use the angular.isString method instead of the default JavaScript implementation (typeof "" === "[object String]").
ng_window_serviceInstead of the default window object, you should prefer the AngularJS wrapper service $window.

Need your help

It is an opensource project. Any help will be very useful. You can :

  • Create issue
  • Send Pull Request
  • Write Documentation
  • Add new Features
  • Add new Rules
  • Improve the quality
  • Reply to issues

Keywords

FAQs

Package last updated on 26 Jan 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc