Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser error: angular/file-name #453

Closed
tpeiffer opened this issue Mar 10, 2017 · 1 comment
Closed

Parser error: angular/file-name #453

tpeiffer opened this issue Mar 10, 2017 · 1 comment
Assignees
Milestone

Comments

@tpeiffer
Copy link
Collaborator

Hello,

Given this file - app.module.js
`(function () {

var mod = 'shared.sales';

angular.module(mod + '.core.angular', ['ngCookies', 'ngRoute', 'ngLocale', 'ngResource', 'ngAnimate', 'ngSanitize', 'ngMessages', 'ngIOS9UIWebViewPatch']);

angular.module(mod + '.thirdparty', ['tmh.dynamicLocale', 'gettext', 'ngMaterial', 'md.data.table', 'fixed.table.header', 'as.sortable', 'ngCsv', 'telemetry']);

angular.module(mod, [mod + '.core.angular', mod + '.thirdparty']);

})();`

And these settings in my .eslintrc
'angular/file-name': [Warn, { 'typeSeparator': 'dot', ignorePrefix: 'fs', 'ignoreTypeSuffix': true }],

I get the following error
TypeError: Cannot read property 'length' of undefined at Object.removeTypeSuffix (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint-plugin-angular\rules\file-name.js:66:46) at Object.createExpectedName (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint-plugin-angular\rules\file-name.js:97:41) at EventEmitter.CallExpression (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint-plugin-angular\rules\file-name.js:130:53) at emitOne (events.js:101:20) at EventEmitter.emit (events.js:188:7) at NodeEventGenerator.enterNode (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint\lib\util\node-event-generator.js:39:22) at CodePathAnalyzer.enterNode (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:607:23) at CommentEventGenerator.enterNode (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint\lib\util\comment-event-generator.js:98:23) at Controller.enter (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint\lib\eslint.js:928:36) at Controller.__execute (c:\tfs\FieldSales\Connex\trunk\UI.Shared\node_modules\eslint\node_modules\estraverse\estraverse.js:397:31)

I haven't fully tracked down the piece of code that is parsing the file incorrectly, but I will do that and update this ticket.

Thanks!

@EmmanuelDemey
Copy link
Owner

I have pushed a quick fix. The problem come from your dynamic module name. On best practice is to define on module per file ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants