Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@clr/eslint-plugin-clarity-adoption
Advanced tools
A set of ESLint rules for Clarity Core adoption.
npm install --save-dev @clr/eslint-plugin-clarity-adoption @typescript-eslint/parser eslint
Configure in your ESLint config file like you see below. The overrides section is important to enable it to parse HTML files as well.
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2015
},
"plugins": ["@clr/clarity-adoption"],
"rules": {
"@clr/clarity-adoption/no-clr-accordion": "warn",
"@clr/clarity-adoption/no-clr-alert": "warn",
"@clr/clarity-adoption/no-clr-badge": "warn",
"@clr/clarity-adoption/no-clr-button": "warn",
"@clr/clarity-adoption/no-clr-card": "warn",
"@clr/clarity-adoption/no-clr-checkbox": "warn",
"@clr/clarity-adoption/no-clr-datalist": "warn",
"@clr/clarity-adoption/no-clr-form": "warn",
"@clr/clarity-adoption/no-clr-icon": "warn",
"@clr/clarity-adoption/no-clr-input": "warn",
"@clr/clarity-adoption/no-clr-label": "warn",
"@clr/clarity-adoption/no-clr-list": "warn",
"@clr/clarity-adoption/no-clr-modal": "warn",
"@clr/clarity-adoption/no-clr-password": "warn",
"@clr/clarity-adoption/no-clr-radio": "warn",
"@clr/clarity-adoption/no-clr-range": "warn",
"@clr/clarity-adoption/no-clr-select": "warn",
"@clr/clarity-adoption/no-clr-textarea": "warn",
"@clr/clarity-adoption/no-clr-toggle": "warn"
},
"overrides": [
{
"files": ["*.html"],
"parser": "@clr/eslint-plugin-clarity-adoption/html-parser"
}
]
}
Note: If you don't have ESLint config file, create a new file named .eslintrc.json in the root of your project and copy the content above.
Finally, you'll need to run eslint with the --ext
flag to enable HTML scanning like npx eslint --ext=ts,html src/
.
npm install
npm run watch
dist
directory and execute npm link
:cd ../../dist/lib
npm link
ng new linter-test-project
cd linter-test-project
npm link @clr/eslint-plugin-clarity-adoption
npm i -D @typescript-eslint/parser eslint
npm i
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2015
},
"plugins": ["@clr/clarity-adoption"],
"rules": {
"@clr/clarity-adoption/no-clr-accordion": "warn",
"@clr/clarity-adoption/no-clr-alert": "warn",
"@clr/clarity-adoption/no-clr-badge": "warn",
"@clr/clarity-adoption/no-clr-button": "warn",
"@clr/clarity-adoption/no-clr-card": "warn",
"@clr/clarity-adoption/no-clr-checkbox": "warn",
"@clr/clarity-adoption/no-clr-datalist": "warn",
"@clr/clarity-adoption/no-clr-form": "warn",
"@clr/clarity-adoption/no-clr-icon": "warn",
"@clr/clarity-adoption/no-clr-input": "warn",
"@clr/clarity-adoption/no-clr-label": "warn",
"@clr/clarity-adoption/no-clr-list": "warn",
"@clr/clarity-adoption/no-clr-modal": "warn",
"@clr/clarity-adoption/no-clr-password": "warn",
"@clr/clarity-adoption/no-clr-radio": "warn",
"@clr/clarity-adoption/no-clr-range": "warn",
"@clr/clarity-adoption/no-clr-select": "warn",
"@clr/clarity-adoption/no-clr-textarea": "warn",
"@clr/clarity-adoption/no-clr-toggle": "warn"
},
"overrides": [
{
"files": ["*.html"],
"parser": "@clr/eslint-plugin-clarity-adoption/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 an internalized version of eslint-html-parser. The original package is patched to work with HTML files containing more than one root element, such as:
<div>...</div>
<div>...</div>
FAQs
A set of ESLint rules for Clarity Core adoption.
The npm package @clr/eslint-plugin-clarity-adoption receives a total of 4 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.