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

fix: regressions in 4.4.0 #671

Merged
merged 3 commits into from Jun 24, 2018
Merged

fix: regressions in 4.4.0 #671

merged 3 commits into from Jun 24, 2018

Conversation

mgechev
Copy link
Owner

@mgechev mgechev commented Jun 23, 2018

  • Downgrade to TypeScript 2.7 which is the officially supported on by @angular/core
  • Export preferInlineDecoratorRule

We should introduce a public API guard to make sure we don't hit
regressions like the second one.

Fix #669 #670

- Downgrade to TypeScript 2.7 which is the officially supported on by `@angular/core`
- Export `preferInlineDecoratorRule`

We should introduce a public API guard to make sure we don't hit
regressions like the second one.

Fix #669 #670
@mgechev mgechev requested review from wKoza and rafaelss95 June 23, 2018 12:11
Copy link
Collaborator

@wKoza wKoza left a comment

Choose a reason for hiding this comment

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

Just one question. Otherwise, LGTM

package.json Outdated
@@ -86,7 +86,7 @@
"rxjs-compat": "^6.1.0",
"ts-node": "^6.0.2",
"tslint": "^5.10.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would not it be interesting to downgrade tslint to "~5.9.1" like angular CLI ?

@@ -148,7 +148,7 @@ export class SelectorValidatorWalker extends Lint.RuleWalker {
}

private validateProperty(p: ts.PropertyAssignment): boolean {
return ts.isStringLiteralLike(p.initializer) && ts.isIdentifier(p.name) && p.name.text === 'selector';
return p.initializer.kind === ts.SyntaxKind.StringLiteral && ts.isIdentifier(p.name) && p.name.text === 'selector';
Copy link
Collaborator

Choose a reason for hiding this comment

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

ts.isStringLiteral(p.initializer)?

export const isSimpleTemplateString = (e: any): e is ts.SyntaxKind.FirstTemplateToken | ts.StringLiteralLike => {
return ts.isStringLiteralLike(e) || e.kind === ts.SyntaxKind.FirstTemplateToken;
export const isSimpleTemplateString = (e: any): e is ts.SyntaxKind.FirstTemplateToken | ts.StringLiteral => {
return e.kind === ts.SyntaxKind.StringLiteral || e.kind === ts.SyntaxKind.FirstTemplateToken;
Copy link
Collaborator

Choose a reason for hiding this comment

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

ts.isStringLiteral(e)?

@@ -102,3 +103,7 @@ export class PreferInlineDecoratorWalker extends NgWalker {
this.addFailureAt(decoratorStartPos, property.getWidth(), getFailureMessage(), fix);
}
}

function isSameLine(sourceFile: ts.SourceFile, pos1: number, pos2: number) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to not use tsutils?

Copy link
Collaborator

Choose a reason for hiding this comment

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

tsutils isn't a dependencies/peerDependencies of Codelyzer

Copy link
Collaborator

Choose a reason for hiding this comment

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

You're right, however it's a tslint dependency. Anyway, can't we add it to codelyzer dependencies?

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO, sometimes, it's safer to duplicate some code lines than to be linked to a third-party library.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case, it would be better to move this function to util.

src/index.ts Outdated
@@ -25,6 +25,7 @@ export { Rule as NoUnusedCssRule } from './noUnusedCssRule';
export { Rule as PipeImpureRule } from './pipeImpureRule';
export { Rule as PipeNamingRule } from './pipeNamingRule';
export { Rule as PreferOutputReadonlyRule } from './preferOutputReadonlyRule';
export { Rule as PreferInlineDecorator } from './preferInlineDecoratorRule';
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I guess these exports are alphabetically ordered, so it would come before preferOutputReadonly.

@rafaelss95
Copy link
Collaborator

LGTM.

@mgechev mgechev merged commit d922dcb into master Jun 24, 2018
@mgechev mgechev deleted the minko/fix-release branch June 24, 2018 00:19
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

3 participants