selaux/eslint-plugin-filenames

Pass when given code from stdin

Closed this issue · 2 comments

I'm using this plugin with eslint - occasionally I need to use eslint in stdin mode (for example, the sublime plugin does this) - but this plugin fails because stdin sets the filename to <text>.

cat index.js | eslint --stdin

<text>
  1:0  error  Filename '<text>' does not match the naming convention  filenames/filenames

✖ 1 problem (1 error, 0 warnings)

The workaround for now is to amend the regexp to include <text> as a literal, e.g.

/^(<text>$|([a-z0-9]+)([A-Z][a-z0-9]+)*$)/

Ultimately it would be great if this plugin could properly detect that the input is coming from stdin and pass.

Can you test wether current master works for you? I will publish a new version on npm after.

Works great for me 😄