eslint-config-canonical icon indicating copy to clipboard operation
eslint-config-canonical copied to clipboard

jest doc blocks clash with jsdoc/check-tag-names

Open lucasrmendonca opened this issue 3 years ago • 2 comments

Jest test environments are now recommended to be set per-file to improve performance by adding a @jest-environment docblock at the top of the file:

/**
 * @jest-environment jsdom
 */

https://jestjs.io/docs/configuration#testenvironment-string

However, this is clashing with rule Check Tag Names https://github.com/gajus/eslint-plugin-jsdoc/blob/master/.README/rules/check-tag-names.md

My suggestion: For config canonical/jest, either disable the check-tag-names rule or modify its options so it classifies docblocks written as @jest-environment ** as valid

lucasrmendonca avatar Jun 25 '22 00:06 lucasrmendonca

Is it only jest-environment tag?

gajus avatar Jan 16 '23 18:01 gajus

Is it only jest-environment tag?

@jest-environment and @jest-environment-options

/**
 * @jest-environment jsdom
 * @jest-environment-options {"url": "https://jestjs.io/"}
 */

test('use jsdom and set the URL in this test file', () => {
  expect(window.location.href).toBe('https://jestjs.io/');
});

lucasrmendonca avatar Feb 08 '23 16:02 lucasrmendonca