Skip to content

Commit cab75b9

Browse files
committed
After many discussions, we’ve came to a point where we’re ready to release the 1.0.0 version of this linter config.
1 parent dc81796 commit cab75b9

2 files changed

Lines changed: 41 additions & 12 deletions

File tree

packages/eslint-config-transit/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ module.exports = {
88
sourceType: 'script',
99
},
1010
rules: {
11-
'brace-style': 'off',
12-
'max-len': ['error', 105, 2],
1311
'no-param-reassign': 'off',
1412
'no-use-before-define': 'off',
13+
'radix': 'off',
14+
'max-len': ['error', 120, 2],
15+
'quote-props': ['error', 'consistent-as-needed'],
16+
'no-restricted-syntax': [
17+
'error',
18+
'ForInStatement',
19+
'LabeledStatement',
20+
'WithStatement',
21+
],
1522
'comma-dangle': ['error', {
1623
arrays: 'always-multiline',
1724
objects: 'always-multiline',
Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
11
'use strict';
22

3-
// # Whitespace
4-
// Limit your lines to 105 characters
3+
// Limit your lines to 120 characters
4+
testMyStringLikeYouNeverTestedItBefore();
5+
56
function testMyStringLikeYouNeverTestedItBefore() {
6-
const string = 'The path of the righteous man is beset on all sides by the iniquities of the ' +
7-
'selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, ' +
8-
'shepherds the weak through the valley of darkness, for he is truly his brother\'s ' +
9-
'keeper and the finder of lost children. And I will strike down upon thee with great' +
10-
'vengeance and furious anger those who would attempt to poison and destroy My brothers.';
7+
const string = 'The path of the righteous man is beset on all sides by the iniquities of the selfish and the ' +
8+
'tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the ' +
9+
'valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down ' +
10+
'upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers.';
1111

1212
return string;
1313
}
1414

15-
testMyStringLikeYouNeverTestedItBefore();
15+
// Don't require the `radix` argument for `parseInt`.
16+
// Both forms should be acceptable.
17+
parseInt('10');
18+
parseInt('10', 10);
1619

1720
// Use function before declaration
1821
functionDefinedBeforeUse();
1922

2023
function functionDefinedBeforeUse() {
24+
// Quotes in object properties
25+
// If one property needs quotes, then we'll require quotes on any properties for the same object.
26+
const obj = {
27+
'foo word': 'bar',
28+
'other foo': 'bar2',
29+
'foo': 'bar',
30+
};
31+
32+
// If none of them require quotes, then quotes are disallowed.
33+
const anotherObject = Object.assign({}, obj, {
34+
foo: 'bar',
35+
foo2: 'bar2',
36+
foo3: 'bar3',
37+
});
2138

39+
return anotherObject;
2240
}
2341

2442
// Allowing to reassign parameter
@@ -29,8 +47,7 @@ function reassignParameter(value) {
2947
// Curly braces with if else
3048
if (reassignParameter) {
3149
reassignParameter();
32-
}
33-
else {
50+
} else {
3451
functionDefinedBeforeUse();
3552
}
3653

@@ -44,3 +61,8 @@ function testMyTrailingComma(
4461
}
4562

4663
testMyTrailingComma();
64+
65+
// Allowing for...of loops.
66+
for (const item of [() => {}, () => {}, () => {}]) {
67+
item();
68+
}

0 commit comments

Comments
 (0)