Skip to content

Commit 30ceabe

Browse files
committed
fix: use keywords in type-empty
1 parent e3c4980 commit 30ceabe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

source/rules/type-empty.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import ensureNotEmpty from '../library/ensure-not-empty';
22

33
export default (parsed, when) => {
44
const negated = when === 'never';
5+
const notEmpty = ensureNotEmpty(parsed.type);
56
return [
6-
ensureNotEmpty(parsed.type),
7+
negated ? notEmpty : !notEmpty,
78
[
89
'type',
910
negated ? 'may not' : 'must',

test/rules/type-empty.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const parsed = {
1212
filled: parse(messages.filled)
1313
};
1414

15-
test.failing('without type should succeed for empty keyword', t => {
15+
test('without type should succeed for empty keyword', t => {
1616
const [actual] = typeEmpty(parsed.empty);
1717
const expected = true;
1818
t.is(actual, expected);
@@ -24,13 +24,13 @@ test('without type should fail for "never"', t => {
2424
t.is(actual, expected);
2525
});
2626

27-
test.failing('without type should succeed for "always"', t => {
27+
test('without type should succeed for "always"', t => {
2828
const [actual] = typeEmpty(parsed.empty, 'always');
2929
const expected = true;
3030
t.is(actual, expected);
3131
});
3232

33-
test.failing('with type fail for empty keyword', t => {
33+
test('with type fail for empty keyword', t => {
3434
const [actual] = typeEmpty(parsed.filled);
3535
const expected = false;
3636
t.is(actual, expected);
@@ -42,7 +42,7 @@ test('with type succeed for "never"', t => {
4242
t.is(actual, expected);
4343
});
4444

45-
test.failing('with type fail for "always"', t => {
45+
test('with type fail for "always"', t => {
4646
const [actual] = typeEmpty(parsed.filled, 'always');
4747
const expected = false;
4848
t.is(actual, expected);

0 commit comments

Comments
 (0)