Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
eslint-html-parser
Advanced tools
Readme
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 9,683 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.