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

Attempting to contribute a fileNameBase rule & failing miserably #13

Closed
randyaa opened this issue Mar 25, 2016 · 3 comments
Closed

Attempting to contribute a fileNameBase rule & failing miserably #13

randyaa opened this issue Mar 25, 2016 · 3 comments

Comments

@randyaa
Copy link

randyaa commented Mar 25, 2016

I've started a fork with some changes around creating a fileNameBase rule with the idea of eventually getting to supporting the styleguide's concept of kebab-case (configurable of course) with .component.ts suffix's.

I've never written any sort of linting rule before so this is all new to me, so I appologize if I seem like a newb but i'm running into some trouble. First off I recognize that my rule right now will just always fail, that's just my first step...

After transpiling the rule and getting it to run i hit the following error:

TypeError: Cannot read property 'call' of undefined
at FileNameValidatorWalker.visitClassDeclaration (C:\extras\projectx\authoring-ui\node_modules\ng2lint\dist\src\fileNameBase.js:44:37)
at FileNameValidatorWalker.SyntaxWalker.visitNode (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:255:22)
at C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:441:63
at visitEachNode (C:\extras\projectx\authoring-ui\node_modules\typescript\lib\typescript.js:7209:30)
at Object.forEachChild (C:\extras\projectx\authoring-ui\node_modules\typescript\lib\typescript.js:7360:24)
at FileNameValidatorWalker.SyntaxWalker.walkChildren (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:441:12)
at FileNameValidatorWalker.SyntaxWalker.visitSourceFile (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:181:14)
at FileNameValidatorWalker.SyntaxWalker.visitNode (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:396:22)
at FileNameValidatorWalker.SyntaxWalker.walk (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\walker\syntaxWalker.js:7:14)
at Rule.AbstractRule.applyWithWalker (C:\extras\projectx\authoring-ui\node_modules\tslint\lib\language\rule\abstractRule.js:19:16)

which is just:

_super.visitClassDeclaration.call(this, node);

which is exactly the same as what is in (transpiled version of) the selectorNameBase.ts file that I based this on.

Thoughts?

@mgechev
Copy link
Owner

mgechev commented Mar 25, 2016

If you are referencing _super with _ prefix, you should remove it.

Should be: super.visitClassDeclaration.call.... Another possible mistake could be if you haven't extended the base class, i.e. class FileNameValidatorWalker extends Lint.RuleWalker

@randyaa
Copy link
Author

randyaa commented Mar 25, 2016

Thanks, i'm not doing anything with _super that's just the transpiled version of my TS lint rule. Also, I'm definitely extending Lint.RuleWalker.

@mgechev
Copy link
Owner

mgechev commented Mar 27, 2016

I'll take a look today.

@mgechev mgechev closed this as completed Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants