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

rename rules in documentation #326

Merged
merged 1 commit into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions docs/_data/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"typescriptOnly": true
},
{
"ruleName": "import-destructing-spacing-rule",
"ruleName": "import-destructing-spacing",
"type": "style",
"description": "Ensure consistent and tidy imports.",
"rationale": "Imports are easier for the reader to look at when they're tidy.",
Expand All @@ -157,7 +157,7 @@
"typescriptOnly": true
},
{
"ruleName": "no-attribute-parameter-decorator-rule",
"ruleName": "no-attribute-parameter-decorator",
"type": "maintainability",
"description": "Disallow usage of @Attribute decorator",
"rationale": "@Attribute is considered bad practice. Use @Input instead.",
Expand All @@ -175,7 +175,7 @@
"typescriptOnly": true
},
{
"ruleName": "no-input-rename-rule",
"ruleName": "no-input-rename",
"type": "maintainability",
"description": "Disallows renaming directive inputs by providing a string to the decorator.",
"descriptionDetails": "See more at https://angular.io/styleguide#!#05-13.",
Expand All @@ -185,7 +185,7 @@
"typescriptOnly": true
},
{
"ruleName": "no-output-rename-rule",
"ruleName": "no-output-rename",
"type": "maintainability",
"description": "Disallows renaming directive outputs by providing a string to the decorator.",
"descriptionDetails": "See more at https://angular.io/styleguide#!#05-13.",
Expand All @@ -212,7 +212,7 @@
"typescriptOnly": true
},
{
"ruleName": "pipe-naming-rule",
"ruleName": "pipe-naming",
"type": "style",
"description": "Enforce consistent case and prefix for pipes.",
"rationale": "Consistent conventions make it easy to quickly identify and reference assets of different types.",
Expand Down Expand Up @@ -240,7 +240,16 @@
"typescriptOnly": true
},
{
"ruleName": "templates-use-public-rule",
"ruleName": "templates-no-negated-async",
"type": "functionality",
"description": "Ensures that strict equality is used when evaluating negations on async pipe outout.",
"rationale": "Async pipe evaluate to `null` before the observable or promise emits, which can lead to layout thrashing as components load. Prefer strict `=== false` checks instead.",
"options": null,
"optionsDescription": "Not configurable.",
"typescriptOnly": true
},
{
"ruleName": "templates-use-public",
"type": "functionality",
"description": "Ensure that properties and methods accessed from the template are public.",
"rationale": "When Angular compiles the templates, it has to access these properties from outside the class.",
Expand All @@ -249,16 +258,16 @@
"typescriptOnly": true
},
{
"ruleName": "templates-use-public-rule",
"ruleName": "template-to-ng-template",
"type": "functionality",
"description": "Ensure that properties and methods accessed from the template are public.",
"rationale": "When Angular compiles the templates, it has to access these propertes from outside the class.",
"description": "Ensure that <ng-template> is used instance of <template>.",
"rationale": "Since Angular 4.0, <template> is deprecated.",
"options": null,
"optionsDescription": "Not configurable.",
"typescriptOnly": true
},
{
"ruleName": "use-host-property-decorator-rule",
"ruleName": "use-host-property-decorator",
"type": "style",
"description": "Use @HostProperty decorator rather than the `host` property of `@Component` and `@Directive` metadata.",
"descriptionDetails": "See more at https://angular.io/styleguide#!#06-03.",
Expand All @@ -268,7 +277,7 @@
"typescriptOnly": true
},
{
"ruleName": "use-input-property-decorator-rule",
"ruleName": "use-input-property-decorator",
"type": "style",
"description": "Use `@Input` decorator rather than the `inputs` property of `@Component` and `@Directive` metadata.",
"descriptionDetails": "See more at https://angular.io/styleguide#!#05-12.",
Expand All @@ -288,7 +297,7 @@
"typescriptOnly": true
},
{
"ruleName": "use-output-property-decorator-rule",
"ruleName": "use-output-property-decorator",
"type": "style",
"description": "Use `@Output` decorator rather than the `outputs` property of `@Component` and `@Directive` metadata.",
"descriptionDetails": "See more at https://angular.io/styleguide#!#05-12.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ var RecursiveAngularExpressionVisitor = (function (_super) {
ast.visit(this);
return null;
};
RecursiveAngularExpressionVisitor.prototype.visitNonNullAssert = function (ast, context) {
ast.visit(this);
return null;
};
RecursiveAngularExpressionVisitor.prototype.visitBinary = function (ast, context) {
ast.left.visit(this);
ast.right.visit(this);
Expand Down
86 changes: 58 additions & 28 deletions docs/dist/src/angular/templates/templateParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ exports.parseTemplate = function (template, directives) {
tmplParser =
new TemplateParser(config, expressionParser, elementSchemaRegistry, htmlParser, ngConsole, []);
})
.else(function () {
.elseIf.lt('4.1.0', function () {
tmplParser =
new TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, ngConsole, []);
}).else(function () {
var config = new compiler.CompilerConfig({});
tmplParser =
new TemplateParser(config, new compiler.JitReflector(), expressionParser, elementSchemaRegistry, htmlParser, ngConsole, []);
});
var interpolation = config_1.Config.interpolation;
var summaryKind = (compiler.CompileSummaryKind || {}).Template;
Expand Down Expand Up @@ -100,32 +104,58 @@ exports.parseTemplate = function (template, directives) {
identifier: null
};
var result = null;
ngVersion_1.SemVerDSL.lt('4.1.0', function () {
result = tmplParser.tryParse(compiler.CompileDirectiveMetadata.create({
type: type,
template: templateMetadata
}), template, defaultDirectives, [], [core_1.NO_ERRORS_SCHEMA], '').templateAst;
}).else(function () {
result = tmplParser.tryParse(compiler.CompileDirectiveMetadata.create({
type: type,
template: templateMetadata,
isHost: true,
isComponent: true,
selector: '',
exportAs: '',
changeDetection: core_1.ChangeDetectionStrategy.Default,
inputs: [],
outputs: [],
host: {},
providers: [],
viewProviders: [],
queries: [],
viewQueries: [],
entryComponents: [],
componentViewType: null,
rendererType: null,
componentFactory: null
}), template, defaultDirectives, [], [core_1.NO_ERRORS_SCHEMA], '').templateAst;
});
try {
ngVersion_1.SemVerDSL.lt('4.1.0', function () {
result = tmplParser.tryParse(compiler.CompileDirectiveMetadata.create({
type: type,
template: templateMetadata
}), template, defaultDirectives, [], [core_1.NO_ERRORS_SCHEMA], '').templateAst;
}).elseIf.lt('4.1.3', function () {
result = tmplParser.tryParse(compiler.CompileDirectiveMetadata.create({
type: type,
template: templateMetadata,
isHost: true,
isComponent: true,
selector: '',
exportAs: '',
changeDetection: core_1.ChangeDetectionStrategy.Default,
inputs: [],
outputs: [],
host: {},
providers: [],
viewProviders: [],
queries: [],
viewQueries: [],
entryComponents: [],
componentViewType: null,
rendererType: null,
componentFactory: null
}), template, defaultDirectives, [], [core_1.NO_ERRORS_SCHEMA], '').templateAst;
}).else(function () {
result = tmplParser.tryParse(compiler.CompileDirectiveMetadata.create({
type: type,
template: templateMetadata,
isHost: true,
isComponent: true,
selector: '',
exportAs: '',
changeDetection: core_1.ChangeDetectionStrategy.Default,
inputs: [],
outputs: [],
host: {},
providers: [],
viewProviders: [],
queries: [],
viewQueries: [],
entryComponents: [],
componentViewType: null,
rendererType: null,
componentFactory: null
}), template, defaultDirectives, [], [core_1.NO_ERRORS_SCHEMA], '').templateAst;
});
}
catch (e) {
console.log(e);
}
return result;
};
2 changes: 1 addition & 1 deletion docs/dist/src/importDestructuringSpacingRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'import-destructing-spacing-rule',
ruleName: 'import-destructing-spacing',
type: 'style',
description: "Ensure consistent and tidy imports.",
rationale: "Imports are easier for the reader to look at when they're tidy.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/noAttributeParameterDecoratorRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'no-attribute-parameter-decorator-rule',
ruleName: 'no-attribute-parameter-decorator',
type: 'maintainability',
description: "Disallow usage of @Attribute decorator",
rationale: "@Attribute is considered bad practice. Use @Input instead.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/noInputRenameRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'no-input-rename-rule',
ruleName: 'no-input-rename',
type: 'maintainability',
description: "Disallows renaming directive inputs by providing a string to the decorator.",
descriptionDetails: "See more at https://angular.io/styleguide#!#05-13.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/noOutputRenameRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'no-output-rename-rule',
ruleName: 'no-output-rename',
type: 'maintainability',
description: "Disallows renaming directive outputs by providing a string to the decorator.",
descriptionDetails: "See more at https://angular.io/styleguide#!#05-13.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/pipeNamingRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'pipe-naming-rule',
ruleName: 'pipe-naming',
type: 'style',
description: "Enforce consistent case and prefix for pipes.",
rationale: "Consistent conventions make it easy to quickly identify and reference assets of different types.",
Expand Down
6 changes: 3 additions & 3 deletions docs/dist/src/templateToNgTemplateRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'templates-use-public-rule',
ruleName: 'template-to-ng-template',
type: 'functionality',
description: "Ensure that properties and methods accessed from the template are public.",
rationale: "When Angular compiles the templates, it has to access these propertes from outside the class.",
description: "Ensure that <ng-template> is used instance of <template>.",
rationale: "Since Angular 4.0, <template> is deprecated.",
options: null,
optionsDescription: "Not configurable.",
typescriptOnly: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/templatesUsePublicRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
Rule.metadata = {
ruleName: 'templates-use-public-rule',
ruleName: 'templates-use-public',
type: 'functionality',
description: "Ensure that properties and methods accessed from the template are public.",
rationale: "When Angular compiles the templates, it has to access these properties from outside the class.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/useHostPropertyDecoratorRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Rule = (function (_super) {
return Rule;
}(propertyDecoratorBase_1.UsePropertyDecorator));
Rule.metadata = {
ruleName: 'use-host-property-decorator-rule',
ruleName: 'use-host-property-decorator',
type: 'style',
description: "Use @HostProperty decorator rather than the `host` property of `@Component` and `@Directive` metadata.",
descriptionDetails: "See more at https://angular.io/styleguide#!#06-03.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/useInputPropertyDecoratorRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Rule = (function (_super) {
return Rule;
}(propertyDecoratorBase_1.UsePropertyDecorator));
Rule.metadata = {
ruleName: 'use-input-property-decorator-rule',
ruleName: 'use-input-property-decorator',
type: 'style',
description: "Use `@Input` decorator rather than the `inputs` property of `@Component` and `@Directive` metadata.",
descriptionDetails: "See more at https://angular.io/styleguide#!#05-12.",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/src/useOutputPropertyDecoratorRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Rule = (function (_super) {
return Rule;
}(propertyDecoratorBase_1.UsePropertyDecorator));
Rule.metadata = {
ruleName: 'use-output-property-decorator-rule',
ruleName: 'use-output-property-decorator',
type: 'style',
description: "Use `@Output` decorator rather than the `outputs` property of `@Component` and `@Directive` metadata.",
descriptionDetails: "See more at https://angular.io/styleguide#!#05-12.",
Expand Down
5 changes: 2 additions & 3 deletions docs/rules/component-selector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
- '["element", "my-prefix", "kebab-case"]'
- '["element", ["ng", "ngx"], "kebab-case"]'
- '["attribute", "myPrefix", "camelCase"]'
- '[["element", "attribute"], "sg", "kebab-case"]]'
optionsDescription: |

Options accept three obligatory items as an array:

1. `"element"` or `"attribute"` forces components either to be elements or attributes (or allows both - since 3.0.0, an array is also accepted).
1. `"element"` or `"attribute"` forces components either to be elements or attributes.
2. A single prefix (string) or array of prefixes (strings) which have to be used in component selectors.
3. `"kebab-case"` or `"camelCase"` allows you to pick a case.
typescriptOnly: true
Expand Down Expand Up @@ -76,4 +75,4 @@
"minItems": 3,
"maxItems": 3
}
---
---
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
ruleName: import-destructing-spacing-rule
ruleName: import-destructing-spacing
type: style
description: Ensure consistent and tidy imports.
rationale: Imports are easier for the reader to look at when they're tidy.
options: null
optionsDescription: Not configurable.
typescriptOnly: true
layout: rule
title: 'Rule: import-destructing-spacing-rule'
title: 'Rule: import-destructing-spacing'
optionsJSON: 'null'
---
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
ruleName: no-attribute-parameter-decorator-rule
ruleName: no-attribute-parameter-decorator
type: maintainability
description: Disallow usage of @Attribute decorator
rationale: '@Attribute is considered bad practice. Use @Input instead.'
options: null
optionsDescription: Not configurable.
typescriptOnly: true
layout: rule
title: 'Rule: no-attribute-parameter-decorator-rule'
title: 'Rule: no-attribute-parameter-decorator'
optionsJSON: 'null'
---
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
ruleName: no-input-rename-rule
ruleName: no-input-rename
type: maintainability
description: Disallows renaming directive inputs by providing a string to the decorator.
descriptionDetails: 'See more at https://angular.io/styleguide#!#05-13.'
Expand All @@ -8,6 +8,6 @@
optionsDescription: Not configurable.
typescriptOnly: true
layout: rule
title: 'Rule: no-input-rename-rule'
title: 'Rule: no-input-rename'
optionsJSON: 'null'
---
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
ruleName: no-output-rename-rule
ruleName: no-output-rename
type: maintainability
description: Disallows renaming directive outputs by providing a string to the decorator.
descriptionDetails: 'See more at https://angular.io/styleguide#!#05-13.'
Expand All @@ -8,6 +8,6 @@
optionsDescription: Not configurable.
typescriptOnly: true
layout: rule
title: 'Rule: no-output-rename-rule'
title: 'Rule: no-output-rename'
optionsJSON: 'null'
---
Loading