
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
eslint-html-parser
Advanced tools
Parser for ESLint that parses HTML files into AST structures and falls back to an ECMAScript parser for .js files
Custom ESLint parser for HTML files that falls back to using espree or another JavaScript parser for .js
and .jsx
files and for <script>
tags within the HTML.
$ npm install --save-dev eslint eslint-html-parser
parser
option to your .eslintrc.*
file.--ext
CLI option{
"parser": "eslint-html-parser"
}
$ eslint "src/**/*.{js,htm,html}"
# or
$ eslint --ext .htm --ext .html --ext .js src
Within your .eslintrc.*
file, the parserOptions
property supports the same options as espree. For example:
{
"parser": "eslint-html-parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018,
"ecmaFeatures": {
"globalReturn": false,
"impliedStrict": false,
"jsx": false
}
}
}
The only additional option under parserOptions
is parser
, which specifies the JavaScript parser that eslint-html-parser
will fall back to in order to parse JavaScript. This option defaults to espree
.
HTML files are parsed into an AST, which can be traversed, examined, and linted with the visitor pattern like any other ESLint source. The HTML AST that is produced has the following types of nodes and structure:
HTMLElement
HTMLAttribute
HTMLAttributeName
HTMLAttributeValue
HTMLText
HTMLWhitespace
HTMLComment
HTMLProcessingInstruction
Note: The children
property for HTMLElement
nodes for <script>
tags will contain the AST resulting from parsing the script's text.
FAQs
Parser for ESLint that parses HTML files into AST structures and falls back to an ECMAScript parser for .js files
The npm package eslint-html-parser receives a total of 6,557 weekly downloads. As such, eslint-html-parser popularity was classified as popular.
We found that eslint-html-parser 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
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.