Skip to content

Add defaults to schema #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rules/assertion-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ const schema = [{
enum: [
'always',
'never'
]
],
default: undefined
}
}
}];
Expand Down
15 changes: 11 additions & 4 deletions rules/max-asserts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ const {visitIf} = require('enhance-visitors');
const util = require('../util');
const createAvaRule = require('../create-ava-rule');

const MAX_ASSERTIONS_DEFAULT = 5;

const notAssertionMethods = ['plan', 'end'];

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

Expand Down Expand Up @@ -55,9 +59,12 @@ const create = context => {
});
};

const schema = [{
type: 'integer'
}];
const schema = [
{
type: 'integer',
default: MAX_ASSERTIONS_DEFAULT
}
];

module.exports = {
create,
Expand Down
15 changes: 14 additions & 1 deletion rules/test-title-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,25 @@ const create = context => {
});
};

const schema = [
{
type: 'object',
properties: {
format: {
type: 'string',
default: undefined
}
}
}
];

module.exports = {
create,
meta: {
type: 'suggestion',
docs: {
url: util.getDocsUrl(__filename)
}
},
schema
}
};