SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' - sublimetext3

This just happened completely randomly. All I did was restart Sublime and next I know I had to re-set the path to git.exe and SublimeLinter jshint is broken. I've removed and re-installed SublimeLinter and SublimLinter-jshint in various orders to try to fix it.
I also installed jshint globally with npm.
SublimeLinter default/user settings:
{
"default": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"mark_style": "outline",
"no_column_highlights_line": false,
"paths": {
"linux": [],
"osx": [],
"windows": ["C:\\Users\\x\\AppData\\Roaming\\npm\\node_modules\\jshint\\bin"]
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"python django": "python",
"html 5": "html",
"html (django)": "html",
"html (rails)": "html",
"php": "html"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
console:
SublimeLinter: jshint linter loaded
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
plugins loaded
SublimeLinter: debug mode: on
SublimeLinter: temp directory: c:\users\x\appdata\local\temp\SublimeLinter3
SublimeLinter: computed PATH from system:
C:\Users\x\AppData\Roaming\npm\node_modules\jshint\bin
C:\Program Files\Common Files\Microsoft Shared\Windows Live
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\ThinkPad\Bluetooth Software\
C:\Program Files\ThinkPad\Bluetooth Software\syswow64
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static
C:\Program Files (x86)\Common Files\Lenovo
C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\
C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\
C:\Program Files (x86)\Lenovo\Access Connections\
C:\Program Files\Common Files\Lenovo
C:\Program Files (x86)\Lenovo\Client Security Solution
C:\Program Files\Lenovo\Client Security Solution
C:\Program Files (x86)\OpenLDAP\kfw\Binary
C:\Program Files (x86)\Windows Live\Shared
C:\Program Files\Microsoft\Web Platform Installer\
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
C:\PROGRA~1\IBM\SQLLIB\BIN
C:\PROGRA~1\IBM\SQLLIB\FUNCTION
C:\Program Files\nodejs\
C:\Python27
SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'
SublimeLinter: found existing HTML syntax, version 3
SublimeLinter: found existing Rails syntax, version 1
found 3 files for base name Main.sublime-menu
Package Control: Skipping automatic upgrade, last run at 2014-07-30 10:51:51, next run at 2014-07-30 11:51:51 or after

According to the SublimeLinter documentation, it requires you to have linter executables in your path.
Most linter plugins require you to install a linter binary or library
and configure your PATH so that SublimeLinter can find it. You must
follow the linter plugin’s installation instructions to successfully
use it.
Have you tried opening a terminal window and seeing what happens if you type jshint --version? You should see something like jshint v2.5.0 as a response if it's already in your path.

Also, if you're like me, and can't modify your Windows PATH variables due to workplace restrictions, you can add the path to the Default and User settings like I did here Comment on SublimeLinter. This worked for Sublime 3 build 3065.
{
"default": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"mark_style": "outline",
"no_column_highlights_line": false,
"paths": {
"linux": [],
"osx": [],
"windows": ["C:/Users/myUserName/AppData/Roaming/npm"]
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"python django": "python",
"html 5": "html",
"html (django)": "html",
"html (rails)": "html",
"php": "html"
},
"warning_color": "DDB700",
"wrap_find": true
}
}

Related

How to setup SWC compiler

I'm using SWC for the first time and I'm not able to compile my ts files into normal js files.
When I run my command :
npx swc ./src -d dist
I got the error :
failed to process js file
Caused by:
0: failed to read swcrc file (src/index.ts)
1: failed to deserialize .swcrc (json) file: syntax error: 1:1
2: expected value at line 1 column 1
Here is my.swcrc I have generated with the SWC Playground
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false
},
"loose": false,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "commonjs"
},
"minify": false,
"isModule": true,
"sourceMaps": "inline"
}
My goal is to :
Take my ts files from my ./src dir
Compile and output it in a dist dir with source maps enabled

sublime text3 jshint error "Incompatible values for 'undefined' and 'undefined' linting options." when using IIFE expression

OS: macOS Sierra 10.12.5 .
Sublime Text: Build 3126 .
jshint v2.9.5 .
eslint v4.4.0 .
I have installed below packages for linting the js file
sublimeLinter-contrib-eslint
sublimeLinter-jshint
In my each .js file, IIFE (function(){ has been written on the top of the file BUT linter gives below error in gutter
Incompatible values for "undefined" and "undefined" linting options.
I have both .jshintrc and .eslintrc file in my project root directory BUT I am a bit confused
1. Which linter throw this error? and
2. How to resolve/fix it?
-.jshintrc_
{
"node": true,
"esversion": 6,
"globals" : {
"moment": true,
"saveAs": true
}
}
.eslintrc
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"angular": true,
"module": true,
"inject": true,
"moment": true,
"saveAs": true,
"AWS": true,
"require": false
},
"rules": {
"indent": [0,"tab"],
"linebreak-style": [0, "unix"],
"semi": [2, "always"]
}
}
JS file
(function() {
'use strict';
angular.module().controller(function () { //....code.... });
})();
I have tried the rules as per eslint documentation
"rules": {
"wrap-iife": [2, "outside"]
}
tried all possible values but did not succeed.
Found solution by using Debug mode for sublimeLinter.
there are mixing of 2 .jshintrc files. one is the default ( which can be viewed by (context menu > JSHint > Set Linting Preferences ) and other is custom .jshintrc which located in my project root directory and also there are 2 property esnext and esversion written which I think is not valid. from this refrence
so first clear all comments from default .jshintrc (/Users//Library/Application Support/Sublime Text 3/Packages/JSHint Gutter/.jshintrc) and remove esversion property from custom .jshintrc file and everything is working fine now.

Is 'El Capitan's' rootless breaking old grunt configs?

After migrating to El Capitan, it seems users are experiencing an issue with grunt installations, possibly related to the rootless changes of El Capitan. In particular, running the grunt --force command results in EPERM errors. The workflow is as follows:
Assuming npm has been installed, navigate to the grunt directory with package.json and gruntfile.js and invoke grunt:
grunt --force
Example Gruntfile.js file contents:
module.exports = function(grunt) {
// All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
// Configuration for concatenating files goes here.
dist: {
src: [
'../js/libs/owl.carousel.js',
'../js/libs/jquery.actual.js',
'../js/libs/chosen.jquery.js',
'../js/libs/jquery.parallax.js',
'../js/src/common.js'
],
dest: '../js/pro/global.js',
},
},
uglify: {
build: {
src: '../js/pro/global.js',
dest: '../js/pro/global.min.js',
},
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: '../img/src/',
src: ['**/*.{png,jpg,gif}'],
dest: '../img/pro/'
}]
}
},
compass: {
dev: {
options: {
sassDir: '../sass',
cssDir: '../css',
fontsDir: '../fonts',
imagesDir: '../img/',
images: '../img/',
javascriptsDir: '../js/pro',
//environment: 'development',
outputStyle: 'compressed',
relativeAssets: true,
httpPath: '.',
}
},
},
watch: {
scripts: {
files: ['../js/**/**.js'],
tasks: ['concat', 'uglify'],
options: {
spawn: true,
},
},
images: {
files: ['../img/src/**.{png,jpg,gif}'],
tasks: ['imagemin'],
options: {
spawn: true,
}
},
compass: {
files: ['../**/*.{scss,sass}'],
tasks: ['compass:dev'],
}
},
svgstore: {
defaults: {
options: {
prefix : 'icon-',
},
files: {
'../img/svg-defs.svg': ['../img/svg/*.svg']
}
}
},
});
// Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-svgstore');
// Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['concat', 'uglify', /*'imagemin',*/ 'compass', 'svgstore', 'watch']);
};
Example package.json file contents:
{
"name": "Call Me Maybe",
"version": "0.2.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-compass": "^1.0.4",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-imagemin": "^0.9.4",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "^0.9.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-svgstore": "^0.5.0"
}
}
The resulting EPERM errors are as follows:
Running "concat:dist" (concat) task
Warning: Unable to write "../js/pro/global.js" file (Error code: EPERM). Used --force, continuing.
Running "uglify:build" (uglify) task
Warning: Unable to write "../js/pro/global.min.js" file (Error code: EPERM). Used --force, continuing.
Running "compass:dev" (compass) task
Warning: Command failed: /bin/sh: compass: command not found. Used --force, continuing.
Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Used --force, continuing.
Running "svgstore:defaults" (svgstore) task
Warning: Unable to write "../img/svg-defs.svg" file (Error code: EPERM). Used --force, continuing.
Running "watch" task
Waiting...
Interestingly, Ruby and Compass are also installed, so it does align with the theory of the rootless unable to write to folders issues, but how can the dependency cores be moved elsewhere (i.e. /usr/local/bin) so this isn't an issue?
During the El Capitan Betas, some users suggested enabling root via terminal - though this seemingly no longer works, as the error persists and /usr/bin folder still doesn't allow for permission changes.
For those running into the same issue, I had to eliminate the use of binaries installed to the path: /usr/bin, and reinstall after updating the path /usr/local/bin. Ruby tended to be the primary culprit. Because I was struggling with locating all my ruby installs, I ended up installing rbenv to manage my ruby versions.
The following terminal commands may be helpful in identifying your problematic paths:
which ruby
gem environment
gem uninstall [insert gem name here]
[google how to set your paths to /usr/local/bin... (will be in a hidden file)]
gem install [insert gem name here]
Installing non-system software on /usr/bin is a bad move, and is now prohibited in El Capitan, and with good reason.
I am not familiar with grunt, but if you can get to use /usr/local/bin instead then probably everything works.

Sublime Text 3 and sublime-grunt-build

So i have an error, while i try to build, there is commandline which says:
grunt-cli: The grunt command line interface. (v0.1.13)
[Finished in 0.1s with exit code 99]
[cmd: ['grunt.cmd', '--no-color']]
[dir: F:\LavkaLavka\Shop]
[path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\SOFTWARE\System\DISKEE~1\;C:\Program Files (x86)\SOFTWARE\Players\Quick time\QTSystem\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\SOFTWARE\Design\NodeJS\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\SOFTWARE\Coders\MP4BOX;C:\Users\133\AppData\Roaming\npm]
So i have installed node.js with npm, then installed globally:
grunt
less
grunt-cli
grunt-less
grunt-contrib-concat
grunt-contrib-less
Then in sublime i've unpacked latest zip of ssublime-grunt-build here:
C:\Users\133\AppData\Roaming\Sublime Text 3\Packages\sublime-grunt-build
I have simple Sublime text 3 project file in core project folder with only this base folder:
{
"folders":
[
{
"path": "."
}
],
"settings":
{
"build_on_save": 1
}
}
with package.json:
{
"name": "133",
"description": "This is only a test.",
"version": "1.0.0",
"keywords": [
"css",
"less",
"mobile-first",
"responsive",
"front-end",
"framework",
"web"
],
"author": "133",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-less": "~1.0.0",
},
"engines": {
"node": "~0.12"
}
}
and Gruntfile.js:
module.exports = function(grunt) {
"use strict";
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * 133 v<%= pkg.version %>\n' +
' */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: false
},
dist: {
src: [
'js/133/transition.js',
'js/133/alert.js',
'js/133/button.js',
'js/133/carousel.js',
'js/133/collapse.js',
'js/133/dropdown.js',
'js/133/modal.js',
'js/133/tooltip.js',
'js/133/popover.js',
'js/133/scrollspy.js',
'js/133/tab.js',
'js/133/affix.js'
],
dest: 'js/133.js'
},
},
less: {
compileCore: {
options: {
strictMath: true
},
src: 'css/style.less',
dest: 'css/style.css'
}
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['concat', 'less']);
};
I've used Bootstrap 3 js files for test purpose
What am i missing?
I couldn't successfully google for grunt-cli exit code 99
and there are no official info on that i suppose...
Please help :)
Ok, it seems that i missed point of installing grunt locally via cd to my directory and then: install grunt..Is there any way of using global grunt and plugin files, wihtout installing to local directory? It could be more handy in my case)

Building node.js from sublime text (ERROR: The process "node.exe" not found.)

Step 1 : I installed node.js and used package control to install nodejs package for sublime.
Step 2 : Modified the sublime-settings to below
{
// save before running commands
"save_first": true,
// if present, use this command instead of plain "node"
// e.g. "/usr/bin/node" or "C:\bin\node.exe"
"node_command": "\"C:/Program Files/nodejs/node.exe\"",
// Same for NPM command
"npm_command": "\"C:/Program Files/nodejs/npm\"",
// as 'NODE_PATH' environment variable for node runtime
"node_path": "\"C:/Program Files/nodejs/node.exe\"",
"expert_mode": false,
"ouput_to_new_tab": false
}
Step 3 : I created a simple js file with console.log("Hello World");
When tried to build using Tools -> Build, It does print Hello World in the console, but also gives me the error
ERROR: The process "node.exe" not found.
Any help would be really appreciated as to why I'm getting this.
Thanks.
EDIT : I was able to fix it by removing the following from nodejs.sublime-build
"windows": { "cmd": ["taskkill /F /IM node.exe & node", "$file"] }, "linux": { "cmd": ["killall node; node", "$file"] }
On windows, instead of removing this line from nodejs.sublime-build
"windows": { "cmd": ["taskkill /F /IM node.exe & node", "$file"] }...
you can replace with
"windows": { "cmd": ["taskkill /F /IM node.exe & node 2>null", "$file"] }...
this allows to redirect the annoying error message of the TASKILL command to null.
On windows, apply absolute path of node.exe installation folder in nodejs.sublime-build file as follows:
"windows": {"cmd": ["C:/Program Files/nodejs/node.exe", "$file"]} ...

Resources