PhpStorm Doesn't Recognize 'require', 'define' Key Words from Node.js and RequireJS modules
I've got a huge project. We use ReuqireJS and Webix to build this app. When I write some code IDE's JSHint says " 'define' is not defined ". It Happened when I've updated PHPStorm from 2017.2 to 2017.3 I guess.
P.S.: even though I tried to add Node.js, RequireJS and webix to libraries in JS Language settings nothing happened. Why so?
请先登录再写评论。
Warning comes from JSHint, not from the IDE.
JSHint works on per-file basis and doesn't 'see' global variables defined in other files unless they are added to 'global' list. This can be done by either adding the corresponding comments (
/* global define*/) to your code - see http://www.jshint.com/docs/, or by adding variables/functions you'd like to use globally to the Predefined list in Settings | Languages & Frameworks | JavaScript | Code Quality Tools | JSHint, Predefined (,separated)I understand that the error comes from JSHint and not IDE. However, having to spend time in two places to locate configuration is counter to what the IDE should provide: integrated development environment.
The IDE should integrate the tools and configuration. It's great that Intellij is a good language tool but don't discount having a buffed, well rounded experience.
As of 2018.3 of IntelliJ, running though this tutorial: https://blog.jetbrains.com/webstorm/2014/06/mean-stack-walkthrough-and-tips the experience is suboptimal since configuration is spread out in to many places.
Rodrigo