Skip to content
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
15 changes: 15 additions & 0 deletions src/rules/lowercase-name.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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