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
Showing
6 changed files
with
120 additions
and
130 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,97 @@ | ||
module.exports = { | ||
extends: [ | ||
'airbnb-base', | ||
'plugin:flowtype/recommended' | ||
], | ||
|
||
plugins: [ | ||
'flowtype' | ||
], | ||
|
||
rules: { | ||
/* es6 related */ | ||
// require parens in arrow function arguments | ||
// https://eslint.org/docs/rules/arrow-parens | ||
'arrow-parens': ['error', 'as-needed', { | ||
requireForBlockBody: false, | ||
}], | ||
|
||
/* styles related */ | ||
// prettier takes care of it | ||
// https://eslint.org/docs/rules/object-curly-newline | ||
'object-curly-newline': ['off', { | ||
ObjectExpression: { minProperties: 4, multiline: true, consistent: true }, | ||
ObjectPattern: { minProperties: 4, multiline: true, consistent: true }, | ||
ImportDeclaration: { minProperties: 4, multiline: true, consistent: true }, | ||
ExportDeclaration: { minProperties: 4, multiline: true, consistent: true }, | ||
}], | ||
|
||
// disallow dangling underscores in identifiers | ||
// https://eslint.org/docs/rules/no-underscore-dangle | ||
'no-underscore-dangle': ['error', { | ||
allow: [], | ||
allowAfterThis: true, | ||
allowAfterSuper: false, | ||
enforceInMethodNames: false, | ||
}], | ||
|
||
// specify the maximum length of a line in your program | ||
// https://eslint.org/docs/rules/max-len | ||
'max-len': ['error', { | ||
code: 120, | ||
tabWidth: 4, | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreRegExpLiterals: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
}], | ||
|
||
// require trailing commas in multiline object literals | ||
// https://eslint.org/docs/rules/comma-dangle | ||
'comma-dangle': ['error', { | ||
arrays: 'only-multiline', | ||
objects: 'only-multiline', | ||
imports: 'only-multiline', | ||
exports: 'never', | ||
functions: 'never', | ||
}], | ||
|
||
// disallow certain syntax forms | ||
// https://eslint.org/docs/rules/no-restricted-syntax | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'ForInStatement', | ||
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', | ||
}, | ||
/* | ||
{ | ||
selector: 'ForOfStatement', | ||
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', | ||
}, | ||
*/ | ||
{ | ||
selector: 'LabeledStatement', | ||
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', | ||
}, | ||
{ | ||
selector: 'WithStatement', | ||
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', | ||
}, | ||
], | ||
|
||
// enforces new line after each method call in the chain to make it | ||
// more readable and easy to maintain | ||
// https://eslint.org/docs/rules/newline-per-chained-call | ||
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 2 }], | ||
|
||
// require or disallow an empty line between class members | ||
// https://eslint.org/docs/rules/lines-between-class-members | ||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
|
||
// disallow use of unary operators, ++ and -- | ||
// https://eslint.org/docs/rules/no-plusplus | ||
'no-plusplus': ["error", { "allowForLoopAfterthoughts": 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,19 @@ | ||
{ | ||
"name": "@magpie/code-style", | ||
"version": "1.0.0", | ||
"repository": "https://github.com/AVykhrystyuk/magpie/tree/master/packages/code-style", | ||
"author": "Alexey Vykhrystyuk <AVykhrystyuk@gmail.com>", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-flowtype": "^3.8.2", | ||
"eslint-plugin-import": "^2.17.2" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^4.19.1 || ^5.3.0", | ||
"eslint-plugin-import": "^2.14.0" | ||
}, | ||
"engines": { | ||
"node": ">= 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
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
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
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