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

How to set exception rules for "file doesn't belong to any project" linting errors #429

Closed
dereklin opened this issue Apr 16, 2018 · 9 comments
Labels

Comments

@dereklin
Copy link

We just upgraded from 0.9.0 to 0.11.1.

We have some static css and js files sitting in libs. When running npm run lint, we are getting these errors:

All files in 'apps' and 'libs' must be part of a project.:
The 'libs/xxx.css' file doesn't belong to any project.

Is there a way to ignore checking certain files?

@nweldev
Copy link
Contributor

nweldev commented Apr 18, 2018

This is on purpose. Nrwl/Nx is strongly opinionated, that's the point.
In my opinion, keeping some css or js files directly in libs/ seems to be a really bad practice. Why do you need this ?

@dereklin
Copy link
Author

Is it really? We are using semantic ui, for multiple apps. Rather than creating the same css and js files for each app, we are putting those files in libs. Libs is a natural choice for shared code.

If nx makes this a hard rule, then maybe I need to manually create an assets folder or such outside of apps and libs...

@nweldev
Copy link
Contributor

nweldev commented Apr 19, 2018

I think this should be covered by a specific "core" (or "shared") library. From my perspective, libs/ isn't about sharing code directly. It's about splitting this code into Angular libraries "the right way". This permit, with tags, and the associated tslint and tsconfig rules, a better separation of concerns.
@vsavkin, do you confirm ?

@nweldev
Copy link
Contributor

nweldev commented Apr 19, 2018

FYI :

@dereklin
Copy link
Author

@noelmace thanks for pointing out the changes.

It turned out I just needed to add an entry into the .angular-cli.json.

I'll close this issue now.

peterblazejewicz added a commit to peterblazejewicz/workshop-nx-starter that referenced this issue Apr 7, 2019
This removes linting errors and promotes using library projects as way
of sharing common features.
See nrwl/nx#429

- move shared assets into single library project
- update application references

Thanks!
peterblazejewicz added a commit to peterblazejewicz/workshop-nx-starter that referenced this issue Apr 7, 2019
This removes linting errors and promotes using library projects as way
of sharing common features.
See nrwl/nx#429

- move shared assets into single library project
- update application references

Thanks!
@willyboy
Copy link
Contributor

If I have a directory to group libs but the directory isn't itself a lib, I get this error by having a readme in the directory.
Like:

libs 
    -  shared (a directory for grouping)
         - layout (a generated lib)
         - tracking (a generated lib)
         README.md

@patrick-entinux
Copy link

If I have a directory to group libs but the directory isn't itself a lib, I get this error by having a readme in the directory.
Like:

libs 
    -  shared (a directory for grouping)
         - layout (a generated lib)
         - tracking (a generated lib)
         README.md

@willyboy Yeah, me too. I put a README.md file in my libs/angular to introduce the different libraries inside this folder. I guess I'll delete it for now.

@jonathonadams
Copy link

@willyboy @patrick-entinux I ran into this issue today as well but I solved it by adding a .nxignore file and adding the files there.

The docs say:

To exclude files from this lint rule, you can add them to the ".nxignore" file."

Hope this solves your issues.

@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 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants