Last active
February 15, 2016 13:13
-
-
Save esnya/44cd29fbd67a315b12f9 to your computer and use it in GitHub Desktop.
Browserify error after lint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log('hoge'); | |
| syntax error; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [21:12:15] Using gulpfile D:\Users\ukatama\Documents\test\gulpfile.js | |
| [21:12:15] Starting 'lint:standard'... | |
| [21:12:15] Finished 'lint:standard' after 70 ms | |
| [21:12:15] Starting 'build'... | |
| [21:12:16] | |
| browser.js | |
| 2:7 error Parsing error: Unexpected token | |
| 1 problem (1 error, 0 warnings) | |
| gulp : D:\Users\ukatama\Documents\test\node_modules\syntax-error\index.js:36 | |
| this.line = err.loc.line; | |
| ^ | |
| TypeError: Cannot read property 'line' of undefined | |
| at SyntaxError.ParseError (D:\Users\ukatama\Documents\test\node_modules\syntax-error\index.js:36:24) | |
| at errorInfo (D:\Users\ukatama\Documents\test\node_modules\syntax-error\index.js:26:16) | |
| at module.exports (D:\Users\ukatama\Documents\test\node_modules\syntax-error\index.js:19:16) | |
| at DestroyableTransform._transform (D:\Users\ukatama\Documents\test\node_modules\browserify\index.js:638:23) | |
| at DestroyableTransform.Transform._read (D:\Users\ukatama\Documents\test\node_modules\readable-stream\lib\_stream_t | |
| ransform.js:172:10) | |
| at DestroyableTransform.Transform._write (D:\Users\ukatama\Documents\test\node_modules\readable-stream\lib\_stream_ | |
| transform.js:160:12) | |
| at Labeled.Pipeline._write (D:\Users\ukatama\Documents\test\node_modules\stream-splicer\index.js:70:22) | |
| at doWrite (D:\Users\ukatama\Documents\test\node_modules\readable-stream\lib\_stream_writable.js:335:12) | |
| at writeOrBuffer (D:\Users\ukatama\Documents\test\node_modules\readable-stream\lib\_stream_writable.js:321:5) | |
| at Labeled.Writable.write (D:\Users\ukatama\Documents\test\node_modules\readable-stream\lib\_stream_writable.js:248 | |
| :11) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [21:12:06] Using gulpfile D:\Users\ukatama\Documents\test\gulpfile.js | |
| [21:12:06] Starting 'lint:standard-fix'... | |
| [21:12:06] Finished 'lint:standard-fix' after 242 ms | |
| [21:12:06] Starting 'build'... | |
| [21:12:07] | |
| browser.js | |
| 2:7 error Parsing error: Unexpected token | |
| 1 problem (1 error, 0 warnings) | |
| events.js:154 | |
| throw er; // Unhandled 'error' event | |
| ^ | |
| SyntaxError: Unexpected token | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| /* | |
| * Expected Error: | |
| * $ gulp lint:empty build | |
| * $ gulp lint:recommended-fix build | |
| * $ gulp lint:standard-fix build | |
| * | |
| * Unexpected Error (Bug?): | |
| * $ gulp lint:empty-espree build | |
| * $ gulp lint:recommended build | |
| * $ gulp lint:standard build | |
| */ | |
| /* | |
| test@1.0.0 D:\Users\ukatama\Documents\test | |
| ├── acorn@2.7.0 | |
| ├── browserify@13.0.0 | |
| ├── eslint-config-standard@5.1.0 | |
| ├── eslint-plugin-promise@1.0.8 | |
| ├── eslint-plugin-standard@1.3.2 | |
| ├── gulp@3.9.1 | |
| ├─┬ gulp-eslint@2.0.0 | |
| │ └── eslint@2.0.0 | |
| ├── vinyl-buffer@1.0.0 | |
| └── vinyl-source-stream@1.1.0 | |
| */ | |
| const browserify = require('browserify'); | |
| const gulp = require('gulp'); | |
| const eslint = require('gulp-eslint'); | |
| const buffer = require('vinyl-buffer'); | |
| const source = require('vinyl-source-stream'); | |
| gulp.task('build', () => { | |
| return browserify('browser.js') | |
| .bundle() | |
| .pipe(source('bundle.js')) | |
| .pipe(buffer()) | |
| .pipe(gulp.dest('.')); | |
| }); | |
| function linter(config) { | |
| return function() { | |
| gulp.src('browser.js') | |
| .pipe(eslint(config)) | |
| .pipe(eslint.format()); | |
| //.pipe(eslint.failAfterError()); | |
| }; | |
| } | |
| gulp.task('lint:empty-espree', linter({ | |
| parser: 'espree', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| } | |
| })); | |
| gulp.task('lint:empty', linter({ | |
| parser: 'babel-eslint', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| } | |
| })); | |
| gulp.task('lint:recommended', linter({ | |
| extends: 'eslint:recommended', | |
| parser: 'babel-eslint', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| } | |
| })); | |
| gulp.task('lint:standard', linter({ | |
| extends: 'standard', | |
| parser: 'babel-eslint', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| } | |
| })); | |
| const recommended = require('eslint/conf/eslint.json'); | |
| gulp.task('lint:recommended-fix', linter(Object.assign({}, recommended, { | |
| parser: 'babel-eslint', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| }, | |
| rules: Object | |
| .keys(recommended.rules) | |
| .filter((key) => { | |
| switch (key) { | |
| case 'no-invalid-regexp': | |
| case 'no-restricted-syntax': | |
| case 'quote-props': | |
| return false; | |
| default: | |
| return true; | |
| } | |
| }) | |
| .reduce((rules, key) => { | |
| rules[key] = recommended.rules[key]; | |
| return rules; | |
| }, {}) | |
| }))); | |
| const standard = require('eslint-config-standard'); | |
| gulp.task('lint:standard-fix', linter(Object.assign({}, standard, { | |
| parser: 'babel-eslint', | |
| parserOptions: { | |
| ecmaVersion: 6 | |
| }, | |
| env: { | |
| node: true | |
| }, | |
| rules: Object | |
| .keys(standard.rules) | |
| .filter((key) => key !== 'no-invalid-regexp') | |
| .reduce((rules, key) => { | |
| rules[key] = standard.rules[key]; | |
| return rules; | |
| }, {}) | |
| }))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "test", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "MIT", | |
| "devDependencies": { | |
| "acorn": "^2.7.0", | |
| "browserify": "^13.0.0", | |
| "eslint-config-standard": "^5.1.0", | |
| "eslint-plugin-promise": "^1.0.8", | |
| "eslint-plugin-standard": "^1.3.2", | |
| "gulp": "^3.9.1", | |
| "gulp-eslint": "^2.0.0", | |
| "vinyl-buffer": "^1.0.0", | |
| "vinyl-source-stream": "^1.1.0" | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce the bug, it is important to install the acorn.