Comments (12)
@SleeplessByte Can you reopen? I can confirm that this problem happens. But I had to start a fresh exercise to be able to reproduce, I'm not sure yet why it didn't happen on an exercise I already started before, which has an identical package.json
.
from typescript.
@WigglyDon I replied in your thread https://forum.exercism.org/t/issue-with-local-jest-type-definitions-yarn-3-and-jest/6867/7. When using Yarn PnP, I fixed problems with VS Code not recognizing the type definitions for Jest by following the official Yarn guide on how to integrate VS Code with Yarn PnP: Editor SDKs | Yarn. However, if you follow @SleeplessByte's advice of adding nodeLinker: node-modules
line to .yarnrc.yml
before running yarn install
, which temporarily fixes issue with ESLint, then Yarn PnP is not used and you don't have to install Yarn's SDK and only need to select installed TypeScript version in VS Code's settings.
from typescript.
It should create a folder node_modules in the exercise folder and inside you should find eslint-plugin-import (not nested, directly as subfolder).
It did, and now yarn lint:ci
works.
from typescript.
Sorry, I've been quite busy these last few days, so I'm responding now.
Yes, adding nodeLinker: node-modules
to .yarnrc.yml
does temporarily solve the problem - ESLint can find both packages and works correctly. It would be great if it worked with PnP, though. I didn't know about www.npmjs.com/package/@rushstack/eslint-patch, I hope it will solve the problem the right way.
I neither agree with the original resolution (and completely agree with Sindre's assesment and commentary) and I don't think the "flat structure" will work as well as we want it to.
As I mentioned in the initial comment, I considered adding plugin packages to exercise projects as only a quick workaround not requiring changing of ESLint configuration, and I thought that using the new config system would solve the problem the right way - but I understand, that you don't want to use it in favor of @rushstack/eslint-patch
. I also completely agreed with Sindre's assesment.
Futhermore, adding the dependencies directly to the exercise is exactly what we do not want, nor do we want peerDepedencies. The students should be able to just install the exercise and not worry about these things at all, nor should the exercise be invalidated when a plugin updates.
Of course I meant that in this quick workaround - making plugin packages peer dependencies of @exercism/eslint-config-typescript
- not the students would have to install them, but they would already be present in downloaded package.json
. I agree that peer dependencies are not the way to go, as Sindre assessed.
from typescript.
I'll let both of you know when you can upgrade to test out the new way of doing it!
from typescript.
Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.
Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.
from typescript.
I just downloaded resistor-color-trio
. It worked out of the box.
You can see in https://github.com/exercism/typescript/blob/main/exercises/practice/resistor-color-trio/package.json#L19-L25 that eslint
is declared to resolve the issue as mentioned. I did not experience that I needed to declare "the sub plugins". This setup we've been using to maintain both TS and JS for over a year now.
Could it be that you @angelikatyborska or you @konradkozubek have not yet updated your exercise? If yes, can you tell me where it's happening? Additionally, after running yarn
to install, can you please use the Command Pallete in VSCode to forcefully restart ESLint. Can you also see if there are errors in the Output
tab like in my screenshot? Finally, can you tell me which version of Yarn
you are using and can you confirm that you are using the following extension:
Name: ESLint
Id: dbaeumer.vscode-eslint
Description: Integrates ESLint JavaScript into VS Code.
Version: 2.4.2
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
from typescript.
@SleeplessByte It happens to me on completely fresh exercises. Earlier today I tried on matrix,
right now I tried on darts
, both of which I never attempted to solve before.
Normally I use yarn 1.22.19
installed globally via asdf
, but for some reason the Exercism TS exercise forces my yarn to be version 3.6.0
.
I tested this with my IDE closed so that any IDE Eslint plugins do not interfere. Normally I use Webstorm. I never rely on Eslint run via the IDE, I always run it myself in the terminal.
angelika in ~/Exercism/typescript
$ node -v
v18.17.0
angelika in ~/Exercism/typescript
$ yarn -v
1.22.19
angelika in ~/Exercism/typescript
$ exercism download --exercise=darts --track=typescript
Downloaded to
/Users/angelika/Exercism/typescript/darts
angelika in ~/Exercism/typescript
$ cd darts
angelika in ~/Exercism/typescript/darts
$ node -v
v18.17.0
angelika in ~/Exercism/typescript/darts
$ yarn -v
3.6.0
angelika in ~/Exercism/typescript/darts
$ yarn install
➤ YN0000: ┌ Resolution step
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ @exercism/typescript-darts@workspace:. doesn't provide @babel/core (p4e0b8), requested by babel-jest
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 6s 794ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yallist@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs-parser@npm:21.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.7.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 2s 293ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ core-js@npm:3.30.2 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.32.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 435ms
➤ YN0000: Done with warnings in 10s 595ms
angelika in ~/Exercism/typescript/darts
$ yarn lint:ci
Oops! Something went wrong! :(
ESLint: 8.47.0
ESLint couldn't find the plugin "eslint-plugin-import".
(The package "eslint-plugin-import" was not found when loaded as a Node module from the directory "/Users/angelika/Exercism/typescript/darts".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm install eslint-plugin-import@latest --save-dev
The plugin "eslint-plugin-import" was referenced from the config file in ".eslintrc.cjs#overrides[0] » @exercism/eslint-config-typescript".
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
from typescript.
Thank you. This helps. I'll try to make it work for your use case.
from typescript.
@angelikatyborska can you try adding the following line to the exercise .yarnrc.yml
:
nodeLinker: node-modules
It doesn't matter if it's above or below the yarnPath
line. Afterwards run yarn install
again. It should create a folder node_modules
in the exercise folder and inside you should find eslint-plugin-import
(not nested, directly as subfolder).
If this works, we unfortunately will have to revert PnP because of some shitty decisions eslint have taken in the past.
I have read all the threads. I neither agree with the original resolution (and completely agree with Sindre's assesment and commentary) and I don't think the "flat structure" will work as well as we want it to. It also has been experimental for over a year so I am not keen to introduce that here. Futhermore, adding the dependencies directly to the exercise is exactly what we do not want, nor do we want peerDepedencies. The students should be able to just install the exercise and not worry about these things at all, nor should the exercise be invalidated when a plugin updates.
A decent workaround may be https://www.npmjs.com/package/@rushstack/eslint-patch, but I need to explore that. It is also listed as workaround for the Plug'n'Play issue you both are experiencing as listed here: https://yarnpkg.com/features/pnp#native-support
from typescript.
@konradkozubek you can use the method above to make it work in the meantime. I will work on implementing eslint-patch.
from typescript.
Hi there. This issue was linked in a thread for a separate issue related to Yarn 3 and Jest testing locally on the typescript track.
https://forum.exercism.org/t/issue-with-local-jest-type-definitions-yarn-3-and-jest/6867/7
I'm just posting to raise the possibility that Yarn PnP related issues may be more widespread than this in the track, and possibly there are more things out there going wrong that haven't been reported yet due to people not having had the opportunity to thoroughly test the track.
I have been unable to solve a missing type dependency for jest without somehow involving node_modules
which from what I understand completely defeats the purpose of using Yarn PnP.
I don't really know if these are for sure related, but since this issue was linked on the provided post, I thought I'd poke my nose in and say hey :)
from typescript.
Related Issues (20)
- At least one deadlink in the REPO HOT 1
- Test-Cases of `rational-numbers` exercise satisfied by dummy-implementation
- DnD Character - confused about the purpose and execution of the exercise HOT 4
- [Grade School] Tests fail on a valid approach
- Lack to add documentation references in the exercise instructions. HOT 5
- Instructions for the exercise Secret handshake (typescript exercise #16) are confusing HOT 3
- Spelling issue in Largest Series Product
- [Grade School] Can't use Readonly<> types for later tests HOT 7
- Update Pig Latin tests HOT 1
- `word-count` exercise test not aligned with instructions HOT 1
- yarn install / yarn test does not work out of the box for typescript exercises HOT 2
- Building a training set of tags for typescript HOT 21
- hello world not work HOT 1
- Deprecated String.prototype.substr() in robot-name.test.ts HOT 1
- Why does two-bucket use both xtest and test.skip ? HOT 1
- Two-Fer exercise skips 2/3 tests with `xit` HOT 2
- 'Robot Name' false positive tests HOT 6
- Exercise Word Count in Typescript. Tests are wrong
- Missing test case for problem "luhn"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.