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

Commit

Permalink
Fixed whitespace issues in tslint-warnings.csv (#709)
Browse files Browse the repository at this point in the history
* Rules directory was wrong.

* Only the first new line was being replaced with a space. Now they all are.

* Added trailing spaces after full stops in the description.

* Used string concatenation in the description to get rid of excess whitespace.

* Regenerated the SDL report.

* Reverted rules directory change.
  • Loading branch information
reduckted authored and Josh Goldberg committed Dec 30, 2018
1 parent 74a82e1 commit 39e3950
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build-tasks/common/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function getMetadataValue(metadata, name, allowEmpty, doNotEscape) {
return value;
}
value = value.replace(/^\n+/, ''); // strip leading newlines
value = value.replace(/\n/, ' '); // convert newlines
value = value.replace(/\n/g, ' '); // convert newlines
if (value.indexOf(',') > -1) {
return '"' + value + '"';
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/reactA11yRoleRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ export class Rule extends Lint.Rules.AbstractRule {
public static metadata: ExtendedMetadata = {
ruleName: 'react-a11y-role',
type: 'maintainability',
description: `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).`,
description:
'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).',
rationale: `References:
<ul>
<li><a href="http://oaa-accessibility.org/wcag20/rule/92">WCAG Rule 92: Role value must be valid</a></li>
Expand Down
8 changes: 4 additions & 4 deletions src/reactA11yRoleSupportsAriaPropsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export class Rule extends Lint.Rules.AbstractRule {
ruleName: 'react-a11y-role-supports-aria-props',
type: 'maintainability',
description:
'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).',
'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).',
rationale: `References:
<ul>
<li><a href="http://oaa-accessibility.org/wcag20/rule/87">ARIA attributes can only be used with certain roles</a></li>
Expand Down
18 changes: 5 additions & 13 deletions tslint-warnings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ no-string-based-set-timeout,Do not use the version of setTimeout that accepts co
CWE 676 - Use of Potentially Dangerous Function
CWE 242 - Use of Inherently Dangerous Function
CWE 116 - Improper Encoding or Escaping of Output"
no-string-literal,Forbids unnecessary string literal property access. Allows `obj["prop-erty"]` (can't be a regular property access).
Disallows `obj["property"]` (should be `obj.property`).,TSLINT2USQI0,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 710","CWE 398 - Indicator of Poor Code Quality
no-string-literal,Forbids unnecessary string literal property access. Allows `obj["prop-erty"]` (can't be a regular property access). Disallows `obj["property"]` (should be `obj.property`).,TSLINT2USQI0,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 710","CWE 398 - Indicator of Poor Code Quality
CWE 710 - Coding Standards Violation"
no-string-throw,Flags throwing plain strings or concatenations of strings.,TSLINT1PEDNQ9,tslint,Non-SDL,Warning,High,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
no-submodule-imports,Disallows importing any submodule.,TSLINT1L169N0,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,710,"CWE 710 - Coding Standards Violation"
Expand All @@ -203,9 +202,7 @@ no-unnecessary-qualifier,Warns when a namespace qualifier (`A.x`) is unnecessary
no-unnecessary-semicolons,Remove unnecessary semicolons,TSLINTEL0RJQ,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 710","CWE 398 - Indicator of Poor Code Quality
CWE 710 - Coding Standards Violation"
no-unnecessary-type-assertion,Warns if a type assertion does not change the type of an expression.,TSLINTQSR9EJ,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,710,"CWE 710 - Coding Standards Violation"
no-unsafe-any,Warns when using an expression of type 'any' in a dynamic way. Uses are only allowed if they would work for `{} | null | undefined`.
Type casts and tests are allowed.
Expressions that work on all values (such as `"" + x`) are allowed.,TSLINTE73MOI,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
no-unsafe-any,Warns when using an expression of type 'any' in a dynamic way. Uses are only allowed if they would work for `{} | null | undefined`. Type casts and tests are allowed. Expressions that work on all values (such as `"" + x`) are allowed.,TSLINTE73MOI,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
no-unsafe-finally,"Disallows control flow statements, such as `return`, `continue`, `break` and `throws` in finally blocks.",TSLINT1QMOM2N,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 584, 710","CWE 398 - Indicator of Poor Code Quality
CWE 584 - Return Inside Finally Block
CWE 710 - Coding Standards Violation"
Expand Down Expand Up @@ -272,9 +269,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. 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,"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`.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,,
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,,
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 All @@ -296,12 +293,7 @@ return-undefined,Prefer `return;` in void functions and `return undefined;` in v
semicolon,Enforces consistent semicolon usage at the end of every statement.,TSLINT1L591RI,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 710","CWE 398 - Indicator of Poor Code Quality
CWE 710 - Coding Standards Violation"
space-within-parens,Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.,TSLINT1E89MLR,tslint,Non-SDL,Warning,Low,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,710,"CWE 710 - Coding Standards Violation"
strict-boolean-expressions,"Restricts the types allowed in boolean expressions. By default only booleans are allowed.
The following nodes are checked:

* Arguments to the `!`, `&&`, and `||` operators
* The condition in a conditional expression (`cond ? x : y`)
* Conditions for `if`, `for`, `while`, and `do-while` statements.",TSLINTRUBPNF,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
strict-boolean-expressions,"Restricts the types allowed in boolean expressions. By default only booleans are allowed. The following nodes are checked: * Arguments to the `!`, `&&`, and `||` operators * The condition in a conditional expression (`cond ? x : y`) * Conditions for `if`, `for`, `while`, and `do-while` statements.",TSLINTRUBPNF,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
switch-default,Require a `default` case in all `switch` statements.,TSLINTKNBMK7,tslint,Non-SDL,Warning,Moderate,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,"398, 474, 710","CWE 398 - Indicator of Poor Code Quality
CWE 474 - Use of Function with Inconsistent Implementations
CWE 710 - Coding Standards Violation"
Expand Down

0 comments on commit 39e3950

Please sign in to comment.