Set up config for prettier.js JetBrains - webstorm

I use WebStorm latest version and I don't like to use double quotes:D
The question is how do I set up my own config for the prettier.js embedded in the JetBrains product? (Ctrl+Alt+L)

WebStorm doesn't embed any prettier configs. You have to create your own prettier configuration file in your project folder (or add "prettier" key to your package.json) and add the desired rules there, like
{
"singleQuote": true
}

Related

Format with Prettier on save doesn't work in WebStorm 2022.2.2

I installed everything like in official tutorial https://www.jetbrains.com/help/webstorm/prettier.html#ws_prettier_reformat_code and it doesn't work on save, although the checkbox is set.
What can I do to make it work?
Prettier version: 2.7.1
WebStorm version: 2022.2.2
Must be WEB-57086, Prettier plugin doesn't work if you have a directory name in a glob pattern.
Try changing the Run for files: back to default value, {**/*,*}.{js,ts,jsx,tsx,scc,scss,sass}
Also make sure you have correct file extensions included, for instance if you are working with Vue add vue to the list:
{**/*,*}.{js,ts,jsx,tsx,vue}

WebStorm: configure Prettier to use tabs?

The Prettier docs say to use --use-tabs to override the default behavior. WebStorm automatically populated the Prettier package:
That's a folder. I tried changing it to npm\prettier.cmd and adding the switch, but that doesn't work (It just turns red).
How can I set WebStorm to use tabs with Prettier?
If your project has a .editorconfig file, you can override the indent_style setting in there.
# top-most EditorConfig file
root = true
[*]
indent_size = 4
indent_style = tab
I found these resources helpful too:
https://prettier.io/docs/en/options.html#tabs
https://editorconfig.org/
Due to https://github.com/prettier/prettier/pull/2434 fix, Prettier (even global!) uses configuration file nearest to current file (up the directory tree) when formatting.
So, you can install it globally and configure it in your project, by adding the corresponding .prettierrc file or "prettier" section in project package.json.

Autocomplete import paths WebStorm

I have a create-react-app and I have NODE_PATH = src/ in my .env file to make import paths of common components simpler. But WebStorm isn't recognizing it and wont autocomplete any of them like it does if I were to import ../../Common/foo or how it autocompletes node modules import Button from 'material-ui/Button always gives me a long list of material-ui components and helps make sure I don't have any typos.
Is there a way I can configure this in WebStorm?
You can try setting NODE_PATH in default Node.js run configuration to get it respected - see https://youtrack.jetbrains.com/issue/WEB-19476#comment=27-1255547:
in Run | Edit configurations, expand Defaults node, select Node.js
in default Node.js run configuration, press ellipsis button next to Environment variables: field
add NODE_PATH variable there, specify a full path to src folder as a value
in Project tool window, mark src folder as Resource root
reopen the project

How to import code formatting settings from tslint.json in webstorm?

Is it possible to import formatting settings (Settings => Editor => Code Style => Typescript) from my tslint.json file in webstorm? I use rules directory "node_modules/codelyzer" in my tslint.json file
Since 2017 WebStorm version, it's possible to Apply code style.
Just open tslint.json and WebStorm will ask if it can import it.
Read it about it in WebStorm 2017.1 EAP, 171.2455: improved integration with TSLint
It's not possible at the moment. You can vote for and follow the updates on this feature request: https://youtrack.jetbrains.com/issue/WEB-19481
As of 2018, you can manually apply TsLint settings:
Find your tslint.json file in the Editor or File tree (can also be a tslint.yaml)
Right click the file (again, this can be the Editor pane or the file in the tree)
Select Apply TSLint Code Style Rules. (should be the last option)
The Event Log should be updated with:
TSLint: The project code style and editor settings were updated based on 'tslint.json'.
More from JetBrains (with pictures):
WebStorm Help | Importing code style from a TSLint configuration file

How to specify the location for the unit test results in VS 2010?

I use VS2010 for unit testing. Does anyone know how to specify the location of where VS 2010 put its TestResults? By default it put a TestResults folder in the solution folder, I'd like to move it out somewhere else.
Thanks,
Ray.
Currently, this is not possible to control from within the IDE, see http://social.msdn.microsoft.com/Forums/en/vststest/thread/4ff650e1-a99a-4bd4-8311-6007f2a6e16e.
However, if you can use MSTEST.EXE from the commandline, it will use the current folder to generate the TestResults folder in.
Update:
Found this in http://blogs.msdn.com/b/vstsqualitytools/archive/2010/10/24/test-agent-test-controller-and-mstest-faq.aspx:
How to customize the default deployment directory?
You can change the default deployment folder by editing the test settings file in the XML editor:
<Deployment userDeploymentRoot="C:\TestResults" useDefaultDeploymentRoot ="false" />
Note that ,if the test settings is modified by XML edit (instead of using the default editor) VS need to be closed and reopened ( since the editing is done in XML , the changes will not be updated in the loaded settings.)
Best regards,
Marco Kroonwijk
MSTest.exe will generate results in the current folder as kroonwijk states, but you can override that with the /resultsfile command line switch by specifying the output filename in a different folder, it will also deploy a subfolder with the test files to the same location.
For example "/resultsfile:c:\TestResults\mstestreport.trx" will override the default deployment folder and also override anything that is in the <deployment> tag in the settings file.