File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1834,7 +1834,7 @@ namespace ts {
18341834 const fileContents = sourceFile . text ;
18351835 const result : TodoComment [ ] = [ ] ;
18361836
1837- if ( descriptors . length > 0 ) {
1837+ if ( descriptors . length > 0 && ! isNodeModulesFile ( fileName ) ) {
18381838 const regExp = getTodoCommentsRegExp ( ) ;
18391839
18401840 let matchArray : RegExpExecArray ;
@@ -1958,6 +1958,12 @@ namespace ts {
19581958 ( char >= CharacterCodes . A && char <= CharacterCodes . Z ) ||
19591959 ( char >= CharacterCodes . _0 && char <= CharacterCodes . _9 ) ;
19601960 }
1961+
1962+ function isNodeModulesFile ( path : string ) : boolean {
1963+ const node_modulesFolderName = "/node_modules/" ;
1964+
1965+ return path . indexOf ( node_modulesFolderName ) !== - 1 ;
1966+ }
19611967 }
19621968
19631969 function getRenameInfo ( fileName : string , position : number ) : RenameInfo {
Original file line number Diff line number Diff line change 1+ // Tests node_modules name in file still gets todos.
2+
3+ // @Filename : /node_modules_todotest0.ts
4+ //// // [|TODO|]
5+
6+ verify . todoCommentsInCurrentFile ( [ "TODO" ] ) ;
Original file line number Diff line number Diff line change 1+ // Tests that todos are not found in node_modules folder.
2+
3+ // @Filename : /node_modules/todotest0.ts
4+ //// // TODO
5+
6+ verify . todoCommentsInCurrentFile ( [ "TODO" ] ) ;
Original file line number Diff line number Diff line change 1+ // @Filename : dir1/node_modules/todotest0.ts
2+ //// // TODO
3+
4+ verify . todoCommentsInCurrentFile ( [ "TODO" ] ) ;
You can’t perform that action at this time.
0 commit comments