unicorn/string-content
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/string-content": "error",
},
},
];const foo = 'Someone\'s coming!';const foo = 'Someone’s coming!';Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
unicorn/string-content
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/string-content": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Prefer Uint8Array#toHex() and Uint8Array.fromHex() over manual and Buffer hex conversions.
Prefer Uint8Array#toBase64() and Uint8Array.fromBase64() over legacy base64 conversions and manual postprocessing.
Prefer arrow function properties over methods with a single return.