unicorn/relative-url-style
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/relative-url-style": "error",
},
},
];const url = new URL('./foo', base);const url = new URL('foo', base);Examples from the ESLint documentation.
unicorn/relative-url-style
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/relative-url-style": "error",
},
},
];unicorn/relative-url-style
unicorn plugin · style
{
"rules": {
"unicorn/relative-url-style": "error"
}
}Biome does not have this rule.
Prefer ternary expressions over simple if statements.
Enforce using the separator argument with Array#join().
Prefer using structuredClone to create a deep clone.
Require non-empty module attributes for imports and exports
Prefer String#replaceAll() over regex searches with the global flag and String#split().join().
Require non-empty specifier list in import and export statements.