Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@msiebuhr/angular-enforcer
Advanced tools
Command line script to lint style rules in Angular templates and automatically correct them
Command line script to lint style rules in Angular templates and automatically correct them. Can be used on any HTML file, not just Angular templates.
from:
<div>
<div>
<span>
<img>
to:
<div>
<div>
<span>
<img>
</span>
</div>
</div>
from:
<B>BOLD TEXT</B>
to:
<b>
BOLD TEXT
</b>
npm install angular-enforcer -g
enforce [file path] [options]
where [file path] is a path to a file to enforce
cat [file path] | enforce -i
Simply pipe some file into the enforce command
enforce -g [glob string] [options]
where [glob string] node-glob is a string to search for files using
Ex: enforce -g src/folder/**/*.tpl
enforce -g [options]
This will run the angular-enforcer program on every html file in this folder and all child folders
You can also import angular-enforcer and use it as you want.
import ngEnforcer from 'angular-enforcer';
import 'fs';
const file = fs.readFileSync('file');
const output = ngEnforcer(file, {
lineLength: 150
});
The ngEnforce function takes a string of HTML and options and returns formatted HTML. Linting is not available when using this method.
Formatting options
--tab-length
: the number of spaces to consider a tab. Default is 4.--spaces
: If true (default), converts spaces to tabs, using the specified tab length. Otherwise it does the reverse, converting tabs to spaces.--line-length
: max line length. Default is 100.--closing-slash
: if true, convert --short-tags
: comma separated list of additional tags that have no associated end tag--expr-padding
: add a space before and after angular expressions (and a space after the "::" in one-time binded expressions). Default is true.--attr-newline
: If an html start tag is over the specified line-length, start each attribute on it's own line, indenting by one. Default is true.--empty-tag-same-line
: Empty DOM nodes will end their tags on the same line if it's within the max line length.--short-text-nodes
: DOM nodes with just text that can fit on one line will do so. Default is true. If this is false, the text nodes will be indented.--double-quotes
: If true, use double quotes for attributes, otherwise use single quotes.--reorder-attrs
: If true, alphabetize HTML attributes in each tag--block-spacing
: If true, add an empty line in between each HTML block--text-wrap
: If true, break long text nodes so that indentation + length of text <= line-length. Defaults to true.--wrap-ignored-tags
: comma separated list of tags to ignore long text nodes inside--remove-comments
: if true, enforcer will remove all HTML commentsCLI-only options
--config
-c
: path to the formatting config file. Default is .enforcer.json--save
-S
: report and correct all problems, overwriting all affected files--glob
-g
: Glob strings to look for files--stdin
-i
: read from STDIN instead of giving a file path.--verbose
-v
: more verbose reporting, including locations of problems.--quite
-q
: silences all output, even when using --diff or --verbose.--diff
-d
: print a colored diff of the changesAll options can be specified in an .enforcer.json file. All options are in camelCase.
{
"tabLength": 2,
"lineLength": 120
}
<input class="foobar"
bar="baz">
FAQs
Command line script to lint style rules in Angular templates and automatically correct them
The npm package @msiebuhr/angular-enforcer receives a total of 0 weekly downloads. As such, @msiebuhr/angular-enforcer popularity was classified as not popular.
We found that @msiebuhr/angular-enforcer 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.