selaux / eslint-plugin-filenames

Eslint plugin to check filenames.
318 stars 35 forks source link

Split rules into individual ones. #8

Closed selaux closed 8 years ago

mlucool commented 8 years ago

Hi,

Can we add in how to turn on the new rule in the README? i.e. "filenames/match-exported": [2]

Also it has an unintended effect by splitting it. Rules (basically start with a lowercase letter):

    "filenames/match-regex": [2, "^([a-z][-a-zA-Z_0-9]+)|([a-zA-Z][-a-zA-Z_0-9]+_spec)$"],
    "filenames/match-exported": [2]

The split into two rules has a bad effect: Bar.js

export default function Bar() {
    return 'hello';
}
tasks/Bar.js
  1:1  error  Filename 'Bar.js' does not match the naming convention  filenames/match-regex

Since the rules are independent the first rule fails while the second works. Ideally I'd like to have the match-exported rule override the match-regex rule as I think it was originally.

The index.js rule does work now!

selaux commented 8 years ago

The readme is updated in this branch. What we could do to somehow reintroduce the full functionality is to add a flag to the match-regex rule, called ignore-exporting that allows you to toggle whether you want this rule to apply to exporting files.

mlucool commented 8 years ago

I see the README is updated, but I was suggesting to have code to copy/paste to enable the rule.

I like that idea to ignore exporting!

selaux commented 8 years ago

Please have another try.

mlucool commented 8 years ago

Small bug it looks like: + ignoreExporting = context.options[0] ? context.options[0] : false; This should is the same arg as the RegExp so its always enabled. In the enable case it does work as expected

selaux commented 8 years ago

Whoops, shit happens ... sometimes. Should be fixed now.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4c250512e4ac5c72104dee2a7c4357c2ab10acab on split-rules into c6d3a73eae2a2e006a733846e7b9ea468633e67a on master.

mlucool commented 8 years ago

Looks good now! Looking forward to the release

gajus commented 8 years ago

@selaux Can this be merged?

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 5ab1f4477643ea8bbecd07b1f003993a975de80d on split-rules into c6d3a73eae2a2e006a733846e7b9ea468633e67a on master.