Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Feature: check for syntax error on build #478

Closed
airportyh opened this issue Feb 14, 2014 · 9 comments
Closed

Feature: check for syntax error on build #478

airportyh opened this issue Feb 14, 2014 · 9 comments

Comments

@airportyh
Copy link
Contributor

I'd like to add the feature of syntax error checking to component build. If any of the components have a syntax error, it would error out. Had a look at the code and it seems the proper place to put it would be component-builder. However, component itself isn't linking to the latest version of builder, see here. When I tried to update component to point to builder's latest, I got this error

/Users/airportyh/Home/Code/component/bin/component-build:77
builder.copyAssetsTo(program.out);
        ^
TypeError: Object #<Builder> has no method 'copyAssetsTo'
    at Object.<anonymous> (/Users/airportyh/Home/Code/component/bin/component-build:77:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Not sure which route to pursue. Please help point me in the right direction.

@anthonyshort
Copy link
Contributor

Adding a linter builder plugin could make the most sense for this I think. That way it could just pick up a bunch of different things including syntax errors.

@jonathanong
Copy link
Contributor

i'm not sure how to do this without actually parsing the javascript with esprima or jshint or something, which would make builds VERY SLOW.

would be better as a plugin for now, then we can think about adding it once it's working well

@anthonyshort
Copy link
Contributor

component build --use lint

or something.

@jonathanong
Copy link
Contributor

oh yeah. i run lint in a separate process on every build. it's super slow though - 50ms builds and 2.5s lint? which is why i don't run lint in the same process as the builder and don't really want to advocate putting it in the builder (unless someone makes it really fast with caching n stuff, though i lint my server-side js at the same time for the hell of it)

@tj
Copy link
Contributor

tj commented Feb 14, 2014

I pretty much never lint haha, IMO this more of a CI / editor feature. it could be a plugin for component but definitely not core

@tj tj closed this as completed Feb 14, 2014
@tj
Copy link
Contributor

tj commented Feb 14, 2014

@airportyh as far as your issue goes, use the 0.10.x releases of builder

@airportyh
Copy link
Contributor Author

Syntax error checking can actually be done fast w/o using Esprima - by executing the script and then checking if a syntax error was thrown, see syntax-error. This is what's being done in browserify, and is indeed fast (I've some experience doing perf tuning in browserify recently). I can put in some benchmarks to prove it if needed. I think this is a nice improvement in UX w/o performance penalty.

@visionmedia so new development should be done on 0.10.x branch? are there plans to upgrade component to the latest of builder?

@tj
Copy link
Contributor

tj commented Feb 15, 2014

yup we want to upgrade eventually but we need some more breaking changes to 0.12.x

@ericgj
Copy link
Contributor

ericgj commented Feb 15, 2014

👍 it would be nice to use something like this as a plugin in the new builder API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants