Skip to content

Conversation

@mrazauskas
Copy link
Contributor

From #13345 (comment)

Summary

Strangely ESLint rule 'import/order' is set to 'off' for the examples folder. I double checked if that is somehow needed to keep the examples and docs in sync. Can’t find any reason. I think same lint rule can be applied for examples as well as code base.

Test plan

Green CI.

rules: {
'import/no-unresolved': ['error', {ignore: ['^react-native$']}],
'import/order': 'off',
'no-restricted-imports': 'off',
Copy link
Contributor Author

@mrazauskas mrazauskas Sep 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without turning this off ESLint is pushing to use graceful-fs.

const path = require('path');

const fs = require('fs');
import fs from 'fs';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be ESM?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably doesn't hurt, tho

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was hard to look at require('jest-environment-node').default above. That’s the only reason. I can revert.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, it's fine. Sorta surprised it works tho - the default in CJS is different from native ESM default. Can use const {TestEnvironment} = require('jest-environment-jsdom')

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SimenB SimenB merged commit c6b812d into jestjs:main Oct 1, 2022
@mrazauskas mrazauskas deleted the chore-lint-examples branch October 1, 2022 07:05
@github-actions
Copy link

github-actions bot commented Nov 1, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants