trails icon indicating copy to clipboard operation
trails copied to clipboard

eslint should ignore archetype folder

Open jaumard opened this issue 8 years ago • 4 comments

generator-trails need some <%= variable %> under archetype for some features like web server trailpack or template engine. But if we add this eslint crash with :

error Parsing error: Unexpected token <

Two solutions :

  • Tell eslint to ignore archetype folder
  • Tell eslint to allow <%= whatever %> on js file

Relative to : https://github.com/trailsjs/generator-trails/issues/14 https://github.com/trailsjs/generator-trails/issues/8

jaumard avatar Jan 10 '16 18:01 jaumard

Tell eslint to allow <%= whatever %> on js file

I think we should figure out how to do this. I'd to keep everything under eslint if possible.

tjwebb avatar Jan 10 '16 18:01 tjwebb

I agree with this ! I didn't know eslint (first time I use it) but found this http://eslint.org/blog/2014/11/es6-jsx-support/ so it's possible.

jaumard avatar Jan 10 '16 19:01 jaumard

In fact I see jsx is already added enabled, and yeoman templates are not jsx :( I ask on eslint gitter and on this issue https://github.com/yeoman/yo/issues/401#issuecomment-170573294 and there no way to support this.

Here is what I want to do (in config/main.js) :

packs: [
    require('trailpack-core'),
    require('trailpack-repl'),
    require('trailpack-router'),
    <%= trailpacks %>
  ],

Like this I can require all additional trailpacks given by the user. The only things I can do that doesn't break eslint is :

packs: [
    require('trailpack-core'),
    require('trailpack-repl'),
    require('trailpack-router'),
    require('<%= whatever %>')
  ],

It's not very a clean way to do it ^^ but if you're ok with this let me know.

jaumard avatar Jan 11 '16 14:01 jaumard

If it's a template for a generator, can we... generate something and lint that instead of the template source? It's a bit of a workaround but at least it does not require a custom parser. :)

robertrossmann avatar Mar 11 '16 22:03 robertrossmann