Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@clr/eslint-plugin-clarity-adoption
Advanced tools
A set of ESLint rules for Clarity Core adoption.
To install run npm install --save-dev @clr/eslint-plugin-clarity-adoption
and then add it to your eslint configuration like you see below. The overrides section is important to enable it to parse HTML files as well.
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2015
},
"plugins": ["@clr/clarity-adoption"],
"rules": {
"@clr/clarity-adoption/no-clr-button": "warn",
"@clr/clarity-adoption/no-clr-alert": "warn"
},
"overrides": [
{
"files": ["*.html"],
"parser": "eslint-html-parser"
}
]
}
Finally, you'll need to run eslint with the --ext
flag to enable HTML scanning like npx eslint --ext=ts,html src/
.
yarn
yarn run watch
yarn link
:yarn link
ng new linter-test-project
cd linter-test-project
yarn link @clr/eslint-plugin-clarity-adoption
yarn add -D @typescript-eslint/parser eslint
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2015
},
"plugins": ["@clr/clarity-adoption"],
"rules": {
"@clr/clarity-adoption/no-clr-button": "warn",
"@clr/clarity-adoption/no-clr-alert": "warn"
},
"overrides": [
{
"files": ["*.html"],
"parser": "@clr/eslint-plugin-clarity-adoption/dist/src/html-parser"
}
]
}
# Lint both the TypeScript and HTML files
npx eslint --ext=ts,html src/
Currently, the plugin contains a single rule - no-clr-button
. This rule reports the usage of <button class="btn btn-primary"></button>
inside HTML files or inside inlined Angular components templates (TS files).
For parsing the TS files in the project, the plugin uses @typescript-eslint/plugin
. Then, it parses the HTML within the component template with node-html-parser
. Using the AST tree provided from node-html-parser it detects the usage of <button class="btn btn-primary">
.
For parsing the HTML files, the plugin uses eslint-html-parser.
The HTML parser that we use - eslint-html-parser, cannot handle more than one root element in the HTML file. It doesn't report the rest of the tree. In the example below, only the div
element will be traversed.
<div>First</div>
<button class="btn btn-primary">Second</button>
FAQs
A set of ESLint rules for Clarity Core adoption.
The npm package @clr/eslint-plugin-clarity-adoption receives a total of 11 weekly downloads. As such, @clr/eslint-plugin-clarity-adoption popularity was classified as not popular.
We found that @clr/eslint-plugin-clarity-adoption demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.