Skip to content

Commit

Permalink
Merge pull request #220 from Gillespie59/development
Browse files Browse the repository at this point in the history
0.12.0
  • Loading branch information
EmmanuelDemey committed Sep 15, 2015
2 parents 6b00af6 + 0af4a9e commit 044621c
Show file tree
Hide file tree
Showing 114 changed files with 2,850 additions and 1,829 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
253 changes: 253 additions & 0 deletions .eslintrc
@@ -0,0 +1,253 @@
env:
node: true

rules:
# http://eslint.org/docs/rules/#possible-errors
comma-dangle:
- 2
- never
no-cond-assign: 2
no-console: 1
no-constant-condition: 2
no-control-regex: 2
no-debugger: 1
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-empty-character-class: 2
no-empty: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens:
- 0
no-extra-semi: 2
no-func-assign: 2
no-inner-declarations: 2
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-negated-in-lhs: 2
no-obj-calls: 2
no-regex-spaces: 2
no-reserved-keys: 0
no-sparse-arrays: 2
no-unreachable: 1
use-isnan: 2
valid-jsdoc: 0
valid-typeof: 2

# http://eslint.org/docs/rules/#best-practices
accessor-pairs:
- 2
- getWithoutSet: false
setWithoutGet: true
block-scoped-var: 2
complexity: 0
consistent-return: 0
curly:
- 2
- all
default-case: 0
dot-notation: 2
dot-location:
- 2
- property
eqeqeq: 2
guard-for-in: 0
no-alert: 1
no-caller: 2
no-div-regex: 0
no-else-return: 2
labeled: 0
no-eq-null: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-fallthrough: 2
no-floating-decimal: 2
no-implied-eval: 2
no-iterator: 2
no-labels: 2
no-lone-blocks: 2
no-loop-func: 2
no-multi-spaces: 2
no-native-reassign: 2
no-new-func: 2
no-new-wrappers: 2
no-new: 0
no-octal-escape: 2
no-octal: 2
no-param-reassign: 0
no-process-env: 0
no-proto: 0
no-redeclare: 2
no-return-assign: 2
no-script-url: 2
no-self-compare: 2
no-sequences: 2
no-throw-literal: 2
no-unused-expressions: 2
no-void: 2
no-warning-comments: 0
no-with: 2
radix: 0
vars-on-top: 0
wrap-iife:
- 2
- outside
yoda: 2

strict:
- 2
- global

# http://eslint.org/docs/rules/#variables
no-catch-shadow: 2
no-delete-var: 2
# Can't occur, because 'no-labels' is enabled.
no-label-var: 0
no-shadow-restricted-names: 2
no-shadow: 2
no-undef-init: 2
no-undef: 2
no-undefined: 0
no-unused-vars:
- 2
- vars: all
args: after-used
no-use-before-define: 0

# http://eslint.org/docs/rules/#nodejs
callback-return: 2
handle-callback-err:
- 2
- ^(e|err|error)$
no-mixed-requires:
- 2
- true
no-new-require: 2
no-path-concat: 2
no-process-exit: 2
no-restricted-modules: 0
no-sync: 0

# http://eslint.org/docs/rules/#stylistic-issues
brace-style:
- 2
- 1tbs
- allowSingleLine: false
camelcase:
- 2
- properties: always
comma-spacing:
- 2
- before: false
after: true
comma-style:
- 2
- last
computed-property-spacing:
- 2
- never
consistent-this:
- 0
eol-last: 2
func-names: 0
func-style:
- 2
- declaration
indent:
- 2
- 4
- SwitchCase: 4
key-spacing:
- 2
- beforeColon: false
afterColon: true
lines-around-comment: 0
linebreak-style:
- 2
- unix
max-nested-callbacks: 0
new-cap: 2
new-parens: 2
newline-after-var: 0
no-array-constructor: 2
no-continue: 0
no-lonely-if: 2
# Implied by 'indent'
no-mixed-spaces-and-tabs: 0
no-multiple-empty-lines:
- 2
- max: 2
no-nested-ternary: 2
no-new-object: 2
no-spaced-func: 2
no-ternary: 0
no-trailing-spaces: 2
no-underscore-dangle: 0
no-unneeded-ternary: 2
object-curly-spacing:
- 2
- never
one-var:
- 2
- never
operator-assignment:
- 2
- always
operator-linebreak:
- 2
- after
padded-blocks:
- 2
- never
quote-props:
- 2
- as-needed
quotes:
- 2
- single
- avoid-escape
semi-spacing:
- 2
- before: false
after: true
semi: 2
sort-vars:
- 2
- ignoreCase: true
space-after-keywords:
- 2
- always
space-before-blocks:
- 2
- always
space-before-function-paren:
- 2
- never
space-in-parens:
- 2
- never
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops:
- 2
- words: true
nonwords: false
spaced-comment:
- 1
- always
wrap-regex: 0

# http://eslint.org/docs/rules/#legacy
max-depth: 0
max-len:
- 0
- 120
- 4
- ignoreComments: false
ignoreUrls: true
max-params: 0
max-statements: 0
no-bitwise: 0
no-plusplus: 0
12 changes: 10 additions & 2 deletions README.md
Expand Up @@ -116,6 +116,7 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
"angular/di": [2, "function"],
"angular/di-order": [0, true],
"angular/directive-name": 0,
"angular/directive-restrict": [0, {"restrict": "AE", "explicit": "never"}],
"angular/component-limit": [0, 1],
"angular/document-service": 2,
"angular/empty-controller": 0,
Expand All @@ -126,13 +127,16 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
"angular/interval-service": 2,
"angular/json-functions": 2,
"angular/log": 2,
"angular/module-dependency-order": [0, {"grouped": true, "prefix": null}],
"angular/module-getter": 2,
"angular/module-name": 0,
"angular/module-setter": 2,
"angular/no-angular-mock": 0,
"angular/no-controller": 0,
"angular/no-cookiestore": 2,
"angular/no-digest": 2,
"angular/no-http-callback": 2,
"angular/no-inline-template": [0, {"allowSimple": true}],
"angular/no-jquery-angularelement": 2,
"angular/no-private-call": 2,
"angular/no-service-method": 2,
Expand Down Expand Up @@ -171,6 +175,7 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
| di | All your DI should use the same syntax : the Array or function syntaxes ("di": [2, "function or array"])|
| di-order | 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_`. |
| directive-name | 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) ("directive-name": [2, "ng"]) [Y073](https://github.com/johnpapa/angular-styleguide#style-y073), [Y126](https://github.com/johnpapa/angular-styleguide#style-y126) |
| directive-restrict | Not all directive restrictions may be desirable. Also it might be desirable to define default restrictions, or explicitly not. The default configuration limits the restrictions `AE` [Y074](https://github.com/johnpapa/angular-styleguide#style-y074) and disallows explicitly specifying a default. ("directive-restrict": [0, {"restrict": "AE", "explicit": "never"}]) |
| document-service | Instead of the default document object, you should prefer the AngularJS wrapper service $document. [Y180](https://github.com/johnpapa/angular-styleguide#style-y180) |
| empty-controller | If you have one empty controller, maybe you have linked it in your Router configuration or in one of your views. You can remove this declaration because this controller is useless |
| file-name | All your file names should match the angular component name. The second parameter can be a config object [2, {nameStyle: 'dash', typeSeparator: 'dot', ignoreTypeSuffix: true, ignorePrefix: 'ui'}] to match 'avenger-profile.directive.js' or 'avanger-api.service.js'. Possible values for 'typeSeparator' and 'nameStyle' are 'dot', 'dash' and 'underscore'. The options 'ignoreTypeSuffix' ignores camel cased suffixes like 'someController' or 'myService' and 'ignorePrefix' ignores namespace prefixes like 'ui'. [Y120](https://github.com/johnpapa/angular-styleguide#style-y120) [Y121](https://github.com/johnpapa/angular-styleguide#style-y121) |
Expand All @@ -180,13 +185,16 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
| interval-service | Instead of the default setInterval function, you should use the AngularJS wrapper service $interval [Y181](https://github.com/johnpapa/angular-styleguide#style-y181) |
| json-functions | You should use angular.fromJson or angular.toJson instead of JSON.parse and JSON.stringify |
| log | You should use $log service instead of console for the methods 'log', 'debug', 'error', 'info', 'warn' |
| module-dependency-order | Module dependencies should be sorted in a logical manner. This rule provides two ways to sort modules, grouped or ungrouped. In grouped mode the modules should be grouped in the order: standard modules - third party modules - custom modules. The modules should be sorted alphabetically within its group. A prefix can be specified to determine which prefix the custom modules have. Without grouped set to `false` all dependencies combined should be sorted alphabetically. ('module-dependency-order', [2, {grouped: true, prefix: "app"}]) |
| module-getter | When using a module, avoid using a variable and instead use chaining with the getter syntax [Y022](https://github.com/johnpapa/angular-styleguide#style-y022)|
| module-name | When you create a new module, its name should start 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 modules by "ng" (reserved keyword for AngularJS modules) ("module-name": [2, "ng"]) [Y127](https://github.com/johnpapa/angular-styleguide#style-y127)|
| module-setter | Declare modules without a variable using the setter syntax.[Y021](https://github.com/johnpapa/angular-styleguide#style-y021) |
| no-angular-mock | All methods defined in the angular.mock object are also available in the object window. So you can remove angular.mock from your code |
| no-controller | According to the Component-First pattern, we should avoid the use of AngularJS controller. |
| no-cookiestore | In Angular 1.4, the $cookieStore service is now deprected. Please use the $cookies service instead|
| no-digest | DEPRECATED! The scope's $digest() method shouldn't be used. You should prefer the $apply method. |
| no-http-callback | Disallow the $http success and error function. Instead the standard promise API should be used. |
| no-inline-template | Instead of using inline HTML templates, it is better to load the HTML from an external file. Simple HTML templates are accepted by default. ('no-inline-template': [0, {allowSimple: true}]) |
| no-jquery-angularelement | You should not wrap angular.element object into jQuery(), because angular.element already return jQLite element|
| no-private-call | All scope's properties/methods starting with $$ are used internally by AngularJS. You should not use them directly. Exception can be allowed with this option: {allow:['$$watchers']} |
| no-service-method | You should prefer the factory() method instead of service() [Y040](https://github.com/johnpapa/angular-styleguide#style-y040)|
Expand Down Expand Up @@ -226,10 +234,10 @@ All contributions should be pushed in the current GIT branch.

Here are the things you should do before sending a Pull Request with a new Rule :

- Create a JavaScript file for the new rule in the rules directory (the name of the file should be prefixed by 'ng' for Angular 1 rules, or 'ng2' for Angular 2 rules)
- Create a JavaScript file for the new rule in the rules directory
- Create an unit test for this rule in the test directory (with the same name)
- Update the main index.js file, in order to add the new rule in the 'rules' property, and set the default configuration in the rulesConfig property
- Update the "Rules" part of the README.md file with a small description of the rule and its default configuration.
- Update the "Rules" part of the README.md file with a small description of the rule and its default configuration. In this file, you have to add your rule in the default JSON configuration object.

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.

Expand Down
20 changes: 10 additions & 10 deletions demo/grunt/Gruntfile.js
@@ -1,16 +1,16 @@
(function () {
'use strict';

module.exports = function(grunt) {

grunt.initConfig({
eslint: {
options: {
},
target: ['app/**/*.js']
}
});
grunt.initConfig({
eslint: {
options: {
},
target: ['app/**/*.js']
}
});

grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);
};
})();
14 changes: 7 additions & 7 deletions demo/grunt/app/index.js
@@ -1,14 +1,14 @@
(function(){
'use strict';

angular.module('AppModule', [])
.controller('appCtrl', function(){
var variable;
angular.module('AppModule', [])
.controller('appCtrl', function(){
var variable;

if(variable === undefined){
if(variable === undefined){


}
}

});
});
})();

0 comments on commit 044621c

Please sign in to comment.