
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
eslint-xml-parser
Advanced tools
Inspire by eslint-xml-parser
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-xml-parser
parser
option to your .eslintrc.*
file.--ext
CLI option{
"parser": "eslint-xml-parser"
}
$ eslint "src/**/*.{js,htm,html}"
# or
$ eslint --ext .htm --ext .xml --ext .js src
Within your .eslintrc.*
file, the parserOptions
property supports the same options as espree. For example:
{
"parser": "eslint-xml-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 xml files into AST structures
The npm package eslint-xml-parser receives a total of 54 weekly downloads. As such, eslint-xml-parser popularity was classified as not popular.
We found that eslint-xml-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
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.