JSHint options do not apply (Sublime3) - sublimetext3

I've installed SublimeLinter and SublimeLinter-jshint and JSHint itself works. However, i'm not able to configure JSHint. I tried to add jshint settings to SublimeLinter.sublime-settings but it seems that there is no effect on JSHint.
This is what my settings (Preferences > Package Settings > SublimeLinter > Settings - User) look like:
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"maxdepth": 1,
"strict": "global",
"sub": true
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
I've added some example settings like '"maxdepth": 1', but these rules do not apply. What is missing here?

From the Settings section of the README on Github, also available on the Package Control page:
You can configure jshint options in the way you would from the command line, with .jshintrc files. For more information, see the jshint docs. The linter plugin does this by searching for a .jshintrc file [...]
Read the full section and the linked docs for all the directions, then place a .jshintrc file where appropriate for your project.

Related

How to configure and build VSCode with Omnipascal and Delphi

I have two problems.
The first is related with dfm form design preview.
Not work. I will try to simulate error message for more info. Before that I need to setup configuration due to the buld error:"Missig Form Unit".
Let start this amazing post with many different configuration. All the stuff are referring for Delphi and Omnipascal.
C:\Users\My-PC\AppData\Roaming\Code\User\settings.json
{
"window.zoomLevel": -0.3862065056838846,
"workbench.colorTheme": "Visual Studio 2019 Dark",
"editor.tabSize": 2,
"git.confirmSync": false,
"projectManager.git.baseFolders": [
],
"files.associations": {
"*.pas": "pascal"
},
"editor.fontFamily": "'Courier New', 'Courier New Cyr', Consolas, monospace, '#MS Gothic'",
"editor.wordWrapColumn": 200,
"editor.fontSize": 13,
"editor.scrollbar.verticalScrollbarSize": 10,
"GLOBAL": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"global": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"GTAGSCONF": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"GTAGSLABEL": "pygments",
"workbench.iconTheme": "material-icon-theme",
"files.encoding": "windows1251",
"omnipascal.defaultDevelopmentEnvironment":"Delphi",
"objectpascal.delphiInstallationPath":"C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source",
"omnipascal.delphiInstallationPath": "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source",
"omnipascal.searchPath": "D:\\Borland\\*;$(DELPHI)\\Lib;$(DELPHI)\\Bin;$(DELPHI)\\Imports;$(DELPHI)\\Projects\\Bpl;$(DELPHI)\\Rave5\\Lib;C:\\Program Files (x86)\\Embarcadero\\F\\Dcu\\D7;C:\\Program Files (x86)\\Embarcadero\\F\\Source;C:\\Program Files (x86)\\FTrial\\LIBD7;D:\\Borland\\Delphi7\\Projects\\Indy10\\Core;D:\\Borland\\Delphi7\\Projects\\Indy10\\Protocols;D:\\Borland\\Delphi7\\Projects\\Indy10\\SuperCore;D:\\Borland\\Delphi7\\Projects\\Indy10\\System;$(DELPHI)\\source\\vcl;$(DELPHI)\\Source\\Rtl;$(DELPHI)\\source\\rtl\\Corba45;$(DELPHI)\\source\\rtl\\Sys;$(DELPHI)\\source\\rtl\\Win;$(DELPHI)\\source\\rtl\\common;$(DELPHI)\\source\\Internet;$(DELPHI)\\source\\clx;$(DELPHI)\\source\\websnap;$(DELPHI)\\Source\\WebMidas;$(DELPHI)\\Source\\Indy;$(DELPHI)\\Source\\IntraWeb;$(DELPHI)\\Source\\Samples;$(DELPHI)\\Source\\Soap;$(DELPHI)\\Source\\ToolsAPI;$(DELPHI)\\Source\\Xml;C:\\Program Files (x86)\\Embarcadero\\S;C:\\Program Files (x86)\\rial\\LID7;",
"omnipascal.msbuildPath": "C:\\Users\\-PC\\.vscode\\extensions\\ms-dotnettools.csharp-1.22.1\\.omnisharp\\1.35.3\\.msbuild\\Current\\Bin\\",
"omnipascal.createBuildScripts": true,
"pascal.formatter.enginePath": "D:\\DWN\\prog\\jcf_243_exe\\JCF.exe",
"pascal.formatter.engineParameters": "D:\\DWN\\prog\\jcf_243_exe\\JCFSettings.cfg",
"pascal.format.wrapLineLength": 30000,
"pascal.formatter.engine": "jcf",
"editor.rulers": [
],
"editor.minimap.enabled": false,
"editor.renderControlCharacters": true,
}
D:\Git\develop.vscode\tasks.json
{
// See https://go.mic.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Delphi",
"type": "shell",
"windows": {
"command": "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\bin\\DCC32.EXE"
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"args": [
{
"value": "D:\\Git\\develop\\Ere\\Eore.dpr",
"quoting": "escape"
}
],
"problemMatcher": {
"owner": "external",
"pattern": {
"regexp": "^(.*.(pas|dpr|dpk))\\((\\d+)\\)\\s(Fatal|Error|Warning|Hint):(.*)",
"file": 1,
"location": 3,
"message": 5
}
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
https://github.com/alefragnani/vscode-language-pascal#code-navigation
GNU Global 6.5 or higher (http://www.gnu.org/software/global/global.html)
Exuberant Tags 5.5 or higher (http://ctags.sourceforge.net/)
Python 2.7 or higher (https://www.python.org/)
Python Pygments (via pip install Pygments)

Incorrect version of jest trying to run jest

I have jest tests in my angular project.
I have a package.json file specifying the version of jest I would like to use to run the test. The file includes:
"#types/jest": "^24.0.18",
"jest": "^24.9.0",
"jest-preset-angular": "^7.1.1",
The jest config also includes:
"setupFilesAfterEnv": [
"<rootDir>/setup-jest.ts"
],
This is where the issue occurs. When trying to run jest, I get the following message:
● Validation Warning:
Unknown option "setupFilesAfterEnv" with value ["<rootDir>/setup-jest.ts"] was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
I had a look at jest -h and found a flag which gives me the setup of the jest environment.
jest --showConfig
This however shows that I am running jest on version
"version": "23.6.0"
So my question lies here. How come after I do an npm i, the jest version trying to run the tests is different / old.
I tried installing jest-cli with the -g flag and the save-dev flag.
Also trying to run tests in VS Code, if thats any help.
Please help.
Thank you in advance.
Full log of npx jest --showConfig
● Validation Warning:
Unknown option "setupFilesAfterEnv" with value ["<rootDir>/setup-jest.ts"] was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
{
"configs": [
{
"automock": false,
"browser": false,
"cache": true,
"cacheDirectory": "/var/folders/bs/wrvrgl6132df8l5ndxv40m3m0000gn/T/jest_dx",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/",
"setup-jest.ts"
],
"detectLeaks": false,
"detectOpenHandles": false,
"errorOnDeprecated": false,
"filter": null,
"forceCoverageMatch": [],
"globals": {
"ts-jest": {
"tsConfig": "<rootDir>/tsconfig.spec.json",
"stringifyContentPathRegex": "\\.html$",
"astTransformers": [
"jest-preset-angular/InlineHtmlStripStylesTransformer"
]
}
},
"haste": {
"providesModuleNodeModules": []
},
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"ts",
"html",
"js",
"json"
],
"moduleNameMapper": [
[
"#app/(.*)",
"/Users/name/Projects/project/src/app/$1"
],
...
],
"modulePathIgnorePatterns": [],
"name": "6caa4...",
"prettierPath": "/Users/name/Projects/project/node_modules/prettier/index.js",
"resetMocks": false,
"resetModules": false,
"resolver": null,
"restoreMocks": false,
"rootDir": "/Users/name/Projects/project",
"roots": [
"/Users/name/Projects/project"
],
"runner": "jest-runner",
"setupFiles": [],
"setupTestFrameworkScriptFile": null,
"skipFilter": false,
"snapshotSerializers": [],
"testEnvironment": "/Users/name/Projects/project/node_modules/jest-environment-jsdom-thirteen/build/index.js",
"testEnvironmentOptions": {},
"testLocationInResults": false,
"testMatch": [
"**/__tests__/**/*.js?(x)",
"**/?(*.)+(spec|test).js?(x)"
],
"testRegex": "",
"testRunner": "/Users/name/node_modules/jest-jasmine2/build/index.js",
"testURL": "http://localhost",
"timers": "real",
"transform": [
[
"^.+\\.(ts|js|html)$",
"/Users/name/Projects/project/node_modules/ts-jest/dist/index.js"
]
],
"watchPathIgnorePatterns": []
}
],
"globalConfig": {
"bail": false,
"changedFilesWithAncestor": false,
"collectCoverage": true,
"collectCoverageFrom": null,
"coverageDirectory": "/Users/name/Projects/project/coverage",
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"coverageThreshold": null,
"detectLeaks": false,
"detectOpenHandles": false,
"errorOnDeprecated": false,
"expand": false,
"filter": null,
"globalSetup": null,
"globalTeardown": null,
"listTests": false,
"maxWorkers": 7,
"noStackTrace": false,
"nonFlagArgs": [],
"notify": false,
"notifyMode": "always",
"passWithNoTests": false,
"projects": null,
"rootDir": "/Users/name/Projects/project",
"runTestsByPath": false,
"skipFilter": false,
"testFailureExitCode": 1,
"testPathPattern": "",
"testResultsProcessor": null,
"updateSnapshot": "new",
"useStderr": false,
"verbose": null,
"watch": false,
"watchman": true
},
"version": "23.6.0"
}
Showing npm config get log here too:
; cli configs
metrics-registry = "http://.../.../npm-group/"
scope = ""
user-agent = "npm/6.9.0 node/v10.15.3 darwin x64"
; project config /Users/user/Projects/project/.npmrc
registry = "http://.../.../npm-group/"
; node bin location = /Users/user/.nvm/versions/node/v10.15.3/bin/node
; cwd = /Users/user/Projects/project
; HOME = /Users/user
; "npm config ls -l" to show all defaults.
I had the same issue, after a long search I've tried this:
type jest
Which gave me the location:
/usr/local/bin/jest
Renaming this file (or deleting it), solved the problem (note that now running jest will give command not found).

How to suppress warnings in sublimelinter using eslint?

I'm using sublime as my IDE, and have downloaded sublimelinter for linting my javascript with eslint. In the sublimelinter.sublimesettings file, I have it configured to use eslint shown below:
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save",
"linters": {
"eslint": {
"#disable": false,
"args": [],
"excludes": [],
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": true,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "000000",
"wrap_find": true
}
}
My problem is I can't find anything online to suppress the warnings that come from eslint. I've tried using "ignore": "W" as a value within eslint but it didn't work. Eslint works fine, I just can't seem to find a solution to suppressing the warnings. Any ideas?
EDIT:
Here's my .eslintrc file:
{
/* Don't search any further for .eslintrc files */
"root": true,
/* See all the pre-defined configs here: https://www.npmjs.com/package/eslint-config-defaults */
"extends": [
"eslint:recommended",
"defaults/configurations/google"
],
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals":{
"angular": 1,
"phoenix": 1,
"requirejs": 1
},
"rules": {
"indent": [
2,
2,
{ "SwitchCase": 1 }
],
/* We don't do this consistently, so disable it as it is treated as an error otherwise */
"newline-after-var": 0,
"dot-location": [2, "property"],
"no-extra-semi": 1,
"semi": 2,
"max-len": [2, 250, 2],
"eqeqeq": 2,
"comma-dangle": 1,
"no-console": 0,
"no-debugger": 1,
"no-extra-parens": 1,
"no-irregular-whitespace": 0,
"no-undef": 1,
"no-unused-vars": 2,
"semi-spacing": 1
}
}
The --quiet flag will suppress all warnings, but does not silence errors. Via the command line, you can run:
eslint --quiet
Alternatively, to have this flag automatically appended, add "quiet" to the args of the ESLint configuration, so you don't have to remember to add the flag each time.

What's the equivalent bs-config.js (Browsersync) of this command?

Browsersync is working fine with a PHP/Symfony 3 project with the following command:
browser-sync start --proxy http://localhost:8000 --files "web/css/**/*.css"
The browser will open at http://localhost:3000 and if I change something in web/css I can see the updated stylesheets without a full page reload. So far so good.
However it doesn't work with the following bs-config.js:
module.exports = {
"files": [
"web/css/**/*.css"
],
"server": false,
"proxy": "http://localhost:8000"
};
And the command:
browser-sync start
Browser will not load, changes aren't detected and reloading doesn't work. What I'm missing?
try this:
1º Create "bs-config.js" with: browser-sync init
2º Open file and edit like this:
module.exports = {
"ui": {
"port": 3001,
"weinre": {
"port": 8080
}
},
"files": "web/css/**/*.css",
"watchOptions": {},
"server": false,
"proxy": "http://localhost:8000",
"port": 3000,
"middleware": false,
"serveStatic": [],
"ghostMode": {
"clicks": true,
"scroll": true,
"forms": {
"submit": true,
"inputs": true,
"toggles": true
}
},
"logLevel": "info",
"logPrefix": "BS",
"logConnections": false,
"logFileChanges": true,
"logSnippet": true,
"rewriteRules": [],
"open": "local",
"browser": "default",
"cors": false,
"xip": false,
"hostnameSuffix": false,
"reloadOnRestart": false,
"notify": true,
"scrollProportionally": true,
"scrollThrottle": 0,
"scrollRestoreTechnique": "window.name",
"scrollElements": [],
"scrollElementMapping": [],
"reloadDelay": 0,
"reloadDebounce": 0,
"reloadThrottle": 0,
"plugins": [],
"injectChanges": true,
"startPath": null,
"minify": true,
"host": null,
"localOnly": false,
"codeSync": true,
"timestamps": true,
"clientEvents": [
"scroll",
"scroll:element",
"input:text",
"input:toggles",
"form:submit",
"form:reset",
"click"
],
"socket": {
"socketIoOptions": {
"log": false
},
"socketIoClientConfig": {
"reconnectionAttempts": 50
},
"path": "/browser-sync/socket.io",
"clientPath": "/browser-sync",
"namespace": "/browser-sync",
"clients": {
"heartbeatTimeout": 5000
}
},
"tagNames": {
"less": "link",
"scss": "link",
"css": "link",
"jpg": "img",
"jpeg": "img",
"png": "img",
"svg": "img",
"gif": "img",
"js": "script"
}};
3º Run the server: php -S localhost:8000
4º Start BrowserSync: browser-sync start --config bs-config.js

SublimeLinter ignore missing semicolons

I'm using a non-semicolon based coding style in one of my node apps, but the problem is SublimeLinter is logging all the missing semicolons, and eventually stops with a "Too many errors" error, and stops linting the rest of the script.
I've tried adding an ignore_match object to both the default and user settings, but nothing works. I've also restarted after each time I've tried just to make sure.
I've even tried adding it to the excludes portion of the settings.
This is the resource I was using:
Linter Settings
Here is one of the errors I'm getting:
Z:\www\site\node\workers.js: line 162, col 2, Missing semicolon. (W033)
Here's my settings: From User.
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"ignore_match": [
"Missing semicolon."
],
"lint_mode": "background",
"linters": {
"annotations": {
"#disable": false,
"args": [],
"errors": [
"FIXME"
],
"excludes": ["Missing semicolon"],
"warnings": [
"TODO",
"README"
]
},
"jshint": {
"#disable": false,
"args": [],
"excludes": ["Missing semicolon"]
},
"php": {
"#disable": false,
"args": [],
"excludes": []
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
EDIT:
Added ignore_match": ["Missing semicolon"] to the jshint options. It became:
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"ignore_match": ["Missing semicolon"]
},
Complete answer,
Full user settings json file:
{
"user": {
"linters": {
"jshint": {
"#disable": false,
"ignore_match": [
".*Missing.*",
]
},
}
}
}
Easy answer:
Add ignore_match": ["Missing semicolon"] to jshint options.
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"ignore_match": ["Missing semicolon"]
},

Resources