-
Notifications
You must be signed in to change notification settings - Fork 16
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
Nrwl Nx project: cannot find tsconfig.json near... in sheriff.config.ts #161
Comments
I've created also a PR (in your repo). The issue was that you cannot use TS aliases in your And then run |
Thanks @rainerhahnekamp ! Your response was so quick I can't keep up. You've set me on the right path, and I'll report back here about the error shortly. |
Hi @tomwhite007, no worries. Just let me know once you had the chance to take a look at it. |
Thank you for your help. Since then, I've added more modules and libs to my demo repo. The Sheriff lint rules are working perfectly - I'm impressed! I have noticed that when things are configured incorrectly (i.e. non-existent module paths in I should also mention that the original issue described in this thread is still present - though I realise now that it is only cosmetic. The red lint underline appears on the I presume this lint error is because some part of the code doesn't recognise |
Hi @tomwhite007, so you mean having eslint for the What kind of error messages do you get, where you say they are describing the behavior incorrectly? Please raise a separate issue for that. We'll keep this issue open. In our tests, we've never encountered the issue with |
Hello @rainerhahnekamp
Yes. It would improve the DX where modules need to be defined. Users that didn't create a
Yes. Will raise shortly.
No. I've now added an Hope that all helps. |
Thanks for your help so far @rainerhahnekamp My demo repo is working fine now. I have created an issue to contain the incorrect configuration errors: #165 So now this thread can be only about the error at the top of sheriff.config.ts in Nx Workspaces:
|
@tomwhite007 I have a hard time to reproduce the error. I've setup https://github.com/rainerhahnekamp/sheriff-nx. It is a fresh Nx repo with sheriff installed. If I run |
Thanks for trying @rainerhahnekamp . I'll dig into this and report back next week to give you all my findings at once. |
I've raised a PR against your test repo. I found that by adding the Sheriff plugin to eslint.config.js, I could then see the red underline lint error in sheriff.config.ts from my VS Code editor. Can you see that now? |
Thanks Tom, it didn't show up in my IDE but once I ran The problem is that eslint usually runs against files which are not located in the root of an nx workspace. For example, when you run it against any main.ts or whatever, there is always a parent folder which has the tsconfig.json. So I see the problem, it shouldn't impact the lining of your projects, but we should fix it somehow. Do you have ideas? |
I'd need to spin your code up, and I'm not sure how to do that yet. But I see that the init function in packages/core/src/lib/main/init.ts does this:
So, I suspect that when the process runs in the context of an Nx repo, it needs to do this:
(assuming that doesn't impact how the process behaves in an Nx Workspace currently) If you have an opinion on how to check for the Nx context, say, looking for the presence of PS. I'm aware of how elegant your code is in this project. I'd do my best to match that. |
I'm thinking in a slightly different direction. I don't want that Sheriff needs to know that it is running on nx and that nx is using tsconfig.base.json. If possible, it should just work. There are two things. First, strictly speaking, I am all in for showing error messages in |
Ah, I get what you mean. How about this approach? rainerhahnekamp/sheriff-nx#2 |
Thinking about it, I think the eslint plugin syntax should allow the |
@tomwhite007, we can do the quick fix or provide already the initial setup for a special configuration rule.
I am open to both. Do you want to contribute a PR? |
Yes. Can do. Thank you. |
It's been a while, but I've been starting a new contract. Hope this is worth the wait. I'm dropping 2 PRs that give the same result so you can choose. I'll comment on both about what I've done. I've basically tried both of your bullet options above while learning how your code and tests work. If you prefer an alternative to them, I could look at inserting a check into Core (packages/core/src/lib/main/init.ts) instead. But that just feels more heavy-handed to me at the minute. Observation: the repo's own eslint rules seem to need a bit of housekeeping; html and json files are checked with TS file rules at the moment (which leads to a lot of red underlines in package.json). Would you like me to address in another PR? |
I've created a demo repo to try out your new Barrel-less Module Boundaries in Nrwl Nx. But, Sheriff cannot find
tsconfig.json
because there is onlytsconfig.base.json
in the root of a Nrwl Nx repo.This may relate to Issue 68
Error reported from inside
sheriff.config.ts
:Screenshot:
Example Repo:
https://github.com/tomwhite007/enterprise-angular-mono-repo-patterns-example-with-sheriff
The text was updated successfully, but these errors were encountered: