-
Notifications
You must be signed in to change notification settings - Fork 26
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
Lint warnings/errors on generated constant module #24
Comments
Just saw the PR that handles strict mode. How about single-quote though? |
This is a workaround I use gulp.task('config', function () {
gulp.src('app/config.json')
.pipe(ngConstant({
// ngConstant options
}))
// add 'use strict;', and change double quotes to single quotes
// or you can add jshint ignore instead
.pipe( through2.obj((chunk, enc, callback) => {
var str = chunk.contents.toString();
str = str.replace(/"/g, '\'')
.replace('angular.module', `'use strict';\r\nangular.module`);
// replace contents
chunk.contents = new Buffer(str);
// done
callback(null, chunk);
}) )
// optional: use jsbeautifier to prettify js
.pipe( plugins.jsbeautifier({
indentSize: 2,
preserveNewlines: false
}) )
.pipe(gulp.dest('dist'));
}); |
A bit shorter code:
You will also need Also, don't forget to run |
@loren138 : Ah yes...using gulp-replace is better idea! |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While dependency injecting a generated constant module, I get the following lint errors/warnings
line 2 col 3 Missing "use strict" statement. line 2 col 37 Strings must use singlequote.
I'm aware that I can create own template files to avoid these lint entries but I think it would be a good idea if this could work directly.
The text was updated successfully, but these errors were encountered: