unicorn/no-invalid-integrity
eslint-plugin-unicorn
No autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-invalid-integrity": "error",
},
},
];<script src="app.js" integrity="sha256-abc"></script>
<script src="app.js" integrity="sha25-abc"></script>
<link rel="stylesheet" href="style.css" integrity="sha384-not-a-digest"><script src="app.js" integrity={"sha256-" + "abc"} />;<script src="app.js" integrity="sha256-LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="></script>
<script src="app.js" integrity="ed25519-JrQLj5P/89iXES9+vFgrIy29clF9CC/oPPsw3c5D0bs="></script>const integrity = 'sha256-LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=';
<script src="app.js" integrity={integrity} />;Examples from the ESLint documentation.
unicorn/no-invalid-integrity
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-invalid-integrity": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow invalid or ignored Intl options.
Disallow comparing a single character from a string to a multi-character string.
Disallow invalid property descriptors.
Disallow invalid values for HTML boolean attributes.
Disallow invalid options in new Response(), Response.json(), and Response.redirect().