
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
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,705 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
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.