Can we opt-in more linters (like eslint)?
When we run polymer lint:
Maybe with gulp tasks? Or how?
We're currently looking into making polymer-cli commands more customizable/extensible. This is a good use case to consider.
Do you write your web component JavaScript in separate js files? If so most linters will still work and can be run as a separate command before/after polymer lint. Different build tools (including npm run scripts) can make calling these together easier.
No, I write my web component JavaScript in the same file, like all the PolymerElements.
Now I'm trying to use only the Polymer CLI commands.
So I proposed what we had spoken here: https://github.com/PolymerElements/polymer-starter-kit/pull/779#issuecomment-212012869.
But yes, we can use npm run scripts. I use it previously.
We're going to try to add more functionality via hooks, probably exposed initially to Gulp. I'll leave this issue open so we can update it when the appropriate hooks land.
We've released polymer-build for customizing the build process, but haven't yet looked into customizing the polymer lint process.
HOWEVER...
The polymer-build pipeline reads files from your source directory, processes them (splitting+rejoining HTML files supported), and then writes them to disk. If you skip the last write step, you now have a stream with all the files you need in it. This could be piped into a linting vinyl stream like gulp-eslint :)
If anyone reading is interested in playing around with this idea I'd love to hear how it goes. If it magically works we could throw together a quick prototype of a linting library.
@FredKSchott We have open the PR https://github.com/PolymerElements/polymer-starter-kit/pull/779 in the PSK.
But I think we have to update it.
This would be great, the ability to change the process (I saw you left a TODO in build.ts for this).
Also, maybe add to the readme how to use polymer-cli programatically? Sounds strange since its a CLI, but it would save us having to duplicate build.ts in our gulpfiles (and use polymer-build directly).
That is unless you make it configurable enough so we maybe don't need gulp at all (directly).
@43081j The CLI will remain a command-line only tool for now. Polymer-build was built specifically for this more complex and configurable use-case.
While there is an initial set up cost to create own build pipeline, it's a much more flexible design that is able to serve almost anyone who needs something more than what the CLI can offer from the command line.
@FredKSchott close in favor to polymer-build?
@abdonrd Not sure if polymer-build is a right place to run linters.
Maybe polymer-linter should provide hooks to use eslint with eslint-plugin-html and stylelint with stylelint-processor-html?
@web-padawan makes senses!
Yea, I agree that this doesn't really belong in polymer-build long-term. But the tools exist in that library today to build your own lint task.
@usergenic was working on linting a little while ago if i recall correctly. This is a good enhancement to keep in mind.
Most helpful comment
We're going to try to add more functionality via hooks, probably exposed initially to Gulp. I'll leave this issue open so we can update it when the appropriate hooks land.