EmmanuelDemey/eslint-plugin-angular

angular/file-name rule: there is a way to ignore all prefixes except the last one on module filename?

wdarking opened this issue · 2 comments

I have modules with submodules, so the linter tells me to use a very long module file name, even with the ignorePrefix option.

my config:

"angular/file-name": [2,
      {
        "typeSeparator": "dot",
        "nameStyle": "dash",
        "ignoreTypeSuffix": true,
        "ignorePrefix": "users.",
        "componentTypeMappings": {
          "factory": "factory",
          "provider": "provider"
        }
      }
    ]

example:

module named users
submodule named users.admin
submodule named users.admin.create
submodule named users.admin.create.info

with the linter rules, i should name the modules like this:
users.module.js,
admin.module.js,
admin.create.module.js,
admin.create.info.module.js

so, there is a way to ignore all prefixes except the last one ? i've tried to use a match all regex on the ignorePrefix option but almost all returned some kind of error and couldn't run the linter
https://stackoverflow.com/questions/6711971/regular-expressions-match-anything

expected valid module filenames:

users.module.js, -> users.module.js
admin.module.js, -> admin.module.js
admin.create.module.js, -> create.module.js
admin.create.info.module.js, -> info.module.js

I also have this problem.

Maybe we should be looking into adding an additional setting for the file-name rule which makes the rule ignore the module name prefix completely (As you want it).
Or maybe make it possible to actually use regexp in the ignorePrefix.

What would you prefer?

I prefer the additional setting idea, sounds simpler. But if there are good reasons to use regex, i think it wouldn't be a problem.