npm config get prefix command to find the path to the
mhy executable file.
node_modules folder should be around there somewhere. It varies between different systems, maybe it is right next to it, maybe inside a
lib directory next to it or the upper levels.
Inside the global
node_modules folder, you'll find
mhy/node_modules. The path to that directory is what we will need.
# Generating all possible config files mhy can providemhy config# Use -o to overwrite existing filesmhy config -o# Generate specific config filesmhy config prettier typescript webpack -io
Since you're using modules coming from
mhy, you need to tell the IDE to include a
node_modules folder outside your project's directory.
Add the path at
File > Settings > Directories and mark it as
Alias resolution is done by Webpack. You only need to have a
webpack.config.js file in your root.
ONLY in case you haven't run
mhy config yet to set-up your empty project, run
mhy config webpack -i to initialize a config file.
Make sure at
File > Settings > Webpack that the feature is turned on.
While it's possible to add watchers without the
Prettier plugin, the plugin simply helps you with pre-filling the necessary fields with the necessary values for your watcher.
Prettier plugin from
File > Settings > Plugins
File > Settings > Tools > File Watchers
Create watcher by clicking the
Current file which is more optimal.
.cmd on Windows).
(Optional) You might want to add change the
Level of the watcher to
Global to be able to re-use it across projects.
Unfortunately you'll need to create watcher for each
jsx, ts, tsxwatcher also. Do this with copying the watcher and change the
Step 0: If it's necessary, please do
npm ifirst for your project, only create
tsconfig.jsonfile after that. This is important to avoid duplicated
@typesto be loaded.
ONLY in case you don't have
tsconfig.json file yet:
mhy config typescript -i
File > Settings > Language & Frameworks > TypeScript
Note that in
mhyTypeScript is only being used to perform type-checks and to generate
.d.tsfiles. You don't need to enable compilation, that is being done by Babel.
ONLY in case you don't have
.eslintrc file yet:
mhy config eslint -i
ESLint package set
Help > Find Action and type
Click the first result (
Scroll down to
eslint.additional.file.extensions and set
js,jsx,ts,tsx as value.
package.json dependency inspection.
Disable statement termination inspection.
CTRL+Enter at the end of any line. (ONLY in case you choose to continue using ASI which is the default setting.)
Set 4 spaces for indent. (ONLY in case you choose to continue using the default setting.)
Make sure you use LF for line endings. Set it globally or project level, and also you can convert every file if needed by selecting the
root folder then
File > Line separators.
You might want most settings/watchers to be global (where possible), so you can re-use them for all your projects.