Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init(editor) {
const file = editor.getURI();
const config = file ? jshintCli.getConfig(file) : {};
const selectedText = editor.getSelectedText();
const text = selectedText || editor.getText();
let retText = '';
try {
if (atom.config.get('fixmyjs.legacy')) {
const jshint = require('jshint').JSHINT;
jshint(text, config);
retText = fixmyjs(jshint.data(), text).run();
} else {
retText = fixmyjs.fix(text, config);
}
} catch (err) {
console.error(err);
atom.notifications.addError('FixMyJS', {detail: err.message});
return;