Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
// in describe
describe('a test', () => {
expect(1).toBe(1);
});
// below other tests
describe('a test', () => {
it('an it', () => {
expect(1).toBe(1);
});
expect(1).toBe(1);
});// in it block
describe('a test', () => {
it('an it', () => {
expect(1).toBe(1);
});
});
// in helper function
describe('a test', () => {
const helper = () => {
expect(1).toBe(1);
};
it('an it', () => {
helper();
});
});
describe('a test', () => {
beforeEach(() => {
expect.hasAssertions();
});
});Popular · 1 of 50
Disallow using expect outside of it or test blocks
// in describe
describe('a test', () => {
expect(1).toBe(1);
});
// below other tests
describe('a test', () => {
it('an it', () => {
expect(1).toBe(1);
});
expect(1).toBe(1);
});// in it block
describe('a test', () => {
it('an it', () => {
expect(1).toBe(1);
});
});
// in helper function
describe('a test', () => {
const helper = () => {
expect(1).toBe(1);
};
it('an it', () => {
helper();
});
});
describe('a test', () => {
beforeEach(() => {
expect.hasAssertions();
});
});