In PhpStorm in file -> settings -> Language & Frameworks -> JavaScript -> JSHint I have checked Enable and Use config files. I have tried both options for location. For custom configuration file I used a path leading to my package.json yet I am not able to override jshint settings. It seems like if the IDE was looking somewhere else...
How to tell PhpStorm/WebStorm that it should use jsHintConfig from package.json?
If I use
"jshintConfig": {
"eqeqeq": true, // true: Require triple equals (===) for comparison
}
The IDE doesn't complain of ==.
I had to change the JSHint version from 2.8.0 (Bundled) to 2.9.1 and use Location -> Default settings.
Related
I have Prettier enabled in the plugins. The question is simply, where are these settings? Folder permissions or what? The picture where they are showing is from the intellij-support website. The picture with the question mark is with the settings on my PhpStorm
A possibility to run Prettier on Save has been introduced in PhpStorm 2020.1; if upgrading the IDE is not an option for you, I can only suggest setting it up as a file watcher in in Preferences | Tools | File Watchers and make sure that Auto-save edited files to trigger the watcher (https://www.jetbrains.com/help/webstorm/2019.1/using-file-watchers.html?section=Windows%20or%20Linux#ws_filewatcher_advanced_options) is disabled
So, basically, if you want to use Prettier with PhpStorm 2019.1.3 you need to install it with npm like this jetbrains.com/help/webstorm/2019.1/prettier.html and setup the configuration of it in the package.json under "prettier" key. Then you have to right-click on the file and select "Reformat with prettier". Maybe you can set hotkey for Prettier somewhere, the default ones do not work for me for some reason. If you want your code to be automatically formatted on save you need to install this plugin: https://plugins.jetbrains.com/plugin/7642-save-actions/versions "Save Actions". I installed 2.2.0 because it has support for 2018+.Then - because I couldn't find the place where you can change default formatting tool to "Prettier" you can setup the configuration under Settings->Editor->Code Style->choose the language you desire and then configure it. Could not find a way to setup prettier without json config or after setting it up to make it work on "Save" action. Answering this just because it might help somebody somewhere.
I'm using PHP_CodeSniffer via command line already, respecting my custom rule set located in the project root at .phpcs.xml
Now I'm trying to integrate the sniffer as inspection in PhpStorm.
First, I had to add /private to my Docker shared directories
Settings -> Languages & Frameworks -> Quality Tools has option By default project interpreter set. In the configuration for PHP_CodeSniffer, the paths to phpcs and phpcbf have been specified & validated
Settings - Editor -> Inspecions -> PHP_CodeSniffer validation has been enabled.
When I select e.g. PSR-12 as coding standard, the inspections seem to work.
How can I get my custom .phpcs.xml instead? Trying to select Custom and provide the absolute path to my file returns error:
phpcs: ERROR: the "<path>/.phpcs.xml" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend
I'm using latest version of PhpStorm (2020.3.2), PHP_CodeSniffer 3.5.8
I hope someone could tell where things are going wrong.
I would like to setup PhpUnit in PhpStorm. I press 1. Edit Configurations... and would like to enter this parameter in field 2.
I am using phpunit.xml as configuration file and all want to use a relative path like:
phpunit.xml
or use project root variable like
$PROJECT_ROOT/phpunit.xml
But both options are not working for me.
Based on your screenshot (the place where you want to use it): use full path -- in project settings such path is stored relative to the project root anyway (unless you specify some file which is outside of the project, of course) and the full path then reconstructed when needed (e.g. when shown to you or when used as a parameter during tests execution).
I don't think you'll be able to achieve what you want via the project's Run/Debug configurations. What might help you is the Default configuration file setting in your default project settings, which can be used to define the PHPUnit configuration file to use by default, so you don't need to specify it via the Use alternative configuration file option in your Run/Debug configuration.
To set this, open your Default Settings window, then navigate to Languages & Frameworks -> PHP -> PHPUnit. In the Test Runner section tick the Default configuration file checkbox and specify the location where you keep your configuration file. If this file will always be in the same path relative to your project root, you can use the $PROJECT_DIR$ variable to define the project root. So if your PHPUnit configuration file is always in the root of your project, you might set this to something like $PROJECT_DIR$/phpunit.xml. When you create a new project, its Default configuration file variable will be set to the file offset from your project root, and you won't need to use the Use alternative configuration file option in your Run/Debug configuration.
If you're opening the same project in different locations on the same machine this should work for new projects without any problem, if you want to share this configuration across machines, you might need to try PHPStorm's Exporting and Importing Settings functionality.
I'm not sure if this directly solves your problem, and it's a few months late anyway, but maybe this will be useful for someone else who stumbles across this question... The above instructions were correct for my 8.0.3 installation on Linux.
I just installed Sublime-jshint (and the requisite node.js + jshint) but get this error when I try to invoke JSHint from within ST2:
[Errno 2] No such file or directory
[cmd: [u'jshint', u'PATH-TO-THE-JS-FILE-I-AM-LINTING', u'--reporter', u'/home/cmg/.config/sublime-text-2/Packages/JSHint/reporter.js']]
[dir: DIR-MY-JS-FILE-IS-IN]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cmg/bin]
[Finished]
The final item in the given path is in the home dir of my user (cmg), so it's been customized somehow... but I don't recall how, so I don't know how to add the dir I need (~/node_modules/.bin).
I've added it to $PATH in my shell (via both .bashrc and .bash_profile) but ST2 doesn't pick it up.
(I'm on Ubuntu 14.04. All the usable stuff I've found via Google on this subject has been either OS X specific or related to ST's build system).
Basically, the exec command, which the jshint package uses internally, allows you to set/extend the PATH of the spawned subprocess. (docs)
The package actually uses this path argument on OSX, but has it hardcoded (I am partly guilty of that as I rewrote the command because it was just horrible before). It should allow for a setting to specify the path to your jshint executable, so I suggest you create an issue for that.
I don't know why ST dosn't pick up your PATH from somewhere else since I have very little experience with that.
Open /etc/profile in Sublime (using sudo) and add the following line at the very bottom:
export PATH=/home/cmg/node_modules/.bin:$PATH
and save the file. Restart completely, and your PATH should be updated.
I have installed Mercurial from the Ubuntu package repository. However I don't know how to enable extensions (q* commands). How should I do that? The help shows that
enabled extensions:
style (no help text available)
I want to enable mq and hgk.
Enable extensions in hgrc.
extensions
Mercurial has an extension mechanism for adding new features. To
enable an extension, create an entry for it in this section.
If you know that the extension is already in Python's search path, you
can give the name of the module, followed by =, with nothing after the
=.
Otherwise, give a name that you choose, followed by =, followed by the
path to the .py file (including the file name extension) that
defines the extension.
...
Example for ~/.hgrc:
[extensions]
# (the mq extension will get loaded from Mercurial's path)
mq =
# (this extension will get loaded from the file specified)
myfeature = ~/.hgext/myfeature.py
http://www.selenic.com/mercurial/hgrc.5.html#extensions
You can also enable an extension without editing the hgrc, if you want to do it one off. [Source]
hg --config extensions.histedit= --help
The documentation of both extensions shows how to enable them : MQ, Hgk.
The usual way to enable an extension is to add a line to your .hgrc (or Mercurial.ini on some Windows system). It is explained in the hgrc documentation.
In your following case, add this to your configuration file :
[extensions]
mq =
hgk=
You can put it in your global configuration file or the repository one, depending if you want to have the extensions activated in every repository or just a specific one.
The output of hg help extensions starts with
Using additional features
Mercurial has the ability to add new features through the use of
extensions. Extensions may add new commands, add options to existing
commands, change the default behavior of commands, or implement hooks.
Extensions are not loaded by default for a variety of reasons: they can
increase startup overhead; they may be meant for advanced usage only; they
may provide potentially dangerous abilities (such as letting you destroy
or modify history); they might not be ready for prime time; or they may
alter some usual behaviors of stock Mercurial. It is thus up to the user
to activate extensions as needed.
To enable the "foo" extension, either shipped with Mercurial or in the
Python search path, create an entry for it in your configuration file,
like this:
[extensions]
foo =
You may also specify the full path to an extension:
[extensions]
myfeature = ~/.hgext/myfeature.py
So just add
[extensions]
mq =
to enable the MQ extension.