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

feat: add "banana in a box" rule #322

Merged
merged 4 commits into from Jun 15, 2017
Merged

feat: add "banana in a box" rule #322

merged 4 commits into from Jun 15, 2017

Conversation

wKoza
Copy link
Collaborator

@wKoza wKoza commented Jun 13, 2017

Part of #314

@mgechev
Copy link
Owner

mgechev commented Jun 13, 2017

Haha, I love the error messages. Would be awesome if we're able to introduce this rule as part of the next release as well!

Copy link
Owner

@mgechev mgechev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some initial comments. Great job!


const getReplacements = (text: ast.BoundEventAst, absolutePosition: number) => {
const expr: string = (text.sourceSpan as any).toString();
const internalStart = expr.indexOf('([');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the constants defined above.

import {NgWalker} from './angular/ngWalker';


const BoxInABananaOpen = '([';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets rename it to ValidSyntaxOpen or something similar. I'm getting confused reading BoxInABanana*, wondering if that was the valid or invalid syntax.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Done

templateVisitorCtrl: BananaInBoxTemplateVisitor,
}));
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

let error = null;
const expr: any = (<any>prop.sourceSpan).toString();
if (BoxInABananaRe.test(expr)) {
error = 'The box is in a banana! Expecting Banana in a box [(expr)]';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning message is fun but lets change it to something like: "Invalid binding syntax. Use [(expr)] instead".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem ;) . Done

@wKoza wKoza changed the title [WIP] feat: add "banana in a box" rule feat: add "banana in a box" rule Jun 15, 2017
@mgechev
Copy link
Owner

mgechev commented Jun 15, 2017

Thanks! Will take a look tomorrow & merge/comment.

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

Successfully merging this pull request may close these issues.

None yet

2 participants