Is there a way to set up Prettier to work without the plugin in VSCode - prettier

I want to set up prettier to run in the project without having to install the plugin or having to run prettier smth like this:
"prettier-watch": "onchange \"**/*\" -- prettier --write --ignore-unknown {{changed}}"
in the background. Any ideas?
Additionally- read about an option of setting .vscode/settings.json to
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true }
to automatize the setup for newly onboarded developers but this still requires the plugin

Related

Completely disable auto run of Jest test runner in Visual Studio Code editor

I have some sets of Jest test cases that run Puppeteer browser tests.
I have tried these test runners
Jest (vscode-jest)
Jest Test Explorer (Jest Test Explorer for Visual Studio Code)
Jest Runner (vscode-jest-runner)
To me, I like Jest Test Explorer the most but it always auto-start running test cases.
As you can imagine, a lot of Chrome browser instances get launched when I open a project with VS Code.
I found some configurations but they cannot prevent auto-run test cases.
"testExplorer.onStart": "reset", or set to null
"testExplorer.onReload": "reset", or set to null
FYI, an example UI of Jest Test Explorer
Jest (vscode-jest) is a good runner but I can't stop auto-run with these settings as well.
"jest.runAllTestsFirst": false,
"jest.autoEnable": false,
"jest.showCoverageOnLoad": false
Therefore, right now Jest Runner (vscode-jest-runner) is the only runner that does not auto-start unit tests.
In addition, if you have any other test runners to suggest, please let me know.
Thank you so much.
For orta.vscode-jest extension, I added the configuration below in settings.json. You can open settings.json by doing Command + Shift + P (Ctrl + Shift + P on Windows), typing settings JSON and selecting Preferences: Open Settings (JSON).
"jest.autoRun": {
"onStartup": []
}
Or you can simply add:
"jest.autoRun": {}
If you want to run all tests on startup, add all-tests to the onStartup array:
"jest.autoRun": {
"onStartup": ["all-tests"]
}
I just set this simple option into the VS Code's settings.json:
"jest.autoRun": "false"
I made it work by only setting the setting "jest.autoEnable": false, on my settings.json and restarting VSCode. At least, it is working until now and it hasn't broken yet: Disable starting Jest automatically
To open your settings.json:
Press Ctrl+Shift+P
Then type Preferences: Open Settings (JSON)
At the time of writing (Dec 22) the new way to do this (as per https://github.com/jest-community/vscode-jest/blob/master/README.md#how-to-trigger-the-test-run) is to have the following in the VS Code settings.json. Note I had previously tried the other answers but none worked.
"jest.autoRun": { "watch": false }
Go to vscode setting.json
You can either add
"jest.autoRun": "off"
or
"jest.autoRun": false
both are valid options.
You can checkout the official recommended settings here.
https://github.com/jest-community/vscode-jest/blob/master/README.md#how-to-trigger-the-test-run
"jest.autoEnable": false
is deprecated.
What it worked for me was:
File -> preferences -> settings. Then under the panel user (in workspace is as well but I am not sure if you need to modify it there as well), go to extensions -> jest.
There you will have a section jest: auto run and you will find a link "edit in settings.json" and modify what is there for this
"jest.autoRun": {
"watch": false
}
There's some great updated docs here
Migration rule from settings prior to v4:
if "jest.autoEnabled" = false => manual mode: "jest.autoRun": "off"
if "jest.runAllTestsFirst" = false => "jest.autoRun": {"watch": true }
if no customization of the 2 settings and no "jest.autoRun" found =>
First open the jest extension settings.json in the vs code. In the json script add "jest.autoRun": "off" to disable test autorun. Below, I add other options as well.
Source: Documentation
fully manual
there will be no automatic test run, users will trigger test run by either command or context-menu.
Example: "jest.autoRun": "off"
automatically run tests when test file changed
the extension will trigger test run for the given test file upon save.
Example: "jest.autoRun": {"watch": false, "onSave": "test-file"}
automatically run tests when either test or source file changed:
the extension will trigger test run for the given test or source file upon save.
Example: "jest.autoRun": {"watch": false, "onSave": "test-src-file"}

SublimeREPL (SublimeText 3) interactive mode settings

I have manage to install and use sublimeREPL in sublimetext3, setting an new build system
My only problem is that I can not set SublimeREPL to interactive mode so I can give inputs through sublimetext3 shell.
I tried to edit the string setting "-i" but not worked.
Any idea how to set up this? Is there any workaround?
Solved,
I used "i" instead of "-i" to make sublimeREPL interactive.
Everything is ok now.

Running SonarQube analysis scan - SonarSource build-wrapper

I'm new to running SonarQube scans and I get this error message in the log in Jenkins:
16:17:39 16:17:36.926 ERROR - The only way to get an accurate analysis of your C/C++/Objective-C project is by using the SonarSource build-wrapper. If for any reason, the use of the build-wrapper is not possible on your project, you can bypass it with the help of the "sonar.cfamily.build-wrapper-output.bypass=true" property. By using that property, you'll switch to an "at best" mode that could result in false-positives and false-negatives.
Can someone please advise where I can find and run this SonarSource build-wrapper?
Thanks a lot for your help!
To solve this issue, download the Build Wrapper directly from your SonarQube Server, so that its version perfectly matches your version of the plugin:
Build Wrapper for Linux can be downloaded from URL
http://localhost:9000/static/cpp/build-wrapper-linux-x86.zip
Unzip the downloaded Build Wrapper,
Configure it in your PATH because it's just more convenient
export PATH=$PATH:/path/where/you/unzip
Once done, Run below commands.
build-wrapper-linux-x86-64 --out-dir <dir-name> <build-command>
build-wrapper-linux-x86-64 --out-dir build_output make clean all
Once all this done, you have to modify your sonar-project.properties file with following line. Note the dir-name is same directory which we defined in previous command.
sonar.cfamily.build-wrapper-output=<dir-name>
and then you can run the sonar scanner command.
sonar-scanner
this will do the analysis against your code. For more details, you can check this link.
Contacted support, turns out this was caused by missing the argument sonar.cfamily.build-wrapper-output in the scanner begin command.
Build wrapper downloads:
Linux: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
macOS: https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip
Windows: https://sonarcloud.io/static/cpp/build-wrapper-win-x86.zip
Some links covering how to run the build wrapper:
https://docs.sonarqube.org/latest/analysis/languages/cfamily/
https://blog.sonarsource.com/with-great-power-comes-great-configuration/

ember-cli-eslint error build passes

In an Ember application, I'm trying to switch from jshint to eslint. I've followed the readme for https://github.com/ember-cli/ember-cli-eslint. Everything seems to work when I run "ember test", except when there is an eslint error the build will still pass. I see the eslint error in the console output, but the build will say "ok" when it is done and all the unit tests have passed. How do I get the build to fail if there is an eslint error?
It looks like the default approach to this changed in 1.5.0 of ember-cli-eslint as described in this issue and the corresponding PR: https://github.com/ember-cli/ember-cli-eslint/issues/66
Looks like you have the option of switching the testGenerator function around to one of your own choosing however, so you should've able to pass one in to replace the default behavior if you want to. Might make upgrades to the extension a bit more fragile though ...

How to build production environment with canary flags?

I would like to use one of canary flags currently available in ember-data 2.4.0-beta.2. When I use ember serve it works as expected. But with ember build --prod it throws error on code that requires that flag. I assume I have to enable it somewhere but didn't have any luck finding any documentation for it.
// I added flag into environment and made sure that it is not overridden on production
EmberENV: {
FEATURES: {
'ds-references': true
}
},
It was bug that is fixed now. Fixup feature flagging infrastructure.