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

Using --eslint option gives an error #171

Open
chooban opened this issue Dec 4, 2015 · 2 comments
Open

Using --eslint option gives an error #171

chooban opened this issue Dec 4, 2015 · 2 comments

Comments

@chooban
Copy link

chooban commented Dec 4, 2015

I think this is more a support issue, as I'm guessing I'm doing something wrong. I have an eslint rc file which runs happily using eslint, but seems to cause issue when combined with Plato. If I use a yml file I get...

$ plato -d report/ --eslint .eslintrc.yml lib/**
undefined:1
rules:
^
SyntaxError: Unexpected token r
    at Object.parse (native)
    at Object.exports.exec(...\node_modules\plato\lib\cli.js:49:21)
    at Object.<anonymous>(...\node_modules\plato\bin\plato:19:5)

If I try a JavaScript version of the config file I get a similar parsing error.

I'm hoping this is a PEBCAK issue! :)

@leozdgao
Copy link

leozdgao commented Jan 3, 2016

I have the same issue when I use eslint configuration in yaml format, I check the cli code, and it seems it only support JSON format:

} else if (exports.args.e) {
  json = fs.readFileSync(exports.args.e.value).toString();
  jshintrc = JSON.parse(util.stripComments(json));
  platoOptions.eslint = jshintrc;
}

@JSlain
Copy link

JSlain commented Sep 2, 2016

The way Plato loads the configuration file is wrong.
ESLint usually does some stuff before using the actual config.
For example, extends:'eslint:recommended' doesn't seem to work the way it is now.
I've been able to make it work because i doesn't use plato from cli, but from a gulp task, and i must load the configuration file myself (and i found a good way of doing it).
It think this you enable plato to load any kind of config file, and let ESLint do its work before using the config.

var CLIEngine = require('eslint').CLIEngine;

var config = new CLIEngine().getConfigForFile(yourFile);

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

No branches or pull requests

3 participants