INTRO<p>There are bunch of tools for static code analysis in JavaScript. For the sake of simplicity, I'll split them in two large groups: eslint et al, which works at the level of one file and type analysers: ternjs, flowtype and even typescript. Tools in the former group need to know how to resolve modules and usually rely on the folder structure. Unfortunately, in enterprise development it's impossible to keep files wherever you want.<p>THE QUESTION<p>I need a solution to statically analyze types and signatures in the code with one extra condition: it should be able to track dependencies in complicated directory structure, possibly with ~multiple roots, w/o configuring every file individually.<p>E.g.: Modules which name starts from 'core' should be search in /project/bundle/js/core/: like 'core.data.http' would be in /project/bundle/js/core/data/http.js. Modules which name starts from 'personalization' will be in /project/vendor/adobe/personalization/. All other modules to be looked up in /project/components/.<p>At last the tool should be easily added to CI process.<p>EXAMPLES<p>Using TypeScript is an option, but I'm currently seeing it only as keeping files in plain JavaScript, adding .d.ts for the most important modules and run tsc with --noEmit. On top of that, adding files to tsconfig manually is a tedious task and I'm not sure that search by mask with exclusions will work.
Hacking tools like flowtype (which is still in beta for windows BTW) and even creating a pull request is also an option, but it requires significant amount of time =)<p>So I'm still seeking for something better.