πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§π‘ This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.
When using a relative URL in new URL(), the URL should either never or always use the ./ prefix consistently.
// β
const url = new URL('./foo', base);
// β
const url = new URL('foo', base);Type: string
Default: 'never'
'never'(default)- Never use a
./prefix.
- Never use a
'always'- Always add a
./prefix to the relative URL when possible.
- Always add a
/* eslint unicorn/relative-url-style: ["error", "always"] */
// β
const url = new URL('foo', base);
// β
const url = new URL('./foo', base);