Last active
April 11, 2019 13:08
-
-
Save xterr/d58d3c5fef84fc70db3cf1c75976685b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"commonjs": true, | |
"es6": true, | |
"node": true, | |
"mocha": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"ecmaVersion": 2017, | |
"sourceType": "module" | |
}, | |
"rules": { | |
"indent": [ | |
"error", | |
4, | |
{ | |
"SwitchCase": 1 | |
} | |
], | |
"linebreak-style": [ | |
"error", | |
"unix" | |
], | |
"quotes": [ | |
"error", | |
"single" | |
], | |
"semi": [ | |
"error", | |
"always" | |
], | |
"no-unused-vars": [ | |
"warn" | |
], | |
"brace-style": ["error", "stroustrup"], | |
"comma-spacing": ["error", {"before": false, "after": true}], | |
"curly": ["warn", "multi-or-nest"], | |
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "align": "colon" }], | |
"no-multi-spaces": ["error", { "exceptions": { "VariableDeclarator": true, "ImportDeclaration": true} }], | |
"space-in-parens": ["error", "never"], | |
"object-curly-spacing": ["error", "always"], | |
"array-bracket-spacing": ["error", "never"], | |
"computed-property-spacing": ["error", "never"], | |
"space-unary-ops": ["error", {"words": true, "nonwords": false}], | |
"no-useless-catch": ["error"], | |
"no-throw-literal": ["error"] | |
} | |
} |
This file contains hidden or 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
let a = 1; | |
let b = 2; | |
let object = { | |
a : 1, | |
bc: 2 | |
}; | |
let c, d; | |
let arr = []; | |
let arr2 = ['foo', 'bar', 'baz']; | |
let arr3 = [['foo'], 'bar', 'baz']; | |
let arr4 = ['singleValue']; | |
let arr5 = [ | |
'foo', | |
'bar', | |
'baz' | |
]; | |
let obj = { one: 1, 'two': 2, three: 3 }; | |
let obj2 = { foo: { bar: 'baz' }, qux: 'quxx' }; | |
let obj3 = { | |
'myObjectFunction': function() { | |
// Do something | |
// | |
}, // These are two separate groups, so no alignment between `myObjectFuction` and `one` | |
'one' : 1, | |
'seven': 7 // `one` and `seven` are in their own group, and therefore aligned | |
}; | |
obj[a] = true; | |
function test(test) { | |
return test; | |
} | |
test(1, { bar: 'baz' }); | |
test([a, b], 1); | |
if (a === b) | |
test('message'); | |
if (a === b) { | |
test('message'); | |
test('message2'); | |
} | |
switch (a) { | |
case '1': | |
test('2'); | |
break; | |
case '2': | |
test('2'); | |
break; | |
default: | |
test('2'); | |
} | |
for (let i in object) { | |
test(i); | |
} | |
for ( | |
let i in object) { | |
test(i); | |
} | |
class TestClass { | |
} | |
try { | |
throw new Error('error'); | |
} | |
catch (e) { | |
test(e); // maybe log or smth, but don`t throw the exact same error | |
throw e; | |
} | |
let foo = {}; | |
// Word unary operator "delete" is followed by a whitespace. | |
delete foo.bar; | |
// Word unary operator "new" is followed by a whitespace. | |
new TestClass(); | |
// Word unary operator "void" is followed by a whitespace. | |
void 0; | |
// Unary operator "++" is not followed by whitespace. | |
++foo; | |
// Unary operator "--" is not preceded by whitespace. | |
foo--; | |
async function async(bar) { | |
await (bar); | |
} | |
function noObjectThrow() { | |
// this is a syntax error. Only Error objects are valid errors, for stack trace and all. Messages like the ones bellow are useless in debugging and in tools like sentry | |
throw "error"; | |
throw 0; | |
throw undefined; | |
throw null; | |
throw { 'error': 'error' }; | |
} | |
export default TestClass; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment