How to set jshint/jsxhint "esnext" option in Atom - jshint

I am using Atom's linter, react, and linter-jshint/linter-jsxhint.
In my JSX files, I keep getting the warning
Warning: 'import' is only available in ES6 (use esnext option). (W119)
That's pretty straightforward. I did some searching, and found that this can be set under the jshintConfig option in package.json (when using NPM). My project uses NPM and I have a package.json. I added:
"jshintConfig": {
"esnext": true
}
After that, I did a reload but the warnings persist. I also modified my linter-jshint/linter-jsxhint config in Atom (config.cson) with:
"linter-jshint":
harmony: true
esnext: true
"linter-jsxhint":
harmony: true
esnext: true
And did a reload but that didn't help it either.
So: when using linter-jshint/linter-jsxhint as Atom packages, how to I set the esnext option?

You can create a .jshintrc in your project folder, it will be read by the linter as a json source file.
To use esnext option,
{
"esnext": true
}
You will probably need to reopen your JS file to be able to see the new changes.

First possibility, recommended : you can create a .jshintrc in you home directory and jshint will read it in case there is none in the project directory. You might need to restart Atom after.
Another possibility not recommended : you could also change the config of jshint in Atom and specify the location of your global .jshintrcif for some reason you don't want to put it in your home directory with the flag --config
'linter-jshint':
'jshintExecutablePath': /path/to/jshint --config /path/to/.jshinrc
Run 'which jshint' to find the path.
It is not recommended because every other .jshinrc file (in the project, etc.) will be ignore:
jshint will look for this configuration in a number of locations, stopping at the first positive match:
The location specified with the --config flag
A file named package.json located in the current directory or any parent of the current directory (the configuration should be declared as the jshintConfig attribute of that file's JSON value)
A file named .jshintrc located in the current directory or any parent of the current directory
A file named .jshintrc located in the current user's "home" directory (where defined)

You can use the inline configuration adding this comment in your file .js:
/* jshint esversion: 6 */
http://jshint.com/docs/

Related

Global deno.json configuration file?

I want to apply this deno.json configuration file to all my deno projects:
{
"fmt": {
"options": {
"indentWidth": 4
}
}
}
Is there a way to globally apply this configuration so I don't have to have this deno.json file in every project?
I'm using VSCode, Ubuntu and Deno 1.28.1.
Because of the way that the Deno VS Code extension overrides/suppresses the built-in TS language server, it is not advised to enable the extension globally: this would cause problems in every non-Deno TypeScript project.
That said, you can create a single deno.json(c) file at a high-level location in your filesystem — for example: in your home directory. To use a concrete example location — on Linux — /home/your_username/deno.json.
Then, when configuring a new VS Code project, you only need to configure the location of the config file in .vscode/settings.json in order for the extension to use it:
{
"deno.enable": true,
"deno.config": "/home/your_username/deno.json"
}
When using Deno in the CLI, it will automatically walk your filesystem and find the nearest parent config file. From the manual:
Since v1.18,
Deno will automatically detect deno.json or deno.jsonc configuration file if
it's in your current working directory (or parent directories).
Regardless of the above, this strategy is not advised: a better approach might be to simply to create a personal CLI script/function which will generate a new deno config and VS Code config from a template that you create. This way, each of your projects maintains its own configuration data (a good thing) and you also don't have to manually configure each new one because you did the work once to create the template generation script (win-win).

PhpStorm SCSS file-watcher creates duplicates

I recently added a SCSS file-watcher in PhpStorm and generally it does what it is suppose to. The only issue I have is that it creates a new folder within the sass-folder everytime it synchronizes. The new folder doesn't have a name but it includes the files of the sass-folder.
These are the settings of the file watcher:
Scope:
The sass-folder
Arguments:
--style expanded --no-cache --update $FileName$:../css/$FileNameWithoutExtension$.css
Output paths to refresh:
../css/$FileNameWithoutExtension$.css:.../css/$FileNameWithoutExtension$.css.map
Is there something wrong with the settings?
There are 3 dots in the output path. Change it to:
../css/$FileNameWithoutExtension$.css:../css/$FileNameWithoutExtension$.css.map

Browserify failing with cannot find module "lodash" error for some files

I am running browserify for an app.js located at some path and it fails everytime with cannot find module lodash from [PATH].
Running "browserify:build" (browserify) task
Error: Cannot find module 'lodash' from '/var/lib/jenkins/buildcode/output/mydir/app_store_richUI/cartridge/js'
Warning: Error running grunt-browserify. Use --force to continue.
The [PATH] is same where the app.js file is present. But, if I change the file name to some other js file at same path, it works. So, the scene is that it succeeds for some js file and fails for others at same path.
Can someone suggest something ?
I have the Browserify.js script installed globally.
Browserify.js
module.exports = {
build: {
files: {
'<%= settings["local.build.dir"] %>/output/<%= grunt.config("build") %>/app_eyeconic_richUI/cartridge/static/default/js/eyeconic.app.js':'<%= settings["local.build.dir"] %>/output/<%= grunt.config("build") %>/app_eyeconic_richUI/cartridge/js/app.js'
},
}
}
The path is shown correctly in the logs with other files. It fails only with app.js file
It was a very trivial issue but took quite some time to resolve.
The issue was that the build suite was at a different location than the build source.
The browserify task contained require statements and it searches for modules in the parent directories so it was not able to find the required module.
After copying the build suite at the same path as the source, it worked.
So currently, my gruntfile.js(and other files/folders in the suite), exports and output directory at are same path.

Stop PhpStorm file watchers running recursively (with Autoprefixer)

I've a PhpStorm file watcher running autoprefixer. However the file watcher runs recursively. I think this is because it generates a new css file which the file watcher then runs on.
Is there a way to force them to run only once?
I think I need a scope of Project files because I am not directly editing the css file, instead I have a SCSS file that creates a CSS file which should then be auto prefixed. My settings are shown below.
You have to:
create custom scope (Settings | Scopes .. or by clicking on corresponding "..." button in File Watcher);
[optionally] include desired files (e.g. *.css) -- not really required as "File Type" field of File Watcher already covers it
exclude already modified files (*.min.css)
Now use that scope in your File Watcher instead of default "Project Files"
Excluding directories from the Scope using a custom scope also works. This example is from a Symfony2 project.

How to change destination jar directory

How to change destination directory of jars getting downloaded by sbt in libraryDependencies.
I want to change it to some thing like $HOME/custom_jars rather than its default one ($HOME/.ivy2/....)
Thanks,
Abhinandan
Setting retrieveManaged to true causes sbt to create a lib_managed directory in your project directory and to put your dependency jars there.
The directory name is used is controlled by managedDirectory and defaults to baseDirectory.value / "lib_managed", but you can set it to something else if you like.

Resources