Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Commit 8ee64dd

Browse files
Introducing the TORMENT style guide!
Not suitable for the weak-minded or sensitive.
1 parent 843b755 commit 8ee64dd

File tree

2 files changed

+51
-43
lines changed

2 files changed

+51
-43
lines changed

coding-styles/torment.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* js-coding-standards
3+
*
4+
* @author Robert Rossmann <[email protected]>
5+
* @copyright 2016 STRV
6+
* @license http://choosealicense.com/licenses/bsd-3-clause BSD-3-Clause License
7+
*/
8+
9+
'use strict'
10+
11+
// You are crazy and you know it. You take pride in it. These rules will take eslint to the next
12+
// level of strictness and you will feel its presence in every keystroke. You will fear what it
13+
// throws at you next and you will revel in that fear.
14+
//
15+
// You have been warned.
16+
module.exports = {
17+
extends: 'javascript/coding-styles/base',
18+
19+
rules: {
20+
// Enforce/Disallow Variable Initializations
21+
// You think you can get away with uninitialised variables? Hah! Forget it, dude!
22+
'init-declarations': 1,
23+
24+
// Disallow Shadowing of Variables Inside of catch
25+
// No. Make up a new variable name.
26+
'no-catch-shadow': 1,
27+
28+
// Limit Maximum Number of Statements
29+
// Hit this limit? You are doing it wrong -> refactor!
30+
'max-statements': [1, 15],
31+
32+
// Disallow use of negated expressions in conditions
33+
'no-negated-condition': 1,
34+
35+
// Variable Sorting
36+
// Of course you should sort your vars! It makes your code look more like poetry!
37+
'sort-vars': 1,
38+
39+
// Disallow Magic Numbers
40+
// Nope. Define them as constants. Or something.
41+
'no-magic-numbers': 2,
42+
43+
// Require Radix Parameter
44+
'radix': 1,
45+
46+
// Require Regex Literals to be Wrapped
47+
'wrap-regex': 1
48+
}
49+
}

unused.js

+2-43
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,7 @@
99
'use strict'
1010

1111
module.exports = {
12-
'rules': {
13-
// Enforce/Disallow Variable Initializations
14-
// Unused, too restrictive. On frequent occasions, you need to declare a property uninitialised and
15-
// give it value later.
16-
'init-declarations': 0,
17-
18-
// Disallow Shadowing of Variables Inside of catch
19-
// In IE 8 and earlier, the catch clause parameter can overwrite the value of a variable in the
20-
// outer scope, if that variable has the same name as the catch clause parameter.
21-
// Unused, front-end specific. Should be moved to appropriate front-end config as soon as it
22-
// exists.
23-
'no-catch-shadow': 0,
24-
12+
rules: {
2513
// Treat var as Block Scoped
2614
// Unused in favour of `no-var` rule. Front-end could have some interest in this rule.
2715
'block-scoped-var': 0,
@@ -63,10 +51,6 @@ module.exports = {
6351
// exists.
6452
'no-script-url': 0,
6553

66-
// Limit Maximum Number of Statements
67-
// Unused, too restrictive.
68-
'max-statements': 0,
69-
7054
// Disallow ++ and --
7155
// Unused, these operators are quite useful as long as whitespace is used responsibly around them.
7256
'no-plusplus': 0,
@@ -93,33 +77,8 @@ module.exports = {
9377
// Unused, continue seems to be quite useful.
9478
'no-continue': 0,
9579

96-
// Disallow use of negated expressions in conditions
97-
// Unused, too restrictive.
98-
'no-negated-condition': 0,
99-
10080
// Disallow Ternary Operators
10181
// You kidding me? Ternaries are great!
102-
'no-ternary': 0,
103-
104-
// Variable Sorting
105-
// Unused, too restrictive.
106-
'sort-vars': 0,
107-
108-
// Disallow Magic Numbers
109-
// Unused, too restrictive. It was flagging i.e. `array.indexOf('a') !== -1` (is 'a' in this array?)
110-
// as errors. Also, status code checks in HTTP responses were being reported as issues.
111-
// While I generally like the idea, current implementation simply won't fly well.
112-
'no-magic-numbers': 0,
113-
114-
// Require Radix Parameter
115-
// This rule is aimed at preventing the unintended conversion of a string to a number of a
116-
// different base than intended.
117-
// Unused, too restrictive. Front-end team might have some interest in this as the whole radix
118-
// issue started with different browsers using different radix for different numbers.
119-
'radix': 0,
120-
121-
// Require Regex Literals to be Wrapped
122-
// Unused, too restrictive.
123-
'wrap-regex': 0
82+
'no-ternary': 0
12483
}
12584
}

0 commit comments

Comments
 (0)