Configuring *all* JSHint settings in WebStorm IDE - jshint

After a somewhat comprehensive evaluation of IDEs for use in front end development, WebStorm leads the pack I think.
The one missing piece is that we can't configure JSHint the way we need to. The WebStorm preferences GUI provides some options, but not the full set. The GUI only lets you configure 15 of the 30 or so actual available options.
This is a problem because we don't want to change our coding practices just because an IDE doesn't let us configure linting the way we want.
Is there a hacky way to go in and adjust the JSHint library behind the scenes for WebStorm?

You can configure all the options you'd like in a .jshintrc file located in the root directory of your project. This will be a project-wide setting.
From https://www.jetbrains.com/webstorm/webhelp/jshint.html:
Use config files
Select this check box to have the code verified according to the settings from a configuration file. A configuration file is a JSON file with the extension .jshintrc that specifies which JSHint options should be enabled or disabled. WebStorm will look for a .jshintrc file in the working directory. If the search fails, WebStorm will search in the parent folder, then again in the parent folder. The process is repeated until WebStorm finds a .jshintrc or reaches the project root. To have WebStorm still run verification in this case, specify the default configuration file to use.
I've been using this for a while and it works great. Plus you can commit it to your repo and ensure the entire team follows the same code style. Also a great place to add globals.

I'm not aware of any hacky way to do it, but you can vote for the existing feature request.

There's a per-file solution that works, but is not ideal. Would prefer an IDE or project-wide fix/hack.
Set JSHint options at the top of your file:
/*jshint laxcomma:true, asi:true */

Related

Non-project files with ReSharper (SASS)

I'm running JetBrains ReSharper 8.2 on a project that uses SASS for styling.
I compile my seperate scss files into one file "common.css". This file is not included in the project, but gets compiled on build on the server (grunt + compass takes care of this).
I don't want to include this file, but only my SCSS files in the project. This however causes ReSharper to report a lot of errors ("Unknown CSS class"...) in my views because the file isn't included.
Is there a workaround for this (without disabling css errors in settings)?
I've tried the "ReSharper.ExternalCode" extension (https://resharper-plugins.jetbrains.com/packages/ReSharper.ExternalCode), but without any luck.
Sadly, there isn't a workaround for this. ReSharper doesn't know about SCSS files, and doesn't know anything about files that aren't included in the project, so it can only assume the CSS classes are undefined.
The external code plugin should work and allow ReSharper to process the resulting css file. However, I'm not sure how flexible it is - I think it needs everything to be configured before the solution is opened. That is, it only tells ReSharper about the generated file when the solution is being opened. Configuring things while a solution is open probably won't be reflected immediately (but I haven't tried it). Similarly, it doesn't notify ReSharper of changes to the file, and I don't think that ReSharper sets up any monitoring. So if the file isn't available when the solution opens, or changes while it's open, ReSharper won't have correct information. I'd try and configure it, close the solution and reopen.

How to trigger LESS/SASS compiler manually in Netbeans

In Netbeans 7.4 you can configure LESS or SASS compilers. You can check the option to Compile on Save. That works great. But how can I trigger this action manually from Netbeans? I deleted the destination folder and want to recompile everything but I can't find how.
I believe it is not possible. But perhaps you could try to open project properties (right click on project) and in css preprocessors setting (see here) try one of following:
uncheck the "Compile on Save" option, confirm dialog and the open project properties again and check this option back. It could trigger recompilation
if the above won't help, try to remove all settings in the "Watch", confirm dialog and then enter your setting in the Watch section again
You need to change the paths of the css and less folders in your projects to the correct one. It should be relative to the project folder.
So if you have a folder named assets in the root of your project and inside it 2 folders css and less then their paths in the project CSS preprocessors settings should be /assets/less and /assets/css.
As soon as you correct this your less files should compile on next save
I'm using NetBeans IDE 8.2 in August 2017, and there is a Recompile All Files button in Project Properties > CSS Preprocessors.
Less runs on save in netbeans and there isn't any menu item or shortcut.
If you want to activate the setup on save and you have problems i recommend to delete the less lines in your project.properties file going to the file tab and searching for the file in the nbproject/project.properties.

how to package/publish a PDF for deployment?

i'm trying to package a deployment for Azure, but it is not packaging some files that are needed for the app to work properly. Those files are mostly PDFs and DOCXs.
If I go to the Package/Publish settings I have 3 options:
1. Only files needed to run this application. This is the default option which is excluding the PDFs and DOCXs.
2. All files in this project. This is including the missing files, but it is also including the code behind files (even though they are compiled). I do not want to include those files.
3. All files in this project folder. Haven't even tried this one because it will probably be worse than option 2.
My question is how do I set which extensions are actually needed to run this application?
Right after posting this question, I figured it out. For any out there with the same or similar problem here it goes...
In order to include certain files in the deployment package you have to set build action of those files to Content. Just right click on the file in solution explorer and click Properties. There change the Build Action to Content:
Also, you have to set the the setting of the Package/Publish to "Only files needed to run this application". The default option.

FlexPMD and TextMate setup question: Creating rules

I wanted to get some assistance into how to set up new rulesets for Textmate, as I can't find the pmd.xml file that needs to be modified.
Thanks in advance
I couldn't find a default pmd.xml file anywhere, so I just used the Adobe Flex PMD Ruleset creator and then exported the default set of rules.
[edited to add]
My project was running using ANT and Hudson so I just put it in the root of that.
However, to properly test this out using TextMate I copied my project to match the following documented conditions:
"The bundle is currently experimental, as such it expects the following:
Source files to be in a saved TextMate project.
ActionScript and MXML source files to be in a directory named 'src'"
I then copied my pmd config file into the project root, opened it, and ran the FlexPMD 'Project' option.
This gave the illusion of using my file, so I renamed the file and deleted all but one rule to prove it wasn't being used.
The TextMate FlexPMD bundle documentation mentions:
To specify a custom ruleset specify it's path using the env var TM_FLEXPMD_RULESET.
So I rather than create a global variable which would affect all projects, I created a project dependent variable by:
The way to do this is currently a little secret but if you deselect everything in the project drawer, then click the info (circled I) button, a panel will appear where you can set variables.
So my variable was TM_FLEXPMD_RULESET with the value pmd_rules.xml
When I then ran the FlexPMD 'Project' option, only one rule was being run.

Liferay: how to avoid rebuilding/redeploying CSS files

if you're familiar with Liferay you'll know that when you make an itsy-bitsy change to a css file you shall rebuild the theme and redeploy it.
As for redeploying I made a symlink (mind you I'm on Windows: for the curious creating a symlink on Vista is just a matter of issuing mklink /d dir1 dir2).
But what about rebuilding the stuff with maven? I'd rather skip that step. Basically what it does is combyining and packing all CSS in one everything_packed.css. Is there a sort of config variable to tell liferay just to include the raw files and skip redeployment alltogether?
Thanks
Guys I found the solution myself.
You should have a file called portal-ext.properties file in
$TOMCAT_DIR/webapps/ROOT/WEB-INFO/classes
Or more specifically for my win setup in
C:\liferay\webapps\ROOT\WEB-INF\classes
The file would hold the value
theme.css.fast.load=false
This will prevent liferay to be looking for the everything_packed.css and so you're free to modify your stuff without rebuilding and CTRL-R to refresh the page and see the changes.
Just for completeness, as this question is somewhat old and the problem already solved: There's a lot more along these lines, e.g. javascript, layouts etc. that can be used uncached. This is documented in either the Liferay Wiki (as Developler Mode) or the Development Guide, available from the documentation site (though currently it's not there for the last version - if it's still not there when you're reading it, look for it (PDF) in the older versions.
It's advisable to use these settings only in development, not in production, as putting all css and javascript in as few files as possible results in a huge performance impact.
to include all those settings, just can also just add the following line into your portal-ext.properties file:
include-and-override=portal-developer.properties
this will include all the developer specific settings, and when you want to remove them, you can just comment out this line.
you can edit the css files of your theme from Webapps{your theme}\css
And can see the changes directly.
You can edit almost every file which doesn't require compilation.like .jsp files but not .java files

Resources