jhusain/eslint-plugin-immutable

wrong no-let behavior

Closed this issue · 3 comments

let config = {};

try {
    config = JSON.parse(fs.readFileSync('./.babelrc'));
} catch (err) {
    console.error('==>     ERROR: Error parsing your .babelrc.');
    console.error(err);
}

require('babel-register')(config);

error - unexpected let

This is indeed supposed to be an error - the rule forbids all usage of let.

const config = (() => {
     try {
         return JSON.parse(fs.readFileSync('./.babelrc'));
     } catch (err) {
        console.error('==>     ERROR: Error parsing your .babelrc.');
        console.error(err);
    }
})()

require('babel-register')(config);

You can do it like this instead @budarin

Thanks!