TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Module lookup/resolution config for JavaScript validation tools

1 点作者 kirilloid超过 9 年前
INTRO<p>There are bunch of tools for static code analysis in JavaScript. For the sake of simplicity, I&#x27;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&#x27;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&#x2F;o configuring every file individually.<p>E.g.: Modules which name starts from &#x27;core&#x27; should be search in &#x2F;project&#x2F;bundle&#x2F;js&#x2F;core&#x2F;: like &#x27;core.data.http&#x27; would be in &#x2F;project&#x2F;bundle&#x2F;js&#x2F;core&#x2F;data&#x2F;http.js. Modules which name starts from &#x27;personalization&#x27; will be in &#x2F;project&#x2F;vendor&#x2F;adobe&#x2F;personalization&#x2F;. All other modules to be looked up in &#x2F;project&#x2F;components&#x2F;.<p>At last the tool should be easily added to CI process.<p>EXAMPLES<p>Using TypeScript is an option, but I&#x27;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&#x27;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&#x27;m still seeking for something better.

暂无评论

暂无评论