Skip to content

Commit 114569b

Browse files
author
gal koren
committed
eslint
1 parent f546ed1 commit 114569b

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": true
4+
}
5+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rules/di.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ module.exports = {
1717
meta: {
1818
docs: {
1919
url:
20-
'https://github.com/Gillespie59/eslint-plugin-angular/blob/master/docs/rules/di.md',
20+
'https://github.com/Gillespie59/eslint-plugin-angular/blob/master/docs/rules/di.md'
2121
},
2222
schema: [
2323
{
24-
enum: ['function', 'array', '$inject'],
24+
enum: ['function', 'array', '$inject']
2525
},
2626
{
2727
type: 'object',
2828
properties: {
2929
matchNames: {
30-
type: 'boolean',
30+
type: 'boolean'
3131
},
3232
stripUnderscores: {
33-
type: 'boolean',
34-
},
35-
},
36-
},
37-
],
33+
type: 'boolean'
34+
}
35+
}
36+
}
37+
]
3838
},
39-
create: angularRule(function (context) {
39+
create: angularRule(function(context) {
4040
var syntax = context.options[0] || 'function';
4141

4242
var extra = context.options[1] || {};
@@ -48,7 +48,7 @@ module.exports = {
4848
node,
4949
'You should use the {{syntax}} syntax for DI',
5050
{
51-
syntax: syntax,
51+
syntax: syntax
5252
}
5353
);
5454
}
@@ -70,7 +70,7 @@ module.exports = {
7070
}
7171

7272
function normalizeParameter(param) {
73-
return param.replace(/^_(.+)_$/, function (match, p1) {
73+
return param.replace(/^_(.+)_$/, function(match, p1) {
7474
return p1;
7575
});
7676
}
@@ -92,7 +92,7 @@ module.exports = {
9292
}
9393

9494
if (matchNames) {
95-
var invalidArray = fn.params.filter(function (e, i) {
95+
var invalidArray = fn.params.filter(function(e, i) {
9696
var name = e.name;
9797

9898
if (stripUnderscores) {
@@ -139,7 +139,7 @@ module.exports = {
139139
}
140140

141141
if (matchNames) {
142-
var invalidInjectArray = fn.params.filter(function (
142+
var invalidInjectArray = fn.params.filter(function(
143143
e,
144144
i
145145
) {
@@ -179,25 +179,25 @@ module.exports = {
179179
'angular?inject': checkDi,
180180
'angular?run': checkDi,
181181
'angular?service': checkDi,
182-
'angular?provider': function (callee, providerFn, $get) {
182+
'angular?provider': function(callee, providerFn, $get) {
183183
checkDi(null, providerFn);
184184
checkDi(null, $get);
185185
},
186-
'angular?component': function (callee) {
186+
'angular?component': function(callee) {
187187
var routeObject = callee.parent.arguments[1];
188188

189189
var elementLength = 0;
190190
var elements = null;
191191
var parameters = null;
192192

193193
if (routeObject.properties) {
194-
routeObject.properties.forEach(function (prop) {
194+
routeObject.properties.forEach(function(prop) {
195195
if (prop.key.name === 'controller') {
196196
elements = prop.value.elements;
197197
if (elements.length) {
198198
elementLength = elements.length - 1;
199199
}
200-
prop.value.elements.forEach(function (element) {
200+
prop.value.elements.forEach(function(element) {
201201
if (element.type === 'FunctionExpression') {
202202
parameters = element.params;
203203
}
@@ -216,7 +216,7 @@ module.exports = {
216216
}
217217

218218
if (matchNames) {
219-
var invalidArray = parameters.filter(function (e, i) {
219+
var invalidArray = parameters.filter(function(e, i) {
220220
var name = e.name;
221221

222222
if (stripUnderscores) {
@@ -236,9 +236,9 @@ module.exports = {
236236
}
237237
}
238238
},
239-
AssignmentExpression: function (node) {
239+
AssignmentExpression: function(node) {
240240
maybeNoteInjection(node);
241-
},
241+
}
242242
};
243-
}),
243+
})
244244
};

0 commit comments

Comments
 (0)