├── .babelrc ├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE.md ├── README.md ├── gulpfile.babel.js ├── index.js ├── package.json └── test └── test.js /.babelrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "presets": ["babel-preset-es2015"] 4 | } 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "dustinspecker/esnext" 4 | } 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | lib/ 3 | node_modules/ -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - 'stable' 5 | - '0.12' 6 | - '0.10' 7 | before_install: 8 | - npm install -g gulp 9 | after_success: npm run-script coveralls 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dustin Specker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # eslint-config-angular 2 | [![NPM version](https://badge.fury.io/js/eslint-config-angular.svg)](https://badge.fury.io/js/eslint-config-angular) [![Build Status](https://travis-ci.org/dustinspecker/eslint-config-angular.svg)](https://travis-ci.org/dustinspecker/eslint-config-angular) [![Coverage Status](https://img.shields.io/coveralls/dustinspecker/eslint-config-angular.svg)](https://coveralls.io/r/dustinspecker/eslint-config-angular?branch=master) 3 | 4 | [![Code Climate](https://codeclimate.com/github/dustinspecker/eslint-config-angular/badges/gpa.svg)](https://codeclimate.com/github/dustinspecker/eslint-config-angular) [![Dependencies](https://david-dm.org/dustinspecker/eslint-config-angular.svg)](https://david-dm.org/dustinspecker/eslint-config-angular/#info=dependencies&view=table) [![DevDependencies](https://david-dm.org/dustinspecker/eslint-config-angular/dev-status.svg)](https://david-dm.org/dustinspecker/eslint-config-angular/#info=devDependencies&view=table) 5 | 6 | > ESLint [shareable](http://eslint.org/docs/developer-guide/shareable-configs.html) config for [Angular plugin](https://github.com/Gillespie59/eslint-plugin-angular) 7 | 8 | ## Install 9 | ``` 10 | npm install --save-dev eslint-config-angular 11 | ``` 12 | **Also, need to install [eslint-plugin-angular](https://github.com/Gillespie59/eslint-plugin-angular).** 13 | 14 | ## Usage 15 | In your .eslintrc file: 16 | ```javascript 17 | { 18 | "extends": "angular" 19 | } 20 | ``` 21 | 22 | This config will 23 | - enable [eslint-plugin-angular](https://github.com/Gillespie59/eslint-plugin-angular) 24 | - add `angular` as a global variable 25 | - disable the `no-use-before-define` rule as recommended by [eslint-plugin-angular](https://github.com/Gillespie59/eslint-plugin-angular) 26 | 27 | All options from [index.js](index.js) may be overridden in your .eslintrc file. 28 | 29 | ## LICENSE 30 | MIT © [Dustin Specker](https://github.com/dustinspecker) -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | import babelCompiler from 'babel-core' 3 | import gulp from 'gulp' 4 | import eslint from 'gulp-eslint' 5 | import istanbul from 'gulp-istanbul' 6 | import mocha from 'gulp-mocha' 7 | 8 | const configFiles = './gulpfile.babel.js' 9 | , srcFiles = 'index.js' 10 | , testFiles = 'test/*.js' 11 | 12 | gulp.task('lint', () => 13 | gulp.src([configFiles, srcFiles, testFiles]) 14 | .pipe(eslint()) 15 | .pipe(eslint.failOnError()) 16 | ) 17 | 18 | gulp.task('build', ['lint']) 19 | 20 | gulp.task('test', ['build'], cb => { 21 | gulp.src(['index.js']) 22 | .pipe(istanbul()) 23 | .pipe(istanbul.hookRequire()) 24 | .on('finish', () => { 25 | gulp.src([testFiles]) 26 | .pipe(mocha({ 27 | compilers: { 28 | js: babelCompiler 29 | } 30 | })) 31 | .pipe(istanbul.writeReports()) 32 | .on('end', cb) 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | globals: { 5 | angular: true 6 | }, 7 | plugins: [ 8 | 'angular' 9 | ], 10 | rules: { 11 | 'angular/angularelement': 1, 12 | 'angular/controller-as': 2, 13 | 'angular/controller-as-route': 2, 14 | 'angular/controller-as-vm': [2, 'vm'], 15 | 'angular/controller-name': [2, '/[A-Z].*Controller$/'], 16 | 'angular/deferred': 0, 17 | 'angular/definedundefined': 2, 18 | 'angular/di': [2, 'function'], 19 | 'angular/di-order': [0, true], 20 | 'angular/directive-name': 0, 21 | 'angular/component-limit': [0, 1], 22 | 'angular/document-service': 2, 23 | 'angular/empty-controller': 0, 24 | 'angular/file-name': 0, 25 | 'angular/filter-name': 0, 26 | 'angular/foreach': 0, 27 | 'angular/function-type': 0, 28 | 'angular/interval-service': 2, 29 | 'angular/json-functions': 2, 30 | 'angular/log': 2, 31 | 'angular/module-getter': 2, 32 | 'angular/module-name': 0, 33 | 'angular/module-setter': 2, 34 | 'angular/no-angular-mock': 0, 35 | 'angular/no-controller': 0, 36 | 'angular/no-cookiestore': 2, 37 | 'angular/no-jquery-angularelement': 2, 38 | 'angular/no-private-call': 2, 39 | 'angular/no-service-method': 2, 40 | 'angular/no-services': [2, ['$http', '$resource', 'Restangular']], 41 | 'angular/on-watch': 2, 42 | 'angular/rest-service': 0, 43 | 'angular/service-name': 2, 44 | 'angular/timeout-service': 2, 45 | 'angular/typecheck-array': 2, 46 | 'angular/typecheck-date': 2, 47 | 'angular/typecheck-function': 2, 48 | 'angular/typecheck-number': 2, 49 | 'angular/typecheck-object': 2, 50 | 'angular/typecheck-string': 2, 51 | 'angular/watchers-execution': [0, '$digest'], 52 | 'angular/window-service': 2, 53 | 'no-use-before-define': 0 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-angular", 3 | "version": "0.5.0", 4 | "description": "ESLint shareable config for Angular plugin", 5 | "main": "index.js", 6 | "scripts": { 7 | "prepublish": "npm test", 8 | "test": "gulp test", 9 | "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/dustinspecker/eslint-config-angular.git" 14 | }, 15 | "keywords": [ 16 | "eslint", 17 | "eslintconfig" 18 | ], 19 | "author": "Dustin Specker", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/dustinspecker/eslint-config-angular/issues" 23 | }, 24 | "homepage": "https://github.com/dustinspecker/eslint-config-angular#readme", 25 | "dependencies": {}, 26 | "devDependencies": { 27 | "babel-core": "^6.0.12", 28 | "babel-eslint": "^6.0.0-beta.6", 29 | "babel-preset-es2015": "^6.0.14", 30 | "chai": "^3.0.0", 31 | "coveralls": "^2.11.2", 32 | "eslint-config-dustinspecker": "^1.1.0", 33 | "eslint-plugin-new-with-error": "^1.1.0", 34 | "eslint-plugin-no-use-extend-native": "^0.3.1", 35 | "eslint-plugin-xo": "^0.4.0", 36 | "gulp": "^3.9.0", 37 | "gulp-eslint": "^2.0.0", 38 | "gulp-istanbul": "^0.10.0", 39 | "gulp-mocha": "^2.1.0", 40 | "is-array": "^1.0.1", 41 | "is-plain-obj": "^1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | /* global describe, it */ 2 | 'use strict' 3 | import eslintConfigAngular from '../' 4 | import {expect} from 'chai' 5 | import isArray from 'is-array' 6 | import isPlainObj from 'is-plain-obj' 7 | 8 | describe('eslint-config-angular', () => { 9 | describe('main', () => { 10 | it('should be an object', () => { 11 | expect(isPlainObj(eslintConfigAngular)).to.eql(true) 12 | }) 13 | }) 14 | 15 | describe('globals', () => { 16 | it('should be an object', () => { 17 | expect(isPlainObj(eslintConfigAngular.globals)).to.eql(true) 18 | }) 19 | }) 20 | 21 | describe('plugins', () => { 22 | it('should be an array', () => { 23 | expect(isArray(eslintConfigAngular.plugins)).to.eql(true) 24 | }) 25 | }) 26 | 27 | describe('rules', () => { 28 | it('should be an object', () => { 29 | expect(isPlainObj(eslintConfigAngular.rules)).to.eql(true) 30 | }) 31 | }) 32 | }) 33 | --------------------------------------------------------------------------------