Skip to content
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

fix: add missing schemas so rule config is properly validated #291

Merged
merged 1 commit into from Jul 4, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/rules/lowercase-name.js
Expand Up @@ -55,6 +55,21 @@ module.exports = {
messages: {
unexpectedLowercase: '`{{ method }}`s should begin with lowercase',
},
schema: [
{
type: 'object',
properties: {
ignore: {
type: 'array',
items: {
enum: ['describe', 'test', 'it'],
},
additionalItems: false,
},
},
additionalProperties: false,
},
],
fixable: 'code',
},
create(context) {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-alias-methods.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
replaceAlias: `Replace {{ replace }}() with its canonical name of {{ canonical }}()`,
},
fixable: 'code',
schema: [],
},
create(context) {
// The Jest methods which have aliases. The canonical name is the first
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-commented-out-tests.js
Expand Up @@ -16,6 +16,7 @@ module.exports = {
messages: {
commentedTests: 'Some tests seem to be commented',
},
schema: [],
},
create(context) {
const sourceCode = context.getSourceCode();
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-disabled-tests.js
Expand Up @@ -17,6 +17,7 @@ module.exports = {
disabledSuite: 'Disabled test suite',
disabledTest: 'Disabled test',
},
schema: [],
},
create(context) {
let suiteDepth = 0;
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-empty-title.js
Expand Up @@ -19,6 +19,7 @@ module.exports = {
describe: 'describe should not have an empty title',
test: 'test should not have an empty title',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-focused-tests.js
Expand Up @@ -27,6 +27,7 @@ module.exports = {
messages: {
focusedTest: 'Unexpected focused test.',
},
schema: [],
},
create: context => ({
CallExpression(node) {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-identical-title.js
Expand Up @@ -54,6 +54,7 @@ module.exports = {
multipleDescribeTitle:
'Describe block title is used multiple times in the same describe block.',
},
schema: [],
},
create(context) {
const contexts = [newDescribeContext()];
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-jasmine-globals.js
Expand Up @@ -19,6 +19,7 @@ module.exports = {
'Illegal usage of `pending`, prefer explicitly skipping a test using `test.skip`',
illegalJasmine: 'Illegal usage of jasmine global',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-jest-import.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
messages: {
unexpectedImport: `Jest is automatically in scope. Do not import "jest", as Jest doesn't export anything.`,
},
schema: [],
},
create(context) {
return {
Expand Down
11 changes: 11 additions & 0 deletions src/rules/no-large-snapshots.js
Expand Up @@ -30,6 +30,17 @@ module.exports = {
tooLongSnapshots:
'Expected Jest snapshot to be smaller than {{ lineLimit }} lines but was {{ lineCount }} lines long',
},
schema: [
{
type: 'object',
properties: {
maxSize: {
type: 'number',
},
},
additionalProperties: false,
},
],
},
create(context) {
if (context.getFilename().endsWith('.snap')) {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-mocks-import.js
Expand Up @@ -15,6 +15,7 @@ module.exports = {
messages: {
noManualImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use jest.mock and import from the original module path.`,
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-test-callback.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
illegalTestCallback: 'Illegal usage of test callback',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-test-prefixes.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
usePreferredName: 'Use "{{ preferredNodeName }}" instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-test-return-statement.js
Expand Up @@ -24,6 +24,7 @@ module.exports = {
messages: {
noReturnValue: 'Jest tests should not return a value.',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-truthy-falsy.js
Expand Up @@ -17,6 +17,7 @@ module.exports = {
messages: {
avoidMessage: 'Avoid {{methodName}}',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-called-with.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
messages: {
preferCalledWith: 'Prefer {{name}}With(/* expected args */)',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-expect-assertions.js
Expand Up @@ -49,6 +49,7 @@ module.exports = {
haveExpectAssertions:
'Every test should have either `expect.assertions(<number of assertions>)` or `expect.hasAssertions()` as its first expression',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-inline-snapshots.js
Expand Up @@ -12,6 +12,7 @@ module.exports = {
toMatchError: 'Use toThrowErrorMatchingInlineSnapshot() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-spy-on.js
Expand Up @@ -31,6 +31,7 @@ module.exports = {
useJestSpyOn: 'Use jest.spyOn() instead.',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-strict-equal.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
useToStrictEqual: 'Use toStrictEqual() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-to-be-null.js
Expand Up @@ -21,6 +21,7 @@ module.exports = {
useToBeNull: 'Use toBeNull() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-to-be-undefined.js
Expand Up @@ -21,6 +21,7 @@ module.exports = {
useToBeUndefined: 'Use toBeUndefined() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-to-contain.js
Expand Up @@ -87,6 +87,7 @@ module.exports = {
useToContain: 'Use toContain() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-to-have-length.js
Expand Up @@ -18,6 +18,7 @@ module.exports = {
useToHaveLength: 'Use toHaveLength() instead',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-todo.js
Expand Up @@ -52,6 +52,7 @@ module.exports = {
'Prefer todo test case over unimplemented test case',
},
fixable: 'code',
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/require-tothrow-message.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
messages: {
requireRethrow: 'Add an error message to {{ propertyName }}()',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid-describe.js
Expand Up @@ -39,6 +39,7 @@ module.exports = {
unexpectedReturnInDescribe:
'Unexpected return statement in describe callback',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid-expect-in-promise.js
Expand Up @@ -131,6 +131,7 @@ module.exports = {
returnPromise:
'Promise should be returned to test its fulfillment or rejection',
},
schema: [],
},
create(context) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid-expect.js
Expand Up @@ -23,6 +23,7 @@ module.exports = {
propertyWithoutMatcher: '"{{ propertyName }}" needs to call a matcher.',
matcherOnPropertyNotCalled: '"{{ propertyName }}" was not called.',
},
schema: [],
},
create(context) {
return {
Expand Down