Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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 129 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.