Skip to content

Commit 0856689

Browse files
MrHensindresorhus
authored andcommitted
Add defaults to schema (#258)
1 parent 3e8db20 commit 0856689

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

rules/assertion-arguments.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ const schema = [{
141141
enum: [
142142
'always',
143143
'never'
144-
]
144+
],
145+
default: undefined
145146
}
146147
}
147148
}];

rules/max-asserts.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ const {visitIf} = require('enhance-visitors');
33
const util = require('../util');
44
const createAvaRule = require('../create-ava-rule');
55

6+
const MAX_ASSERTIONS_DEFAULT = 5;
7+
68
const notAssertionMethods = ['plan', 'end'];
79

810
const create = context => {
911
const ava = createAvaRule();
10-
const maxAssertions = context.options[0] || 5;
12+
// TODO: Convert options to object JSON Schema default works properly
13+
// https://github.com/avajs/eslint-plugin-ava/issues/260
14+
const maxAssertions = context.options[0] || MAX_ASSERTIONS_DEFAULT;
1115
let assertionCount = 0;
1216
let nodeToReport;
1317

@@ -55,9 +59,12 @@ const create = context => {
5559
});
5660
};
5761

58-
const schema = [{
59-
type: 'integer'
60-
}];
62+
const schema = [
63+
{
64+
type: 'integer',
65+
default: MAX_ASSERTIONS_DEFAULT
66+
}
67+
];
6168

6269
module.exports = {
6370
create,

rules/test-title-format.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,25 @@ const create = context => {
3535
});
3636
};
3737

38+
const schema = [
39+
{
40+
type: 'object',
41+
properties: {
42+
format: {
43+
type: 'string',
44+
default: undefined
45+
}
46+
}
47+
}
48+
];
49+
3850
module.exports = {
3951
create,
4052
meta: {
4153
type: 'suggestion',
4254
docs: {
4355
url: util.getDocsUrl(__filename)
44-
}
56+
},
57+
schema
4558
}
4659
};

0 commit comments

Comments
 (0)