Skip to content

Commit

Permalink
Add missing index.ts files to user projects
Browse files Browse the repository at this point in the history
This makes the language service treat .js files inside node_modules as
part of the parent project, so that you can view the same errors in the
editor as you see in the baselines.

Also update a comment in the parser that I missed in an earlier PR.
  • Loading branch information
sandersn committed Jun 19, 2020
1 parent 8683b8a commit b3366d7
Show file tree
Hide file tree
Showing 41 changed files with 242 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3355,7 +3355,7 @@ namespace ts {
type = finishNode(factory.createJSDocNonNullableType(type), pos);
break;
case SyntaxKind.QuestionToken:
// If not in JSDoc and next token is start of a type we have a conditional type
// If next token is start of a type we have a conditional type
if (lookAhead(nextTokenIsStartOfType)) {
return type;
}
Expand Down
1 change: 1 addition & 0 deletions tests/cases/user/acorn/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('acorn');
16 changes: 12 additions & 4 deletions tests/cases/user/acorn/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/acorn"]
}
"include": [
"node_modules/acorn",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/adonis-framework/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('adonis-framework/src/View');
16 changes: 12 additions & 4 deletions tests/cases/user/adonis-framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/adonis-framework"]
}
"include": [
"node_modules/adonis-framework",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/assert/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('assert');
16 changes: 12 additions & 4 deletions tests/cases/user/assert/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/assert"]
}
"include": [
"node_modules/assert",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/async/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import async_ = require('async');
2 changes: 1 addition & 1 deletion tests/cases/user/async/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"types": ["node"],
"lib": ["esnext", "dom"],
},
"include": ["node_modules/async"]
"include": ["index.ts", "node_modules/async"]
}
1 change: 1 addition & 0 deletions tests/cases/user/bcryptjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('bcryptjs');
14 changes: 10 additions & 4 deletions tests/cases/user/bcryptjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": [
"node_modules/bcryptjs/scripts",
"node_modules/bcryptjs/src",
"node_modules/bcryptjs/tests"
"node_modules/bcryptjs/tests",
"index.ts"
]
}
}
1 change: 1 addition & 0 deletions tests/cases/user/bluebird/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('bluebird');
16 changes: 12 additions & 4 deletions tests/cases/user/bluebird/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/bluebird/js/release"]
}
"include": [
"node_modules/bluebird/js/release",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/clear-require/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('clear-require');
16 changes: 12 additions & 4 deletions tests/cases/user/clear-require/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"lib": ["esnext", "dom"],
"types": ["node"]
"lib": [
"esnext",
"dom"
],
"types": [
"node"
]
},
"include": ["node_modules/clear-require"]
}
"include": [
"node_modules/clear-require",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/clone/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('clone');
16 changes: 12 additions & 4 deletions tests/cases/user/clone/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/clone"]
}
"include": [
"node_modules/clone",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/content-disposition/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('content-disposition');
16 changes: 12 additions & 4 deletions tests/cases/user/content-disposition/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/content-disposition"]
}
"include": [
"node_modules/content-disposition",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/debug/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import debug = require('debug');
2 changes: 1 addition & 1 deletion tests/cases/user/debug/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"types": ["node"],
"lib": ["esnext", "dom"],
},
"include": ["node_modules/debug"]
"include": ["index.ts", "node_modules/debug"]
}
1 change: 1 addition & 0 deletions tests/cases/user/enhanced-resolve/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('enhanced-resolve');
18 changes: 13 additions & 5 deletions tests/cases/user/enhanced-resolve/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
],
"module": "CommonJS",
"target": "esnext",
"target": "esnext"
},
"include": ["node_modules/enhanced-resolve"]
}
"include": [
"node_modules/enhanced-resolve",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/follow-redirects/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('follow-redirects');
16 changes: 12 additions & 4 deletions tests/cases/user/follow-redirects/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/follow-redirects"]
}
"include": [
"node_modules/follow-redirects",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/graceful-fs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('graceful-fs');
16 changes: 12 additions & 4 deletions tests/cases/user/graceful-fs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/graceful-fs"]
}
"include": [
"node_modules/graceful-fs",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/lodash/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('lodash');
20 changes: 15 additions & 5 deletions tests/cases/user/lodash/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/lodash"],
"exclude": ["node_modules/lodash/lodash.js"]
}
"include": [
"node_modules/lodash",
"index.ts"
],
"exclude": [
"node_modules/lodash/lodash.js"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/minimatch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('minimatch');
16 changes: 12 additions & 4 deletions tests/cases/user/minimatch/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
"types": [
"node"
],
"lib": [
"esnext",
"dom"
]
},
"include": ["node_modules/minimatch"]
}
"include": [
"node_modules/minimatch",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/npm/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('npm');
17 changes: 13 additions & 4 deletions tests/cases/user/npm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom", "scripthost"],
"types": [
"node"
],
"lib": [
"esnext",
"dom",
"scripthost"
]
},
"include": ["node_modules/npm"]
}
"include": [
"node_modules/npm",
"index.ts"
]
}
1 change: 1 addition & 0 deletions tests/cases/user/npmlog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import x = require('npmlog');
Loading

0 comments on commit b3366d7

Please sign in to comment.