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 - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

rules/ng_di_unused.js

2

index.js

@@ -15,2 +15,3 @@ (function(){

'ng_di_order': require('./rules/ng_di_order'),
'ng_di_unused': require('./rules/ng_di_unused'),
'ng_directive_name': require('./rules/ng_directive_name'),

@@ -59,2 +60,3 @@ 'ng_document_service': require('./rules/ng_document_service'),

'ng_di_order': 0,
'ng_di_unused': 0,
'ng_directive_name': 0,

@@ -61,0 +63,0 @@ 'ng_document_service': 2,

2

package.json
{
"name": "eslint-plugin-angular",
"version": "0.7.0",
"version": "0.8.0",
"description": "ESLint rules for AngularJS projects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -84,3 +84,3 @@ [![Build Status](https://travis-ci.org/Gillespie59/eslint-plugin-angular.svg?branch=master)](https://travis-ci.org/Gillespie59/eslint-plugin-angular)

| 'ng_di': [2, 'function'] | All your DI should use the same syntax : the Array or function syntaxes ("ng_di": [2, "function or array"])|
| 'ng_di_order': 0 | Injected dependencies should be sorted alphabetically. |
| 'ng_di_order': [0, true] | Injected dependencies should be sorted alphabetically. If the second parameter is set to false, values which start and end with an underscore those underscores are stripped. This means for example that `_$httpBackend_` goes before `_$http_`. |
| 'ng_directive_name': 0 | All your directives should have a name starting with the parameter you can define in your config object. The second parameter can be a Regexp wrapped in quotes. You can not prefix your directives by "ng" (reserved keyword for AngularJS directives) ("ng_directive_name": [2, "ng"]) [Y073](https://github.com/johnpapa/angular-styleguide#style-y073), [Y126](https://github.com/johnpapa/angular-styleguide#style-y126) |

@@ -140,3 +140,3 @@ | 'ng_document_service': 2 | Instead of the default document object, you should prefer the AngularJS wrapper service $document. [Y180](https://github.com/johnpapa/angular-styleguide#style-y180) |

We can use a property, defined in the ESLint configuration file, in order to know which version is used : Angular 1 or Angular 2. based on this property, you can create rules for each version.
We can use a property, defined in the ESLint configuration file, in order to know which version is used : Angular 1 or Angular 2. based on this property, you can create rules for each version.

@@ -159,3 +159,3 @@ ```yaml

And in your rule, you can access to this property thanks to the `context` object :
And in your rule, you can access to this property thanks to the `context` object :

@@ -162,0 +162,0 @@ ```javascript

@@ -21,3 +21,9 @@ module.exports = function(context) {

function checkOrder(fn) {
if(!fn || !fn.params) {
return;
}
var args = fn.params.map(function(arg) {
if(context.options[0] !== false) {
return arg.name.replace(/^_(.+)_$/, '$1')
}
return arg.name;

@@ -24,0 +30,0 @@ });

@@ -27,2 +27,8 @@ //------------------------------------------------------------------------------

'this.$get = function($http, $q){};',
'this.$get = get;',
'it(inject(function(_$http_, _$httpBackend_){}));',
{
code: 'it(inject(function(_$httpBackend_, _$http_){}));',
options: [false],
}
],

@@ -60,2 +66,9 @@ invalid: [{

}, {
code: 'it(inject(function(_$http_, _$httpBackend_){}));',
options: [false],
errors: [{message: 'Injected values should be sorted alphabetically'}]
}, {
code: 'it(inject(function(_$httpBackend_, _$http_){}));',
errors: [{message: 'Injected values should be sorted alphabetically'}]
}, {
code: 'this.$get = function($q, $http){};',

@@ -62,0 +75,0 @@ errors: [{message: 'Injected values should be sorted alphabetically'}]

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc