Skip to content

Commit b8bbaca

Browse files
committed
Show a final destination in an error message when a redirect happens
1 parent 39ecd1b commit b8bbaca

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/no-dead-link.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function reporter(context, options = {}) {
126126

127127
report(node, new RuleError(lintMessage, { index }));
128128
} else if (redirected) {
129-
const lintMessage = `${uri} is redirected. (${message})`;
129+
const lintMessage = `${uri} is redirected to ${redirectTo}. (${message})`;
130130
const fix = fixer.replaceTextRange(
131131
[index, index + uri.length],
132132
redirectTo,

test/no-dead-link.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tester.run('no-dead-link', rule, {
4242
errors: [
4343
{
4444
message:
45-
'https://httpstat.us/301 is redirected. (301 Moved Permanently)',
45+
'https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)',
4646
line: 1,
4747
column: 18,
4848
},
@@ -54,7 +54,7 @@ tester.run('no-dead-link', rule, {
5454
errors: [
5555
{
5656
message:
57-
'https://httpstat.us/301 is redirected. (301 Moved Permanently)',
57+
'https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)',
5858
line: 1,
5959
column: 25,
6060
},
@@ -65,7 +65,8 @@ tester.run('no-dead-link', rule, {
6565
output: 'should treat 302 [link](https://httpstat.us/)',
6666
errors: [
6767
{
68-
message: 'https://httpstat.us/302 is redirected. (302 Found)',
68+
message:
69+
'https://httpstat.us/302 is redirected to https://httpstat.us/. (302 Found)',
6970
line: 1,
7071
column: 25,
7172
},

0 commit comments

Comments
 (0)