How to use the supports-hyperlinks.supportsHyperlink function in supports-hyperlinks

To help you get started, we’ve selected a few supports-hyperlinks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sindresorhus / eslint-formatter-pretty / index.js View on Github external
try {
				ruleUrl = data.rulesMeta[x.ruleId].docs.url;
			} catch (_) {
				try {
					ruleUrl = getRuleDocs(x.ruleId).url;
				} catch (_) {}
			}

			const line = [
				'',
				x.severity === 'warning' ? logSymbols.warning : logSymbols.error,
				' '.repeat(maxLineWidth - x.lineWidth) + chalk.dim(x.line + chalk.gray(':') + x.column),
				' '.repeat(maxColumnWidth - x.columnWidth) + x.message,
				' '.repeat(maxMessageWidth - x.messageWidth) +
				(ruleUrl && supportsHyperlink(process.stdout) ? ansiEscapes.link(chalk.dim(x.ruleId), ruleUrl) : chalk.dim(x.ruleId))
			];

			if (!showLineNumbers) {
				line.splice(2, 1);
			}

			return line.join('  ');
		}

		return '';
	}).join('\n') + '\n\n';

supports-hyperlinks

Detect if your terminal emulator supports hyperlinks

MIT
Latest version published 1 year ago

Package Health Score

71 / 100
Full package analysis