Skip to content

Commit

Permalink
3.1.1: Disable arrow-parens,no-path-concat,no-prototype-builtins,impo…
Browse files Browse the repository at this point in the history
…rt/newline-after-import and import/imports-first,react/forbid-prop-types,react/no-danger for react
  • Loading branch information
foray1010 committed Sep 23, 2016
1 parent 113677b commit 28dee76
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-config-aftership",
"description": "AfterShip ESLint config (modified from Airbnb)",
"version": "3.1.0",
"version": "3.1.1",
"homepage": "https://github.com/AfterShip/eslint-config-aftership",
"author": {
"name": "AfterShip",
Expand Down
13 changes: 13 additions & 0 deletions react.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ module.exports = extendConfig({
window: false
},
rules: {
// we alias some local folders to modules, for example `project-root/src/app` => `app`
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
'import/imports-first': 'off',

// it fails with inject-loader
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': 'off',

// for array, sometime it is not all the same type
// for object, it is very painful to define the object structure every time
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
'react/forbid-prop-types': 'off',

// Use tab instead of 2 space when indenting jsx elements
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
'react/jsx-indent': ['error', 'tab'],
Expand All @@ -40,6 +49,10 @@ module.exports = extendConfig({
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
'react/jsx-no-bind': 'off',

// we need to use dangerouslySetInnerHTML sometime
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
'react/no-danger': 'off',

// Will move to `error` when `isMounted` is deprecated
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
'react/no-is-mounted': 'error',
Expand Down
12 changes: 12 additions & 0 deletions rules/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
// http://eslint.org/docs/rules/no-console
'no-console': 'off',

// http://eslint.org/docs/rules/no-prototype-builtins
'no-prototype-builtins': 'off',

// http://eslint.org/docs/rules/valid-typeof
'valid-typeof': ['error', {
requireStringLiterals: false
Expand Down Expand Up @@ -86,6 +89,9 @@ module.exports = {
// http://eslint.org/docs/rules/no-mixed-requires
'no-mixed-requires': 'error',

// http://eslint.org/docs/rules/no-path-concat
'no-path-concat': 'off',

/*+++++++++++++++++++
+ Stylistic Issues +
+++++++++++++++++++*/
Expand Down Expand Up @@ -130,6 +136,9 @@ module.exports = {
// http://eslint.org/docs/rules/arrow-body-style
'arrow-body-style': 'off',

// http://eslint.org/docs/rules/arrow-parens
'arrow-parens': 'off',

// http://eslint.org/docs/rules/object-shorthand
'object-shorthand': 'off',

Expand Down Expand Up @@ -162,6 +171,9 @@ module.exports = {
/*++++++++++++++++
+ Other plugins +
++++++++++++++++*/
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'off',

// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
'import/no-extraneous-dependencies': 'off'
}
Expand Down
45 changes: 43 additions & 2 deletions why-we-choose-these-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [Possible Errors](#possible-errors)
- [comma-dangle](#comma-dangle)
- [no-console](#no-console)
- [no-prototype-builtins](#no-prototype-builtins)
- [valid-typeof](#valid-typeof)
- [Best Practices](#best-practices)
- [class-methods-use-this](#class-methods-use-this)
Expand All @@ -24,9 +25,10 @@
- [no-shadow](#no-shadow)
- [no-unused-vars](#no-unused-vars)
- [no-use-before-define](#no-use-before-define)
- [Variables](#variables-1)
- [Node.js and CommonJS](#nodejs-and-commonjs)
- [global-require](#global-require)
- [no-mixed-requires](#no-mixed-requires)
- [no-path-concat](#no-path-concat)
- [Stylistic Issues](#stylistic-issues)
- [camelcase](#camelcase)
- [func-names](#func-names)
Expand All @@ -41,6 +43,7 @@
- [quote-props](#quote-props)
- [ECMAScript 6](#ecmascript-6)
- [arrow-body-style](#arrow-body-style)
- [arrow-parens](#arrow-parens)
- [object-shorthand](#object-shorthand)
- [prefer-arrow-callback](#prefer-arrow-callback)
- [prefer-const](#prefer-const)
Expand All @@ -50,6 +53,7 @@
- [Legacy](#legacy)
- [max-len](#max-len)
- [Other plugins](#other-plugins)
- [import/newline-after-import](#importnewline-after-import)
- [import/no-extraneous-dependencies](#importno-extraneous-dependencies)

<!-- /MarkdownTOC -->
Expand All @@ -75,6 +79,14 @@ Example: http://eslint.org/docs/rules/no-console

We use it a lot, it is difficult for us to enable this rules

### no-prototype-builtins
```
'no-prototype-builtins': 'off'
```
Example: http://eslint.org/docs/rules/no-prototype-builtins

we never use an object that shadows an Object.prototype method or which does not inherit from Object.prototype

### valid-typeof
```
'valid-typeof': ['error', {
Expand Down Expand Up @@ -222,7 +234,7 @@ Example: http://eslint.org/docs/rules/no-use-before-define

We may need to use the function before we define it, check `js hoisting`

## Variables
## Node.js and CommonJS

### global-require
```
Expand All @@ -241,6 +253,15 @@ Example: http://eslint.org/docs/rules/no-mixed-requires

to group require together for better readability

### no-path-concat
```
'no-path-concat': 'error'
```
Example: http://eslint.org/docs/rules/no-path-concat

1. frontend doesn't have `path` module
2. we don't use `Windows`, we don't care about `Windows`

## Stylistic Issues

### camelcase
Expand Down Expand Up @@ -341,6 +362,14 @@ Example: http://eslint.org/docs/rules/arrow-body-style

should not force developer to remove the scope for arrow function because sometime we do it for clearer code

### arrow-parens
```
'arrow-parens': 'off'
```
Example: http://eslint.org/docs/rules/arrow-parens

let developer decide when to add bracket

### object-shorthand
```
'object-shorthand': 'off'
Expand Down Expand Up @@ -404,6 +433,18 @@ We all have a large iMac screen, so setting 200 as max length is fair

## Other plugins

### import/newline-after-import
```
'import/newline-after-import': 'off'
```
Example: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md

it breaks a lot of our code because we may group like:
```js
const AftershipError = require('aftership-error');
const AftershipPrivateError = AftershipError.PrivateError;
```

### import/no-extraneous-dependencies
```
'import/no-extraneous-dependencies': 'off'
Expand Down

0 comments on commit 28dee76

Please sign in to comment.