Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turning js files into ts causes many eslint errors #10021

Closed
markgoho opened this issue Apr 27, 2022 · 5 comments · Fixed by #10035
Closed

turning js files into ts causes many eslint errors #10021

markgoho opened this issue Apr 27, 2022 · 5 comments · Fixed by #10035
Assignees
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@markgoho
Copy link
Contributor

markgoho commented Apr 27, 2022

Current Behavior

eslint complaining about a lot of issues after all the jest config files were converted to typescript files

Expected Behavior

changing file formats should also come with updated linting rules

Steps to Reproduce

nx migrate latest (14.0.3)

You can clone the repo and check out the nx-14 branch:
https://github.com/ideacrew/active-branch-tracker/tree/nx-14

Failure Logs

mostly it's the 'ts-jest' property and the pattern-matching property that ESLint is complaining about.
image

image

Environment

Win 11
Node 14
Nx 14.0.3

Additional failures that probably need addressing as well

In typescript files, module.exports isn't the preferred way to export things
image

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Apr 27, 2022
@AgentEnder
Copy link
Member

@barbados-clemens could we update the migration to add an eslint ignore comment?

@markgoho
Copy link
Contributor Author

markgoho commented Apr 27, 2022

@AgentEnder great idea!

any thoughts about exporting the module in a more TypeScript-y way?

export default { }

@barbados-clemens
Copy link
Contributor

@markgoho ideally yes. it's just a big upshift to make. I have plans to move new jest projects to export default. but I'm slightly apprehensive to move existing configurations to different syntax to not break even more things.

@barbados-clemens
Copy link
Contributor

after about 20 minutes of thinking of this. I'll do the migration for export default
mainly because using the nxPreset from @nrwl/jest/preset is also breaking things in the nx repo and moving all to default exports fixes this issue.

hope to have a PR up some time tomorrow.

barbados-clemens added a commit that referenced this issue May 11, 2022
…e `export default` (#10035)

* fix(testing): jest.preset.ts => jest.preset.js

* fix(testing): update to export default

* fix(testing): migration for moving to export default

* fix(testing): add eslint ignore comments for jest config properties

fixes: #10021

* fix(testing): update tsconfig.spec.json for next apps with project parserOptions

fixes: #9982

* fix(testing): prevent renaming root jest preset

fixes: #9973

* fix(testing): update snapshots for export default

* fix(testing): bump migration version to run

* fix(testing): make sure default jest tests pass for various projects

* fix(js): generate correct jest config for --compiler=swc --js
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants