Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 1.87 KB

factory-name.md

File metadata and controls

59 lines (38 loc) · 1.87 KB

factory-name - require and specify a prefix for all factory names

All your factorys 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 factorys by "$" (reserved keyword for AngularJS services) ("factory-name": [2, "ng"]) *

Styleguide Reference

Examples

The following patterns are not considered problems when configured "prefix":

/*eslint angular/factory-name: [2,"prefix"]*/

// valid
angular.module('myModule').factory('prefixFactory', function () {
    // ...
});

The following patterns are considered problems when configured "/^xyz/":

/*eslint angular/factory-name: [2,"/^xyz/"]*/

// invalid
angular.module('myModule').factory('otherFactory', function () {
    // ...
}); // error: The otherFactory factory should follow this pattern: /^xyz/

The following patterns are not considered problems when configured "/^xyz/":

/*eslint angular/factory-name: [2,"/^xyz/"]*/

// valid
angular.module('myModule').factory('xyzFactory', function () {
    // ...
});

The following patterns are considered problems when configured "xyz":

/*eslint angular/factory-name: [2,"xyz"]*/

// invalid
angular.module('myModule').factory('myFactory', function () {
    // ...
}); // error: The myFactory factory should be prefixed by xyz

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links