| Summary: | Express index given to Tern is not correct | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Steve Northover <steve_northover> |
| Component: | JS Tools | Assignee: | Curtis Windatt <curtis.windatt.public> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | curtis.windatt.public, Michael_Rennie |
| Version: | 12.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Steve Northover
Try removing the libs entry from the .tern-project file and see if this fixes the issue. I guess you have some new validation enabled that I don't have. I don't get any warnings with this code. What are the warning's strings? Could it be related to bug 488531? This was the first thing I tried. Here is my file:
{
"libs": ["ecma5"],
"ecmaVersion": 5,
"loadEagerly": [
"public/index.html"
]
}
BTW, Curtis, can you make it happen? Is it only me? Yes I can reproduce. This is my new cross file linting. The type definition for app (result of express()) has a number of properties: disable, get, init, listen. Use is not one of them so Tern thinks it is undeclared. If you notice, it is not in the list of content assist proposals either. Thanks. It's not happening for me on https://orion.eclipse.org but it is happening on beta3. There is an issue with our express index. use() is defined on express.Router, but express.Application should include express.Router. static() is defined inside the express type container, but is not part of any type (express.express or express.Application). We can try: 1) Manually correct the index file. 2) Try re-running condense using the latest version of Tern (and the newest version of the DefinitelyTyped index). Not sure what is going on in that it is working in some places and not in others so it seems like a recent regression. (In reply to Steve Northover from comment #8) > Not sure what is going on in that it is working in some places and not in > others so it seems like a recent regression. This is not a regression. If you turn on the new cross file lint check 'Undeclared member expressions' it will surface the issue. This happens on both beta3 and orion.eclipse.org. I created a new index using condense. use() is now included properly (with Doc!), but there is no definition of static() anywhere. Also, the app object (result of new express()) defines no properties so cross file lint just ignores it. Might have to do some manual modifications to the index. This is how static is specified in express.js
exports.static = require('serve-static');
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c967947bb9bbde6c7e31802fb43c754cfbb535b9 I recreated the index for Express. The new index has a lot more information in it including doc for many of the types. However, I had to make some modifications to the index to make it work correctly. It even defines toString() and hasOwnProperty() which override the functions on Object. Marking as FIXED. We can discuss whether we want to redo all of the indexes. (In reply to Curtis Windatt from comment #9) > (In reply to Steve Northover from comment #8) > > Not sure what is going on in that it is working in some places and not in > > others so it seems like a recent regression. > > This is not a regression. If you turn on the new cross file lint check > 'Undeclared member expressions' it will surface the issue. This happens on > both beta3 and orion.eclipse.org. That is really cool, that the first thing a new feature did was find a problem in our code :) |