Skip to content

Commit

Permalink
Updated eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
n4kz committed Oct 7, 2019
1 parent 8bbb173 commit 2aff5da
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 5 deletions.
192 changes: 188 additions & 4 deletions .eslintrc
@@ -1,27 +1,211 @@
{
'parser': 'babel-eslint',

'env': {
'es6': true,
'react-native/react-native': true,
},

'plugins': [
'react',
'react-native'
],

'globals': {
'require': true,
},

'extends': [
'eslint:recommended',
'plugin:react/recommended',
],

'settings': {
'react': {
'version': '16.9',
},
},

'rules': {
'no-unused-vars': ['error', {
'vars': 'all',
'args': 'none',
'ignoreRestSiblings': true,
}],

'no-console': ['error'],

/*
* let foo = [1];
* let bar = [
* 1,
* ];
*/
'array-bracket-newline': ['error', 'consistent'],

/*
* let foo = [1, 2, 3];
*/
'array-bracket-spacing': ['error', 'never'],

/*
* if (foo) { bar() }
*/
'block-spacing': ['error', 'always'],

/*
* if (foo) {
* bar();
* } else {
* baz();
* }
*/
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],

/*
* let foo = [
* 1,
* ];
*/
'comma-dangle': ['error', 'always-multiline'],

/*
* let foo = [1, 2];
*/
'comma-spacing': ['error', { 'before': false, 'after': true }],

/*
* let foo,
* bar,
* baz;
*/
'comma-style': ['error', 'last'],

/*
* let foo = bar[bar];
*/
'computed-property-spacing': ['error', 'never'],

/*
* let that = this;
*/
'consistent-this': ['error', 'that'],

/*
* call();
*/
'func-call-spacing': ['error', 'never'],

/*
* function bar() { 1; }
* let bar = () => 1;
*/
'func-style': ['error', 'declaration', { 'allowArrowFunctions': true }],

/*
* foo(1);
* bar(
* 2, 3
* );
*/
'function-paren-newline': ['error', 'consistent'],

/*
* () => 1;
*/
'implicit-arrow-linebreak': ['error', 'beside'],

/*
* [
* 1
* ]
*/
'indent': ['warn', 2, { 'SwitchCase': 1 }],

/*
* <View name='foo' />
*/
'jsx-quotes': ['error', 'prefer-single'],

/*
* let foo = { bar: true };
*/
'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],

/*
* if (foo) { return; }
*/
'keyword-spacing': ['error', { 'before': true, 'after': true }],

'linebreak-style': ['error', 'unix'],

'lines-between-class-members': ['error', 'always'],

'max-len': ['warn', { 'code': 100, 'ignoreTrailingComments': true }],

/*
* foo(1, 2, 3, 4, 5);
*/
'max-params': ['error', { 'max': 6 }],

'max-statements-per-line': ['error', { 'max': 1 }],

'new-parens': ['error'],

'no-trailing-spaces': ['error'],

'no-whitespace-before-property': ['error'],

/*
* let foo = { bar, baz };
*/
'object-curly-newline': ['error', { 'consistent': true }],
'object-curly-spacing': ['error', 'always'],
'object-property-newline': ['error', { 'allowAllPropertiesOnSameLine': true }],

/*
* let foo = 'bar'
* + 'baz';
*/
'operator-linebreak': ['error', 'before', { 'overrides': { '?': 'after', ':': 'after' } }],

/*
* 'bar'
*/
'quotes': ['warn', 'single'],

/*
* 1;
*/
'semi': ['warn', 'always'],
'semi-spacing': ['error', { 'before': false, 'after': true }],
'semi-style': ['error', 'last'],

/*
* () => {
* };
*/
'space-before-blocks': ['error', 'always'],

/*
* foo(1, 2, 3);
*/
'space-before-function-paren': ['error', {
'anonymous': 'always',
'named': 'never',
'asyncArrow': 'always',
}],

/*
* foo('bar');
*/
'space-in-parens': ['error', 'never'],

/*
* switch (a) {
* case 0: break;
* }
*/
'switch-colon-spacing': ['error', { 'after': true, 'before': false }],

'react-native/no-unused-styles': ['warn'],
'react-native/no-inline-styles': ['warn'],
},
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -34,7 +34,8 @@
"devDependencies": {
"babel-eslint": "^10.0.0",
"eslint": "^6.4.0",
"eslint-plugin-react": "^7.1.0"
"eslint-plugin-react": "^7.1.0",
"eslint-plugin-react-native": "^3.7.0"
},

"scripts": {
Expand Down

0 comments on commit 2aff5da

Please sign in to comment.