Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Deprecated no-reserved-keywords #674

Merged
merged 4 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ We recommend you specify exact versions of lint libraries, including `tslint-mic
<code>no-reserved-keywords</code>
</td>
<td>
Deprecated - This rule can be replaced with TSLint's variable-name.
Do not use reserved keywords as names of local variables, fields, functions, or other identifiers.
Since version 2.0.9 this rule accepts a parameter called <code>allow-quoted-properties</code>.
If true, interface properties in quotes will be ignored.
Expand Down
1 change: 1 addition & 0 deletions build-tasks/validate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const disabledRules = new Set([
'no-empty-interfaces',
'no-empty-line-after-opening-brace',
'no-multiline-string',
'no-reserved-keywords',
'no-relative-imports',
'no-stateless-class',
'no-unexternalized-strings',
Expand Down
2 changes: 1 addition & 1 deletion recommended_ruleset.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = {
'no-http-string': [true, 'http://www.example.com/?.*', 'http://localhost:?.*'],
'no-inner-html': true,
'no-octal-literal': true,
'no-reserved-keywords': true,
'no-string-based-set-immediate': true,
'no-string-based-set-interval': true,
'no-string-based-set-timeout': true,
Expand Down Expand Up @@ -264,6 +263,7 @@ module.exports = {
'no-empty-interfaces': false, // use tslint no-empty-interface rule instead
'no-missing-visibility-modifiers': false, // use tslint member-access rule instead
'no-multiple-var-decl': false, // use tslint one-variable-per-declaration rule instead
'no-reserved-keywords': false,
'no-stateless-class': false,
'no-switch-case-fall-through': false, // now supported by TypeScript compiler
'no-unnecessary-class': true,
Expand Down
10 changes: 9 additions & 1 deletion src/noReservedKeywordsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export class Rule extends Lint.Rules.AbstractRule {
typescriptOnly: true,
issueClass: 'SDL',
issueType: 'Error',
recommendation: 'false,',
severity: 'Critical',
level: 'Mandatory',
group: 'Security',
group: 'Deprecated',
commonWeaknessEnumeration: '398'
};

Expand Down Expand Up @@ -89,7 +90,14 @@ export class Rule extends Lint.Rules.AbstractRule {
'of'
];

private static isWarningShown: boolean = false;

public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
if (Rule.isWarningShown === false) {
console.warn('Warning: no-reserved-keywords rule is deprecated. Replace your usage with the TSLint variable-name rule.');
Rule.isWarningShown = true;
}

const walker: Lint.RuleWalker = new BannedTermWalker(sourceFile, this.getOptions(), Rule.FAILURE_STRING, Rule.BANNED_TERMS);
return this.applyWithWalker(walker);
}
Expand Down
4 changes: 2 additions & 2 deletions tslint-warnings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ react-a11y-no-onchange,"For accessibility of your website, enforce usage of onBl
react-a11y-props,Enforce all `aria-*` attributes are valid. Elements cannot use an invalid `aria-*` attribute.,TSLINT1682S78,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-proptypes,Enforce ARIA state and property values are valid.,TSLINT1DLB1JE,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-required,Enforce that required input elements must have aria-required set to true,TSLINTNF1C97,tslint,Non-SDL,Warning,Low,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-role,"Elements with aria roles must use a **valid**, **non-abstract** aria role.",TSLINTQ0A2FU,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-role,"Elements with aria roles must use a **valid**, **non-abstract** aria role. A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria/roles#role_definitions).",TSLINTQ0A2FU,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-role-has-required-aria-props,Elements with aria roles must have all required attributes according to the role.,TSLINT1R1B60O,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-role-supports-aria-props,Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.,TSLINT1IFADTQ,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-role-supports-aria-props,"Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.Many aria attributes (states and properties) can only be used on elements with particular roles.Some elements have implicit roles, such as `<a href='hrefValue' />`, which will be resolved to `role='link'`.A reference for the implicit roles can be found at [Default Implicit ARIA Semantics](https://www.w3.org/TR/html-aria/#sec-strong-native-semantics).",TSLINT1IFADTQ,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
react-a11y-tabindex-no-positive,Enforce tabindex value is **not greater than zero**.,TSLINTEO7FKT,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-a11y-titles,"For accessibility of your website, HTML title elements must be concise and non-empty.",TSLINT1506S53,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
react-anchor-blank-noopener,Anchor tags with target="_blank" should also include rel="noreferrer",TSLINT1GKPCB4,tslint,SDL,Error,Critical,Mandatory,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"242,676","CWE 242 - Use of Inherently Dangerous Function
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"no-parameter-reassignment": false,
"no-redundant-jsdoc": true,
"no-regex-spaces": true,
"no-reserved-keywords": true,
"no-return-await": true,
"no-single-line-block-comment": true,
"no-string-based-set-immediate": true,
Expand Down Expand Up @@ -163,6 +162,7 @@
"no-empty-line-after-opening-brace": false,
"no-multiline-string": false,
"no-relative-imports": false,
"no-reserved-keywords": false,
"no-stateless-class": false,
"no-unexternalized-strings": false,
"no-var-self": false,
Expand Down