Skip to content

Commit f232cff

Browse files
author
Micael Rodrigues
committed
Update tests to consider prettier rules
1 parent e795921 commit f232cff

File tree

2 files changed

+86
-91
lines changed

2 files changed

+86
-91
lines changed

test/fixtures/correct.js

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ try {
6565
noop();
6666
}
6767

68-
noop(function *() { return yield noop(); });
68+
noop(function* () {
69+
return yield noop();
70+
});
6971

7072
// `capitalized-comments`.
7173

@@ -109,8 +111,8 @@ noop(DelimiterDangleType);
109111
noop(DelimiterDangleInterface);
110112

111113
// `generator-star-spacing`
112-
noop(function *() {});
113-
noop(function *foo() {});
114+
noop(function* () {});
115+
noop(function* foo() {});
114116
noop({ *foo() {} });
115117

116118
// `id-match`.
@@ -159,7 +161,7 @@ function funcThatReturns(bar) {
159161
funcThatReturns('foo');
160162

161163
// `no-class-assign`.
162-
class NoClassAssign { }
164+
class NoClassAssign {}
163165

164166
noop(NoClassAssign);
165167

@@ -179,15 +181,13 @@ if (noConstantCondition) {
179181

180182
// `no-dupe-class-members`.
181183
class NoDupeClassMembers {
182-
183184
bar() {
184185
return 'bar';
185186
}
186187

187188
foo() {
188189
return 'foo';
189190
}
190-
191191
}
192192

193193
noop(NoDupeClassMembers);
@@ -217,12 +217,10 @@ noop();
217217
const NoThisBeforeSuper = require('no-this-before-super');
218218

219219
class Child extends NoThisBeforeSuper {
220-
221220
constructor() {
222221
super();
223222
this.foo = 'bar';
224223
}
225-
226224
}
227225

228226
noop(Child);
@@ -260,13 +258,12 @@ noop(operatorLineBreak);
260258

261259
// `padded-blocks`.
262260
class PaddedBlocks {
263-
264261
constructor() {
265262
switch (true) {
266-
default: noop();
263+
default:
264+
noop();
267265
}
268266
}
269-
270267
}
271268

272269
noop(new PaddedBlocks());
@@ -332,7 +329,7 @@ const sortObjectProps = {
332329
noop(sortObjectProps);
333330

334331
// `space-before-function-paren`.
335-
(function() {
332+
(function () {
336333
noop();
337334
})();
338335

@@ -378,11 +375,6 @@ const templateCurlySpacing = 'foo';
378375

379376
noop(`${templateCurlySpacing}`);
380377

381-
// `wrap-iife`.
382-
(function() {
383-
noop();
384-
})();
385-
386378
// `sort-destructure-keys/sort-destructure-keys`.
387379
const props = { KeyA: 1, keyA: 2, keyB: 3, keyZ: 4 };
388380
const { KeyA, keyA, keyB, keyZ, ...rest } = props;
@@ -430,39 +422,29 @@ function useHook() {
430422
noop(RulesOfHooks, useHook);
431423

432424
// `react/jsx-curly-brace-presence`.
433-
const CurlyBracePresence = () => (
434-
<div foo={'bar'} />
435-
);
425+
const CurlyBracePresence = () => <div foo={'bar'} />;
436426

437427
noop(CurlyBracePresence);
438428

439429
// `react/jsx-no-literals`.
440-
const NoLiterals = () => (
441-
<div>
442-
{'qux'}
443-
</div>
444-
);
430+
const NoLiterals = () => <div>{'qux'}</div>;
445431

446432
noop(NoLiterals);
447433

448434
// `react/jsx-tag-spacing`.
449-
const TagSpacing = () => (
450-
<div />
451-
);
435+
const TagSpacing = () => <div />;
452436

453437
noop(TagSpacing);
454438

455439
// `react/prefer-stateless-function`.
456440
class PreferStatelessFunction extends React.Component {
457-
458441
getFoo = () => {
459442
return 'foo';
460-
}
443+
};
461444

462445
render() {
463446
return this.getFoo();
464447
}
465-
466448
}
467449

468450
noop(PreferStatelessFunction);

test/index.js

Lines changed: 73 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const path = require('path');
1212
*/
1313

1414
describe('eslint-config-seegno', () => {
15-
const linter = new CLIEngine({ configFile: path.join(__dirname, '..', 'src', 'index.js') });
15+
const linter = new CLIEngine({
16+
configFile: path.join(__dirname, '..', 'src', 'index.js')
17+
});
1618

1719
it('should not generate any violation for correct code', () => {
1820
const source = path.join(__dirname, 'fixtures', 'correct.js');
@@ -23,38 +25,44 @@ describe('eslint-config-seegno', () => {
2325
it('should generate violations for environment-specific rules', () => {
2426
const source = path.join(__dirname, 'fixtures', 'environment.js');
2527

26-
Array.from(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId)).should.eql([
27-
'linebreak-style',
28-
'linebreak-style',
29-
'linebreak-style',
30-
'linebreak-style',
31-
'eol-last'
28+
Array.from(
29+
linter
30+
.executeOnFiles([source])
31+
.results[0].messages.map(violation => violation.ruleId)
32+
).should.eql([
33+
'prettier/prettier',
34+
'prettier/prettier',
35+
'prettier/prettier',
36+
'prettier/prettier',
37+
'prettier/prettier'
3238
]);
3339
});
3440

3541
it('should generate violations for incorrect code', () => {
3642
const source = path.join(__dirname, 'fixtures', 'incorrect.js');
3743

38-
Array.from(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId)).should.eql([
39-
'array-bracket-spacing',
40-
'arrow-parens',
41-
'brace-style',
44+
Array.from(
45+
linter
46+
.executeOnFiles([source])
47+
.results[0].messages.map(violation => violation.ruleId)
48+
).should.eql([
49+
'prettier/prettier',
50+
'prettier/prettier',
51+
'prettier/prettier',
4252
'capitalized-comments',
43-
'comma-dangle',
44-
'comma-spacing',
45-
'comma-style',
53+
'prettier/prettier',
54+
'prettier/prettier',
55+
'prettier/prettier',
56+
'prettier/prettier',
4657
'consistent-this',
4758
'curly',
59+
'prettier/prettier',
4860
'dot-notation',
49-
'flowtype/delimiter-dangle',
50-
'flowtype/delimiter-dangle',
51-
'generator-star-spacing',
52-
'generator-star-spacing',
53-
'generator-star-spacing',
54-
'generator-star-spacing',
55-
'generator-star-spacing',
61+
'prettier/prettier',
62+
'prettier/prettier',
63+
'prettier/prettier',
5664
'id-match',
57-
'indent',
65+
'prettier/prettier',
5866
'jest/no-disabled-tests',
5967
'jest/no-disabled-tests',
6068
'jest/no-disabled-tests',
@@ -66,71 +74,73 @@ describe('eslint-config-seegno', () => {
6674
'jest/no-disabled-tests',
6775
'jest/no-focused-tests',
6876
'mocha/no-exclusive-tests',
69-
'mocha/no-exclusive-tests',
7077
'jest/no-focused-tests',
78+
'mocha/no-exclusive-tests',
7179
'jest/no-focused-tests',
7280
'mocha/no-exclusive-tests',
7381
'jest/no-focused-tests',
7482
'jest/no-focused-tests',
7583
'jest/no-identical-title',
76-
'key-spacing',
77-
'keyword-spacing',
84+
'prettier/prettier',
85+
'prettier/prettier',
7886
'no-new',
7987
'new-cap',
8088
'new-with-error/new-with-error',
8189
'newline-before-return',
90+
'prettier/prettier',
8291
'no-class-assign',
8392
'no-console',
8493
'no-const-assign',
8594
'no-constant-condition',
95+
'prettier/prettier',
8696
'no-dupe-class-members',
97+
'prettier/prettier',
8798
'no-empty',
8899
'no-labels',
89100
'no-labels',
90-
'no-multi-spaces',
101+
'prettier/prettier',
91102
'no-multi-str',
92-
'no-multiple-empty-lines',
93-
'no-spaced-func',
103+
'prettier/prettier',
104+
'prettier/prettier',
105+
'prettier/prettier',
94106
'no-this-before-super',
107+
'prettier/prettier',
95108
'no-undef',
109+
'prettier/prettier',
96110
'no-underscore-dangle',
111+
'prettier/prettier',
97112
'no-unused-vars',
98-
'object-curly-spacing',
99-
'object-curly-spacing',
113+
'prettier/prettier',
100114
'one-var',
101-
'one-var-declaration-per-line',
102-
'operator-linebreak',
103-
'padded-blocks',
104-
'padded-blocks',
105-
'padded-blocks',
106-
'padded-blocks',
107-
'padded-blocks',
108-
'padded-blocks',
115+
'prettier/prettier',
116+
'prettier/prettier',
117+
'prettier/prettier',
118+
'prettier/prettier',
119+
'prettier/prettier',
120+
'prettier/prettier',
109121
'padding-line-between-statements',
110-
'quote-props',
111-
'quote-props',
112-
'quote-props',
113-
'quote-props',
122+
'prettier/prettier',
123+
'prettier/prettier',
124+
'prettier/prettier',
125+
'prettier/prettier',
126+
'prettier/prettier',
114127
'quotes',
115-
'semi',
116-
'semi-spacing',
117-
'semi-spacing',
128+
'prettier/prettier',
129+
'prettier/prettier',
118130
'sort-imports-es6/sort-imports-es6',
119131
'sort-keys',
120-
'space-before-blocks',
121-
'space-before-function-paren',
122-
'space-in-parens',
123-
'space-in-parens',
124-
'space-infix-ops',
125-
'space-unary-ops',
132+
'prettier/prettier',
133+
'prettier/prettier',
134+
'prettier/prettier',
135+
'prettier/prettier',
126136
'spaced-comment',
127137
'sql-template/no-unsafe-query',
128138
'switch-case/newline-between-switch-case',
129139
'no-fallthrough',
130140
'switch-case/newline-between-switch-case',
131-
'template-curly-spacing',
132-
'template-curly-spacing',
133-
'wrap-iife',
141+
'prettier/prettier',
142+
'prettier/prettier',
143+
'prettier/prettier',
134144
'sort-destructure-keys/sort-destructure-keys',
135145
'yoda',
136146
'react-hooks/exhaustive-deps',
@@ -142,14 +152,17 @@ describe('eslint-config-seegno', () => {
142152
'react-hooks/rules-of-hooks',
143153
'react-hooks/rules-of-hooks',
144154
'react-hooks/rules-of-hooks',
155+
'prettier/prettier',
145156
'react/jsx-curly-brace-presence',
157+
'prettier/prettier',
146158
'react/jsx-no-literals',
147-
'react/jsx-tag-spacing',
148-
'react/jsx-tag-spacing',
149-
'react/jsx-tag-spacing',
150-
'react/jsx-tag-spacing',
151-
'react/jsx-tag-spacing',
152-
'react/prefer-stateless-function'
159+
'prettier/prettier',
160+
'prettier/prettier',
161+
'prettier/prettier',
162+
'prettier/prettier',
163+
'react/prefer-stateless-function',
164+
'prettier/prettier',
165+
'prettier/prettier'
153166
]);
154167
});
155168
});

0 commit comments

Comments
 (0)