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

linter should warn if path reaching back from the lib to the web folder #18589

Closed
sigmundch opened this issue May 1, 2014 · 17 comments
Closed
Labels
area-pkg P3 A lower priority bug or feature request

Comments

@sigmundch
Copy link
Member

Consider this scenario

  • "web/index.html" includes "lib/a.html" (via "packages/p/a.html")
  • "lib/a.html" wants to use a link-stylesheet URL to refer to "web/css/bar.css"

Today the URL cannot be written in a way that makes sense. It works if you do:
"../../web/css/bar.css"

That is because our resolution assumes that a.html is inside package 'p', but it doesn't recognize that a path that reaches above "packages/" is back at the folder of the entrypoint file. A more reasonable path would be "../../css/bar.css".

I'm not sure if this should be allowed, or if we should treat ".../packages/" as a way of entering in the package domain only (like when you enter from a file:/ url into a package:/ url).

Long term, we should also support paths that start with "/" like "/packages/foo/css/bar" so people can put their shared assets under the lib/ folder.

@jmesserly
Copy link

normally Pub packages don't allow importing "web" from "lib" ... because anyone depending on the pkg won't see the "web". However, it sounds like the error message isn't as clear as it could be.

@sigmundch
Copy link
Member Author

regarding:

I'm not sure if this should be allowed,

John reminded me of a very good point: reaching out from lib/ to web/ is not good because if anyone wants to depend on your code in 'lib/' it wont work for them.

If code is not meant to be shared, then all the code can be put under web/, but if stuff is in lib/, it should only import things in lib and in other packages.

We should report a warning if you are reaching out of your package, but also avoid making the build fail as much as possible.

@sigmundch
Copy link
Member Author

oops, I didn't notice John already replied about this when I hit send. Sorry for the spam

@sigmundch
Copy link
Member Author

Added this to the 1.5 milestone.

@jmesserly
Copy link

Added Pkg-Polymer label.

@jmesserly
Copy link

Removed Pkg-Polymer label.
Added Pkg-PolymerBuild label.

@jmesserly
Copy link

Removed Library-PolymerBuild label.

@jmesserly
Copy link

Removed Area-Polymer label.
Added Area-Pkg label.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Postponing to 1.6. Feel free to change this back (and give it a proper priority).


Removed this from the 1.5 milestone.
Added this to the 1.6 milestone.

@sigmundch
Copy link
Member Author

Changed the title to: "linter should warn if path reaching back from the lib to the web folder".

@sigmundch
Copy link
Member Author

Removed Priority-Unassigned label.
Added Priority-Medium label.

@sigmundch
Copy link
Member Author

Removed Priority-Medium label.
Added Priority-Low label.

@sigmundch
Copy link
Member Author

Removed this from the 1.6 milestone.
Added Polymer-P-1 label.

@sigmundch
Copy link
Member Author

Removed Polymer-P-1 label.
Added Polymer-Milestone-Next label.

@sigmundch
Copy link
Member Author

Added PolymerMilestone-Next label.

@sigmundch
Copy link
Member Author

Removed Polymer-Milestone-Next label.

@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/polymer-dart#392.

@DartBot DartBot closed this as completed Jun 5, 2015
@kevmoo kevmoo removed the triaged label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

5 participants