quantizor / eslintify

:mag: stream module for checking JavaScript programs with ESLint
MIT License
11 stars 5 forks source link

Options aren't getting passed to eslintify when using watchify #17

Open culshaw opened 7 years ago

culshaw commented 7 years ago

It's worth noting it works fine with Browserify (non watchify).

Trying to pass options to the plugin with v3.1.0 requiring the plugins as so.

var eslintify = require('eslintify');
var babelify = require('babelify');

Transforming the stream like so

        b.transform(eslintify, {formatter: 'json'}); 
        b.transform(eslintify, {passthrough: ['warnings']});
        b.transform(babelify, {presets: ['es2015', 'react'], plugins: ["transform-object-rest-spread"]});

results in no formatter change, nor any options being passed to eslintify.

I added a console.log into the mix to see what is being passed as the "options" parameter and did the same with babelify as a litmus.

eslintify

{ '0': '/js/core.components.js',
  '1': 
   { _flags: 
      { cache: {},
        packageCache: [Object],
        entries: [Object],
        external: [Object],
        insertGlobals: true,
        insertGlobalVars: [Object],
        poll: true,
        dedupe: true } } }

(object at index 1 are passed from watchify/browserify args)

babelify

{ '0': '/js/core.components.js',
  '1': 
   { presets: [ 'es2015', 'react' ],
     plugins: [ 'transform-object-rest-spread' ],
     sourceMaps: 'inline' } }
quantizor commented 7 years ago

Can you make a sample repo or point me at one? I don't actively use browserify anymore, so I'd need one to fix this. On Fri, May 5, 2017 at 7:03 AM culshaw notifications@github.com wrote:

Trying to pass options to the plugin with v3.1.0 requiring the plugins as so.

var eslintify = require('eslintify'); var babelify = require('babelify');

Transforming the stream like so

    b.transform(eslintify, {formatter: 'json'});
    b.transform(eslintify, {passthrough: ['warnings']});
    b.transform(babelify, {presets: ['es2015', 'react'], plugins: ["transform-object-rest-spread"]});

results in no formatter change, nor any options being passed to eslintify.

I added a console.log into the mix to see what is being passed as the "options" parameter and did the same with babelify as a litmus.

eslintify

{ '0': '/js/core.components.js', '1': { _flags: { cache: {}, packageCache: [Object], entries: [Object], external: [Object], insertGlobals: true, insertGlobalVars: [Object], poll: true, dedupe: true } } }

(object at index 1 are passed from watchify/browserify args)

babelify

{ '0': '/js/core.components.js', '1': { presets: [ 'es2015', 'react' ], plugins: [ 'transform-object-rest-spread' ], sourceMaps: 'inline' } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/probablyup/eslintify/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiy1q_FXY3bGVtuKRQ7wYkce2WhOXbbks5r2wICgaJpZM4NRxq6 .