dangreenisrael / eslint-plugin-jest-formatting

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

[Rule] test name should be trimed #85

Closed aymericbouzy closed 4 years ago

aymericbouzy commented 4 years ago

I don't like when people leave white spaces at the beginning and end of tests. It's weird.

Valid code example

it("is a valid test name", () => {
  // code
})

Invalid code example

it(" is not a valid test name", () => {
  // code
})

it("is not valid either ", () => {
  // code
})
benkimpel commented 4 years ago

@aymericbouzy I haven't seen this one much in the wild, but I agree that's weird!! Seems like it could fall within the purview of this plugin.

dangreenisrael commented 4 years ago

👍

@aymericbouzy Is this something you would be interested in taking on?

aymericbouzy commented 4 years ago

I've never written an ESlint rule before 😅 but I'm not afraid of trying 👍 Will keep you posted.

aymericbouzy commented 4 years ago

Ideally I would like an ESlint rule that corrects grammar mistakes in test names 😂 some of my interns are very creative with English ... just kidding it would be a nightmare without real benefit 😉

benkimpel commented 4 years ago

@aymericbouzy If you'd like any help or would like to bounce ideas or plans off someone just let me know. (This is probably a pretty good rule to start with!)

erunion commented 4 years ago

This case is already covered under the valid-title rule in eslint-plugin-jest for what it's worth.

https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/valid-title.md

hockeybuggy commented 4 years ago

Oh nice! Good catch @erunion . Looks like valid-title already exists and has a superset of the functionality described.

I am gonna close this to avoid duplicating effort. 😀

benkimpel commented 4 years ago

Nice! Thanks @erunion.

dangreenisrael commented 4 years ago

Thanks @erunion!