Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression when a rule has no docs #49

Merged
merged 1 commit into from Nov 19, 2019

Conversation

hipstersmoothie
Copy link
Contributor

@hipstersmoothie hipstersmoothie commented Nov 18, 2019

This fixes a regression introduced by https://github.com/sindresorhus/eslint-formatter-pretty/pull/48/files

Previously rules without docs would produce an error that was ignored:

try {
  ruleUrl = getRuleDocs(x.ruleId).url;
} catch (_) {}

this was changed to

try {
  ruleUrl = data.rulesMeta[x.ruleId].docs.url;
} catch (_) {
  ruleUrl = getRuleDocs(x.ruleId).url;
}

(notice that the error is no longer caught)

My change matches the original behavior and catches the error

try {
	ruleUrl = data.rulesMeta[x.ruleId].docs.url;
} catch (_) {
	try {
		ruleUrl = getRuleDocs(x.ruleId).url;
	} catch (_) {}
}

@sindresorhus sindresorhus changed the title fix regression where rule has no docs Fix regression where rule has no docs Nov 19, 2019
@sindresorhus sindresorhus changed the title Fix regression where rule has no docs Fix regression when rule has no docs Nov 19, 2019
@sindresorhus sindresorhus changed the title Fix regression when rule has no docs Fix regression when a rule has no docs Nov 19, 2019
@sindresorhus sindresorhus merged commit 4790c1e into sindresorhus:master Nov 19, 2019
@sindresorhus
Copy link
Owner

Good catch :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants