dangreenisrael / eslint-plugin-jest-formatting

ESLint rules for formatting test suites written for jest.
MIT License
156 stars 13 forks source link

Add `padding-around-before-all-blocks` rule #56

Closed dangreenisrael closed 5 years ago

dangreenisrael commented 5 years ago

This adds a padding-around-before-all-blocks to supersede padding-before-before-all-blocks

Examples of incorrect code for this rule:

const something = 123;
beforeAll(() => {
  // more stuff
});
describe('foo', () => {});

Examples of correct code for this rule:

const something = 123;

beforeAll(() => {
  // more stuff
});

describe('foo', () => {});
benkimpel commented 5 years ago

@dangreenisrael nice!

What do you think about adding a test case to see what happens when there are two beforeAlls right next to each other? (I'm curious if we've got the double padding line situation covered.)

Something like...

beforeAll(() => {
  // stuff
});
beforeAll(() => {
  // more stuff
});

I don't think it will double up because it should detect that there is already one added from the first, but I'm not 100% positive.