dangreenisrael / eslint-plugin-jest-formatting

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

[Rule] Newline after setup and teardown #2

Closed dangreenisrael closed 5 years ago

dangreenisrael commented 5 years ago

Explanation of the rule This rule would enforce a new line after setup and teardown blocks.

Note: these examples come from the jest docs

Valid code example

describe('some tests', () => {
  beforeEach(() => {
    initializeCityDatabase();
  });

  afterEach(() => {
    clearCityDatabase();
  });

  test('city database has Vienna', () => {
    expect(isCity('Vienna')).toBeTruthy();
  });
})

Invalid code example

describe('some tests', () => {
  beforeEach(() => {
    initializeCityDatabase();
  });
  afterEach(() => {
    clearCityDatabase();
  });
  test('city database has Vienna', () => {
    expect(isCity('Vienna')).toBeTruthy();
  });
})
dangreenisrael commented 5 years ago

This was originally requested by @eddiesholl at https://github.com/jest-community/eslint-plugin-jest/issues/113

dangreenisrael commented 5 years ago

This is completed as of https://github.com/dangreenisrael/eslint-plugin-jest-formatting/pull/44 by @benkimpel