
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
grunt-jsbeautifier
Advanced tools
jsbeautifier.org for grunt
This plugin recommends using Grunt ~0.4.1
. Grunt ~0.3.0
is only suported till version 0.1.4
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
~0.4.1
npm install grunt-jsbeautifier --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks("grunt-jsbeautifier");
~0.3.0
Install this grunt plugin next to your project's grunt.js gruntfile with:
npm install grunt-jsbeautifier@0.1.4
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks("grunt-jsbeautifier");
"jsbeautifier" : {
files : ["src/**/*.js"],
options : {
}
}
"jsbeautifier" : {
"default": {
src : ["src/**/*.js"]
},
"git-pre-commit": {
src : ["src/**/*.js"],
options : {
mode:"VERIFY_ONLY"
}
}
}
You can run jsbeautifier on a single file by passing runtime command line argument. Its possible to combine this command with existing jsbeautifier task, so config from specified task can be used for beautifying mentioned file.
If you have multi task configured like this,
"jsbeautifier" : {
"default": {
src : ["path/to/some/files/*.js"],
options:{
js: {
indentSize: 5
}
}
}
}
and want to beautify a file which is lets say under
/tmp/some/non/configured/file.js
then run command like
grunt jsbeautifier:default:file:/tmp/some/non/configured/file.js
If you have single task configured like this,
"jsbeautifier" : {
src : ["path/to/some/files/*.js"],
options:{
js: {
indentSize: 5
}
}
}
and want to beautify a file which is lets say under
/tmp/some/non/configured/file.js
then run command like
grunt jsbeautifier::file:/tmp/some/non/configured/file.js
Type: Files
Default value: []
List of files to be beautified. This option is applicable only for Single Task
Type: Files
Default value: []
List of files to be beautified. This option is applicable only for Multi Task
Type: String
Default value: VERIFY_AND_WRITE
If mode is "VERIFY_ONLY", then task will fail if at least one file can be beautified. This is useful for pre-commit check.
Type: String
Default value: ""
All beautified file will be stored under "dest".
Type: String
Default value: null
Recommended for version < 0.2.7, use .jsbeautifyrc
for > 0.2.7
If a filename is specified, options defined therein will be used. The config
file must be valid JSON and looks like the one supported by js-beautify itself. Values defined in gruntfile will take precedence on config file values.
"jsbeautifier": {
files: ["src/**/*.js"],
options: {
config: "path/to/config/file",
css: {
indentSize: 5
},
html: {
indentSize: 7
}
}
},
Type: String
Default value: null
A valid version/range of js-beautify according to semver. By default plugin uses latest version of "js-beautify", if you need to use otherwise specify it here.
"jsbeautifier": {
files: ["src/**/*.js"],
options: {
config: "path/to/configFile",
html: {
braceStyle: "collapse",
indentChar: " ",
indentScripts: "keep",
indentSize: 4,
maxPreserveNewlines: 10,
preserveNewlines: true,
unformatted: ["a", "sub", "sup", "b", "i", "u"],
wrapLineLength: 0
},
css: {
indentChar: " ",
indentSize: 4
},
js: {
braceStyle: "collapse",
breakChainedMethods: false,
e4x: false,
evalCode: false,
indentChar: " ",
indentLevel: 0,
indentSize: 4,
indentWithTabs: false,
jslintHappy: false,
keepArrayIndentation: false,
keepFunctionIndentation: false,
maxPreserveNewlines: 10,
preserveNewlines: true,
spaceBeforeConditional: true,
spaceInParen: false,
unescapeStrings: false,
wrapLineLength: 0,
endWithNewline: true
}
}
},
Only specifiy options to overwrite.
NOTE: All options can be specified similar to js-beautify using underscore.
All files from foo folder except bar.js
jsbeautifier: {
files: ["foo/*.js", "!foo/bar.js"]
}
If you want use specific version of js-beautify instead of latest, please refer to npm shrinkwrap
If you need to beautify files other than js, json, css & html, it can be done by passing fileTypes.
For example, beautifying ".js.erb" files along with ".js", beautifying ".less" files along with ".css", beautifying ".html.erb" files along with ".html".
jsbeautifier: {
files: ["foo/css/*.css", "bar/css/*.less", "foo/js/*.js", "bar/js/*.js.erb", "foo/html/*.html", "bar/html/*.html.erb"],
options: {
js: {
fileTypes: [".js.erb"]
},
css: {
fileTypes: [".less"]
},
html: {
fileTypes: [".html.erb"]
}
}
}
Copyright (c) 2012 Vishal Kadam Licensed under the MIT license.
FAQs
jsbeautifier.org for grunt
The npm package grunt-jsbeautifier receives a total of 3,950 weekly downloads. As such, grunt-jsbeautifier popularity was classified as popular.
We found that grunt-jsbeautifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.