sonarjs/no-angular-bypass-sanitization
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-angular-bypass-sanitization": "error",
},
},
];Angular built-in sanitization should not be disabled
The documentation shows no incorrect example for this rule.
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from "@angular/platform-browser";
import { ActivatedRoute } from '@angular/router';
@Component({
template: '<div id="hello"><h1>Hello {{name}}</h1></div>',
})
export class HelloComponent implements OnInit {
name: string;
constructor(private sanitizer: DomSanitizer, private route: ActivatedRoute) { }
ngOnInit(): void {
this.name = this.route.snapshot.queryParams.name;
}
}Examples from the ESLint documentation.
sonarjs/no-angular-bypass-sanitization
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-angular-bypass-sanitization": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
"Array.prototype.sort()" and "Array.prototype.toSorted()" should use a compare function
All branches in a conditional structure should not have exactly the same implementation
"new" should only be used with functions and classes
Constructors should not contain asynchronous operations