-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0c424e8
Showing
21 changed files
with
408 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
readme.md merge=union |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- "5" | ||
- "4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
extends: [ | ||
'eslint-config-airbnb/base', | ||
'./rules/best-practices', | ||
'./rules/es6', | ||
'./rules/style' | ||
].map(require.resolve), | ||
parser: 'babel-eslint' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: [ | ||
'eslint-config-airbnb', | ||
'./base', | ||
'./rules/react' | ||
].map(require.resolve) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Neil Kistner <neil.kistner@gmail.com> (neilkistner.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "eslint-config-wyze", | ||
"version": "0.0.0", | ||
"description": "My personal ESLint config.", | ||
"license": "MIT", | ||
"repository": "wyze/eslint-config-wyze", | ||
"author": { | ||
"name": "Neil Kistner", | ||
"email": "neil.kistner@gmail.com", | ||
"url": "neilkistner.com" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"pretest": "eslint test", | ||
"test": "ava" | ||
}, | ||
"files": [ | ||
"rules", | ||
"*.js" | ||
], | ||
"eslintConfig": { | ||
"extends": "./base.js" | ||
}, | ||
"dependencies": { | ||
"babel-eslint": "^5.0.0", | ||
"eslint-config-airbnb": "^6.0.0", | ||
"eslint-plugin-wyze": "^1.0.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^2.0.0", | ||
"eslint-plugin-react": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.12.0", | ||
"eslint": "^2.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# eslint-config-wyze | ||
|
||
[![Build Status][travis-image]][travis-url] | ||
[![npm][npm-image]][npm-url] | ||
[![dependencies][deps-image]][deps-url] | ||
[![devDependencies][depsdev-image]][depsdev-url] | ||
|
||
> My personal [ESLint](//github.com/eslint/eslint) settings. | ||
## Installation | ||
|
||
There are `peerDependencies` on `eslint` and `eslint-plugin-react`. | ||
|
||
```shell | ||
$ npm i --save-dev eslint-config-wyze eslint-plugin-react eslint | ||
``` | ||
|
||
## Usage | ||
|
||
### package.json | ||
|
||
```js | ||
{ | ||
// ... | ||
"eslintConfig": { | ||
"extends": "wyze" | ||
} | ||
} | ||
``` | ||
|
||
### .eslintrc | ||
|
||
```js | ||
{ | ||
"extends": "wyze" | ||
} | ||
``` | ||
|
||
## License | ||
|
||
Copyright © 2016 [Neil Kistner](//github.com/wyze) | ||
|
||
Released under the MIT license. See [license](license) for details. | ||
|
||
[travis-image]: https://img.shields.io/travis/wyze/eslint-config-wyze.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/wyze/eslint-config-wyze | ||
|
||
[npm-image]: https://img.shields.io/npm/v/eslint-config-wyze.svg?style=flat-square | ||
[npm-url]: https://npmjs.com/package/eslint-config-wyze | ||
|
||
[deps-image]: https://img.shields.io/david/wyze/eslint-config-wyze.svg?style=flat-square | ||
[deps-url]: https://david-dm.org/wyze/eslint-config-wyze | ||
|
||
[depsdev-image]: https://img.shields.io/david/dev/wyze/eslint-config-wyze.svg?style=flat-square | ||
[depsdev-url]: https://david-dm.org/wyze/eslint-config-wyze#info=devDependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
'rules': { | ||
// Blacklist certain identifiers to prevent them being used | ||
// http://eslint.org/docs/rules/id-blacklist | ||
'id-blacklist': [2, | ||
'callback', | ||
'cb', | ||
'data', | ||
'e', | ||
'err' | ||
], | ||
// disallow unmodified conditions of loops | ||
// http://eslint.org/docs/rules/no-unmodified-loop-condition | ||
'no-unmodified-loop-condition': 2 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = { | ||
'parserOptions': { | ||
'ecmaFeatures': { | ||
'generators': true | ||
} | ||
}, | ||
'plugins': [ | ||
'wyze' | ||
], | ||
'rules': { | ||
// require parens in arrow function arguments | ||
'arrow-parens': [2, 'as-needed'], | ||
// disallow arrow functions where they could be confused with comparisons | ||
// http://eslint.org/docs/rules/no-confusing-arrow | ||
'no-confusing-arrow': 0, | ||
// suggest using the spread operator instead of .apply() | ||
'prefer-spread': 2, | ||
// enforce usage of spacing in template strings | ||
// http://eslint.org/docs/rules/template-curly-spacing | ||
'template-curly-spacing': [2, 'never'], | ||
// import sorting | ||
// http://eslint.org/docs/rules/sort-imports | ||
// disabled in favor of `wyze/sort-imports` | ||
'sort-imports': 0, | ||
// import sorting by default vs named | ||
// https://github.com/wyze/eslint-plugin-wyze/docs/rules/sort-imports.md | ||
'wyze/sort-imports': 2 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module.exports = { | ||
'rules': { | ||
// Prevent missing displayName in a React component definition | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md | ||
'react/display-name': 2, | ||
// Forbid certain propTypes (any, array, object) | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md | ||
'react/forbid-prop-types': [2, { 'forbid': ['any', 'array', 'object'] }], | ||
// Enforce or disallow spaces inside of curly braces in JSX attributes | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md | ||
'react/jsx-curly-spacing': [2, 'never', { 'allowMultiline': true }], | ||
// Enforce or disallow spaces around equal signs in JSX attributes | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md | ||
'react/jsx-equals-spacing': [2, 'never'], | ||
// Validate JSX indentation | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md | ||
'react/jsx-indent': [2, 2], | ||
// Validate JSX has key prop when in array or iterator | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md | ||
'react/jsx-key': 2, | ||
// Prevent duplicate props in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md | ||
'react/jsx-no-duplicate-props': 2, | ||
// Enforce PascalCase for user-defined JSX components | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md | ||
'react/jsx-pascal-case': 2, | ||
// Enforce props alphabetical sorting | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md | ||
'react/jsx-sort-props': [2, { | ||
'callbacksLast': true, | ||
'shorthandFirst': true | ||
}], | ||
// Validate spacing before closing bracket in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md | ||
'react/jsx-space-before-closing': [2, 'always'], | ||
// Prevent usage of dangerous JSX properties | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md | ||
'react/no-danger': 2, | ||
// Prevent direct mutation of this.state | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md | ||
'react/no-direct-mutation-state': 2, | ||
// Prevent usage of setState | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md | ||
'react/no-set-state': 1, | ||
// Prevent using string references | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md | ||
'react/no-string-refs': 2, | ||
// Enforce propTypes declarations alphabetical sorting | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md | ||
'react/sort-prop-types': [2, { | ||
'requiredFirst': true | ||
}] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = { | ||
'rules': { | ||
// enforce spacing inside array brackets | ||
'array-bracket-spacing': [2, 'always', { | ||
'objectsInArrays': false, | ||
'arraysInArrays': false | ||
}], | ||
// specify the maximum length of a line in your program | ||
// https://github.com/eslint/eslint/blob/master/docs/rules/max-len.md | ||
'max-len': [2, 80, 2, { | ||
'ignoreUrls': true, | ||
'ignoreComments': false | ||
}], | ||
// require or disallow use of semicolons instead of ASI | ||
// I use Babel, it takes care of this for me | ||
'semi': [2, 'never'], | ||
// space around the keywords. | ||
// http://github.com/eslint/eslint/blob/master/docs/rules/keyword-spacing.md | ||
'keyword-spacing': [2, { | ||
'before': true, | ||
'after': true, | ||
'overrides': { | ||
'case': { 'after': true }, | ||
'return': { 'after': true }, | ||
'throw': { 'after': true } | ||
} | ||
}], | ||
// require or disallow spaces inside parentheses | ||
// disabled, because this rule is strange | ||
// TODO: write and implement a better rule | ||
'space-in-parens': 0 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
'rules': { | ||
// disallow var and named functions in global scope | ||
// http://eslint.org/docs/rules/no-implicit-globals | ||
'no-implicit-globals': 2, | ||
// disallow use of variables before they are defined | ||
'no-use-before-define': [2, 'nofunc'] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import base from '../base' | ||
import test from 'ava' | ||
|
||
test('extends length', async t => { | ||
const expected = 4 | ||
|
||
t.is(base.extends.length, expected, 'Incorrect number of rulesets') | ||
}) | ||
|
||
test('extends files', async t => { | ||
const rulesets = [ | ||
'eslint-config-airbnb/base.js', | ||
'/rules/best-practices.js', | ||
'/rules/es6.js', | ||
'/rules/style.js', | ||
] | ||
|
||
for ( const expected of rulesets ) { | ||
const index = rulesets.indexOf(expected) | ||
|
||
t.ok( | ||
~base.extends[index].indexOf(expected), | ||
`${expected} not found in extends` | ||
) | ||
} | ||
}) | ||
|
||
test('parser', async t => { | ||
const expected = 'babel-eslint' | ||
|
||
t.is(base.parser, expected, `parser is not set to ${expected}`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import main from '../' | ||
import test from 'ava' | ||
|
||
test('extends length', async t => { | ||
const expected = 3 | ||
|
||
t.is(main.extends.length, expected, 'Incorrect number of rulesets') | ||
}) | ||
|
||
test('extends files', async t => { | ||
const rulesets = [ | ||
'eslint-config-airbnb/index.js', | ||
'/base.js', | ||
'/rules/react.js', | ||
] | ||
|
||
for ( const expected of rulesets ) { | ||
const index = rulesets.indexOf(expected) | ||
|
||
t.ok( | ||
~main.extends[index].indexOf(expected), | ||
`${expected} not found in extends` | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { rules } from '../../rules/best-practices' | ||
import test from 'ava' | ||
|
||
test('no react rules', async t => { | ||
for ( const rule in rules ) { | ||
if ( rules.hasOwnProperty(rule) ) { | ||
t.notOk(~rule.indexOf('react/'), 'found react rule in undesired file') | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { parserOptions, rules } from '../../rules/es6' | ||
import test from 'ava' | ||
|
||
test('no react rules', async t => { | ||
for ( const rule in rules ) { | ||
if ( rules.hasOwnProperty(rule) ) { | ||
t.notOk(~rule.indexOf('react/'), 'found react rule in undesired file') | ||
} | ||
} | ||
}) | ||
|
||
test('enable generator support', async t => { | ||
const expected = { | ||
ecmaFeatures: { | ||
generators: true, | ||
}, | ||
} | ||
|
||
t.same(parserOptions, expected, 'parserOptions is not enabling generators') | ||
}) |
Oops, something went wrong.