Skip to content

Commit e901d03

Browse files
bradzacherSimenB
authored andcommitted
fix: add missing schemas so rule config is properly validated (#291)
1 parent 9cba626 commit e901d03

29 files changed

+53
-0
lines changed

src/rules/lowercase-name.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ module.exports = {
5555
messages: {
5656
unexpectedLowercase: '`{{ method }}`s should begin with lowercase',
5757
},
58+
schema: [
59+
{
60+
type: 'object',
61+
properties: {
62+
ignore: {
63+
type: 'array',
64+
items: {
65+
enum: ['describe', 'test', 'it'],
66+
},
67+
additionalItems: false,
68+
},
69+
},
70+
additionalProperties: false,
71+
},
72+
],
5873
fixable: 'code',
5974
},
6075
create(context) {

src/rules/no-alias-methods.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
replaceAlias: `Replace {{ replace }}() with its canonical name of {{ canonical }}()`,
1212
},
1313
fixable: 'code',
14+
schema: [],
1415
},
1516
create(context) {
1617
// The Jest methods which have aliases. The canonical name is the first

src/rules/no-commented-out-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
messages: {
1717
commentedTests: 'Some tests seem to be commented',
1818
},
19+
schema: [],
1920
},
2021
create(context) {
2122
const sourceCode = context.getSourceCode();

src/rules/no-disabled-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
disabledSuite: 'Disabled test suite',
1818
disabledTest: 'Disabled test',
1919
},
20+
schema: [],
2021
},
2122
create(context) {
2223
let suiteDepth = 0;

src/rules/no-empty-title.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
describe: 'describe should not have an empty title',
2020
test: 'test should not have an empty title',
2121
},
22+
schema: [],
2223
},
2324
create(context) {
2425
return {

src/rules/no-focused-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
messages: {
2828
focusedTest: 'Unexpected focused test.',
2929
},
30+
schema: [],
3031
},
3132
create: context => ({
3233
CallExpression(node) {

src/rules/no-identical-title.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = {
5454
multipleDescribeTitle:
5555
'Describe block title is used multiple times in the same describe block.',
5656
},
57+
schema: [],
5758
},
5859
create(context) {
5960
const contexts = [newDescribeContext()];

src/rules/no-jasmine-globals.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
'Illegal usage of `pending`, prefer explicitly skipping a test using `test.skip`',
2020
illegalJasmine: 'Illegal usage of jasmine global',
2121
},
22+
schema: [],
2223
},
2324
create(context) {
2425
return {

src/rules/no-jest-import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
messages: {
1111
unexpectedImport: `Jest is automatically in scope. Do not import "jest", as Jest doesn't export anything.`,
1212
},
13+
schema: [],
1314
},
1415
create(context) {
1516
return {

src/rules/no-large-snapshots.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ module.exports = {
3030
tooLongSnapshots:
3131
'Expected Jest snapshot to be smaller than {{ lineLimit }} lines but was {{ lineCount }} lines long',
3232
},
33+
schema: [
34+
{
35+
type: 'object',
36+
properties: {
37+
maxSize: {
38+
type: 'number',
39+
},
40+
},
41+
additionalProperties: false,
42+
},
43+
],
3344
},
3445
create(context) {
3546
if (context.getFilename().endsWith('.snap')) {

src/rules/no-mocks-import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
messages: {
1616
noManualImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use jest.mock and import from the original module path.`,
1717
},
18+
schema: [],
1819
},
1920
create(context) {
2021
return {

src/rules/no-test-callback.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
illegalTestCallback: 'Illegal usage of test callback',
1212
},
1313
fixable: 'code',
14+
schema: [],
1415
},
1516
create(context) {
1617
return {

src/rules/no-test-prefixes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
usePreferredName: 'Use "{{ preferredNodeName }}" instead',
1212
},
1313
fixable: 'code',
14+
schema: [],
1415
},
1516
create(context) {
1617
return {

src/rules/no-test-return-statement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
messages: {
2525
noReturnValue: 'Jest tests should not return a value.',
2626
},
27+
schema: [],
2728
},
2829
create(context) {
2930
return {

src/rules/no-truthy-falsy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
messages: {
1818
avoidMessage: 'Avoid {{methodName}}',
1919
},
20+
schema: [],
2021
},
2122
create(context) {
2223
return {

src/rules/prefer-called-with.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
messages: {
1111
preferCalledWith: 'Prefer {{name}}With(/* expected args */)',
1212
},
13+
schema: [],
1314
},
1415
create(context) {
1516
return {

src/rules/prefer-expect-assertions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = {
4949
haveExpectAssertions:
5050
'Every test should have either `expect.assertions(<number of assertions>)` or `expect.hasAssertions()` as its first expression',
5151
},
52+
schema: [],
5253
},
5354
create(context) {
5455
return {

src/rules/prefer-inline-snapshots.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
toMatchError: 'Use toThrowErrorMatchingInlineSnapshot() instead',
1313
},
1414
fixable: 'code',
15+
schema: [],
1516
},
1617
create(context) {
1718
return {

src/rules/prefer-spy-on.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = {
3131
useJestSpyOn: 'Use jest.spyOn() instead.',
3232
},
3333
fixable: 'code',
34+
schema: [],
3435
},
3536
create(context) {
3637
return {

src/rules/prefer-strict-equal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
useToStrictEqual: 'Use toStrictEqual() instead',
1212
},
1313
fixable: 'code',
14+
schema: [],
1415
},
1516
create(context) {
1617
return {

src/rules/prefer-to-be-null.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
useToBeNull: 'Use toBeNull() instead',
2222
},
2323
fixable: 'code',
24+
schema: [],
2425
},
2526
create(context) {
2627
return {

src/rules/prefer-to-be-undefined.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
useToBeUndefined: 'Use toBeUndefined() instead',
2222
},
2323
fixable: 'code',
24+
schema: [],
2425
},
2526
create(context) {
2627
return {

src/rules/prefer-to-contain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ module.exports = {
8787
useToContain: 'Use toContain() instead',
8888
},
8989
fixable: 'code',
90+
schema: [],
9091
},
9192
create(context) {
9293
return {

src/rules/prefer-to-have-length.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
useToHaveLength: 'Use toHaveLength() instead',
1919
},
2020
fixable: 'code',
21+
schema: [],
2122
},
2223
create(context) {
2324
return {

src/rules/prefer-todo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = {
5252
'Prefer todo test case over unimplemented test case',
5353
},
5454
fixable: 'code',
55+
schema: [],
5556
},
5657
create(context) {
5758
return {

src/rules/require-tothrow-message.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
messages: {
1111
requireRethrow: 'Add an error message to {{ propertyName }}()',
1212
},
13+
schema: [],
1314
},
1415
create(context) {
1516
return {

src/rules/valid-describe.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports = {
3939
unexpectedReturnInDescribe:
4040
'Unexpected return statement in describe callback',
4141
},
42+
schema: [],
4243
},
4344
create(context) {
4445
return {

src/rules/valid-expect-in-promise.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ module.exports = {
131131
returnPromise:
132132
'Promise should be returned to test its fulfillment or rejection',
133133
},
134+
schema: [],
134135
},
135136
create(context) {
136137
return {

src/rules/valid-expect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
propertyWithoutMatcher: '"{{ propertyName }}" needs to call a matcher.',
2424
matcherOnPropertyNotCalled: '"{{ propertyName }}" was not called.',
2525
},
26+
schema: [],
2627
},
2728
create(context) {
2829
return {

0 commit comments

Comments
 (0)