馃殌 Feature Proposal
Allow the
/**
* @jest-environment jsdom
*/
To not be strictly the first comment node.
Motivation
Docusaurus has a very strict eslint header config that only allows:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Unfortunately, the header plugin doesn't allow optional lines yet: Stuk/eslint-plugin-header#9 Which means we either have to add an empty line to all existing headers, so that we can have one line to accomodate the @jest-environment jsdom:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// File without jsdom
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @jest-environment jsdom
*/
// File with jsdom
Or we resort to a super-ugly compromise of allowing extra characters on the last line:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @jest-environment jsdom */
Or we disable the eslint rule for this file, which is definitely not desirable.
Or we implement that feature in the eslint plugin, but the plugin... unfortunately seems dead.
In the end, I think this would be a useful yet (I hope) simple feature to add in Jest.
Example
Allow this:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @jest-environment jsdom
*/
Pitch
Flow allows the @flow pragma anywhere:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*/
/**
* @flow
*/
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*/
// @flow
And I think parsing a few extra comment nodes shouldn't be technically hard...
馃殌 Feature Proposal
Allow the
To not be strictly the first comment node.
Motivation
Docusaurus has a very strict eslint header config that only allows:
Unfortunately, the header plugin doesn't allow optional lines yet: Stuk/eslint-plugin-header#9 Which means we either have to add an empty line to all existing headers, so that we can have one line to accomodate the
@jest-environment jsdom:Or we resort to a super-ugly compromise of allowing extra characters on the last line:
Or we disable the eslint rule for this file, which is definitely not desirable.
Or we implement that feature in the eslint plugin, but the plugin... unfortunately seems dead.
In the end, I think this would be a useful yet (I hope) simple feature to add in Jest.
Example
Allow this:
Pitch
Flow allows the
@flowpragma anywhere:And I think parsing a few extra comment nodes shouldn't be technically hard...