├── .prettierrc ├── tests ├── void-zero │ ├── tslint.json │ ├── test.ts.fix │ └── test.ts.lint ├── valid-typeof │ ├── tslint.json │ └── test.ts.lint ├── export-name │ └── defaults │ │ ├── tslint.json │ │ └── re-export-external.ts.lint ├── no-useless-files │ ├── empty │ │ ├── test.ts.lint │ │ └── tslint.json │ ├── code │ │ ├── tslint.json │ │ └── test.ts.lint │ ├── mixed comments │ │ ├── tslint.json │ │ └── test.ts.lint │ ├── multi line comments │ │ ├── tslint.json │ │ └── test.ts.lint │ └── single line comments │ │ ├── tslint.json │ │ └── test.ts.lint ├── no-var-self │ ├── default │ │ ├── tslint.json │ │ └── test.ts.lint │ ├── parameter │ │ ├── tslint.json │ │ └── test.ts.lint │ └── negation parameter │ │ ├── tslint.json │ │ └── test.ts.lint ├── chai-vague-errors │ └── tslint.json ├── detect-child-process │ └── tslint.json ├── no-unnecessary-bind │ └── tslint.json ├── no-with-statement │ ├── tslint.json │ └── test.ts.lint ├── non-literal-fs-path │ ├── tslint.json │ └── test.ts.lint ├── non-literal-require │ ├── tslint.json │ └── test.ts.lint ├── react-a11y-iframes │ └── tslint.json ├── promise-must-complete │ └── tslint.json ├── no-unnecessary-override │ └── tslint.json ├── possible-timing-attack │ └── tslint.json ├── prefer-array-literal │ ├── default │ │ └── tslint.json │ ├── allow-size-argument-typed │ │ ├── tsconfig.json │ │ └── tslint.json │ ├── allow-size-argument │ │ └── tslint.json │ └── allow-type-parameters │ │ └── tslint.json ├── react-a11y-media-captions │ └── tslint.json ├── no-unnecessary-local-variable │ ├── tslint.json │ └── test.ts.lint ├── no-unsupported-browser-code │ └── tslint.json ├── chai-prefer-contains-to-index-of │ ├── tslint.json │ └── test.ts.lint ├── no-unnecessary-field-initialization │ └── tslint.json ├── react-a11y-mouse-event-has-key-event │ ├── tslint.json │ └── test.tsx.lint ├── underscore-consistent-invocation │ ├── default │ │ └── tslint.json │ └── static │ │ └── tslint.json ├── react-unused-props-and-state │ ├── functions │ │ ├── functions │ │ │ ├── tslint.json │ │ │ ├── passes-for-object-binding.tsx.lint │ │ │ ├── reports-for-object-binding.tsx.lint │ │ │ ├── passes-for-prop-alias-in-type-reference.tsx.lint │ │ │ ├── passes-for-function-when-prop-in-type-reference.tsx.lint │ │ │ ├── passes-for-example-from-issue-339.tsx.lint │ │ │ └── reports-for-prop-missing-in-type-reference.tsx.lint │ │ ├── arrow-functions │ │ │ ├── tslint.json │ │ │ ├── passes-for-object-binding.tsx.lint │ │ │ └── reports-for-object-binding.tsx.lint │ │ ├── function-components │ │ │ ├── tslint.json │ │ │ ├── passes-for-prop-alias-in-type-reference.tsx.lint │ │ │ ├── passes-for-prop-in-type-reference.tsx.lint │ │ │ ├── reports-for-explicit-import-shorthand.tsx.lint │ │ │ └── reports-for-explicit-import.tsx.lint │ │ └── stateless-functions │ │ │ ├── tslint.json │ │ │ ├── passes-for-prop-alias-in-type-literal.tsx.lint │ │ │ ├── passes-for-prop-in-type-literal.tsx.lint │ │ │ ├── passes-for-prop-alias-in-type-reference.tsx.lint │ │ │ ├── passes-for-prop-in-type-reference.tsx.lint │ │ │ ├── reports-for-prop-alias-in-type-literal.tsx.lint │ │ │ ├── reports-for-prop-in-type-literal.tsx.lint │ │ │ ├── reports-for-explicit-import-shorthand.tsx.lint │ │ │ ├── reports-for-prop-alias-in-type-reference.tsx.lint │ │ │ ├── reports-for-prop-in-type-reference.tsx.lint │ │ │ ├── passes-for-all-props-used-in-jsx-return-value.tsx.lint │ │ │ ├── reports-for-explicit-import.tsx.lint │ │ │ ├── passes-for-jsx-assigned-to-variable.tsx.lint │ │ │ ├── reports-for-prop-in-complex-statement.tsx.lint │ │ │ └── reports-for-prop-in-object-binding-and-complex-statement.tsx.lint │ └── class-components │ │ ├── default │ │ ├── tslint.json │ │ ├── passes-when-interfaces-defined-at-end.tsx.lint │ │ ├── passes-when-props-referenced-in-constructor.tsx.lint │ │ ├── passes-when-functions-are-used.tsx.lint │ │ ├── passes-when-props-escapes-from-componentwillreceiveprops.tsx.lint │ │ ├── passes-when-props-escapes-from-componentwillupdate.tsx.lint │ │ ├── passes-when-props-escapes-from-componentdidupdate.tsx.lint │ │ ├── passes-when-state-escapes-from-componentdidupdate.tsx.lint │ │ ├── passes-when-state-escapes-from-componentwillupdate.tsx.lint │ │ ├── passes-when-props-escapes-from-shouldcomponentupdate.tsx.lint │ │ ├── passes-when-state-escapes-from-shouldcomponentupdate.tsx.lint │ │ ├── reports-missing-functions.tsx.lint │ │ ├── passes-when-props-and-state-escape-the-class-or-function.tsx.lint │ │ ├── passes-when-all-props-and-state-used.tsx.lint │ │ ├── reports-when-used-in-ternary.tsx.lint │ │ ├── passes-when-state-referenced-from-lifecycle-method.tsx.lint │ │ ├── reports-missing-props-and-state.tsx.lint │ │ └── passes-when-props-referenced-from-lifecycle-method.tsx.lint │ │ └── custom-names │ │ ├── tslint.json │ │ └── reports-missing-props-and-state-with-custom-name.tsx.lint ├── use-named-parameter │ ├── tslint.json │ └── test.ts.lint └── no-relative-imports │ ├── default │ └── tslint.json │ └── allow-siblings │ └── tslint.json ├── test-data ├── PreferTypeCastRuleTests-passing.tsx ├── NoStringBasedSetTimeout │ ├── NoStringBasedSetTimeoutTestInput-error.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-template-strings.ts │ ├── NoStringBasedSetTimeoutTestInput-functionParamFunction.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-constructor.ts │ ├── NoStringBasedSetTimeoutTestInput-formerFalsePositive.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-string-literals.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-parameters.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-any-variables.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-string-variables.ts │ ├── NoStringBasedSetTimeoutTestInput-case4.ts │ ├── NoStringBasedSetTimeoutTestInput-error4.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-any-functions.ts │ ├── NoStringBasedSetTimeoutFailingTestInput-string-functions.ts │ ├── NoStringBasedSetTimeoutTestInput-error5.ts │ ├── NoStringBasedSetTimeoutTestInput-error3.ts │ ├── NoStringBasedSetTimeoutTestInput-issue46.ts │ └── NoStringBasedSetTimeoutTestInput-case3.ts ├── ExportName │ ├── PrefixedExpectedClassName.ts │ ├── ExportNameRuleFailingTestInput.ts │ ├── ExportNameRulePassingTestInput.ts │ ├── ExportNameRulePassingTestInput2.tsx │ ├── ExportNameRuleFailingTestInput2.tsx │ ├── export-name-rule-passing-test-input-3.tsx │ └── export_name_rule_passing_test_input_4.tsx ├── NoCookies │ ├── NoCookiesTestInput-error.ts │ ├── NoCookiesFailingTestInput.ts │ └── NoCookiesPassingTestInput.ts ├── a11yProptypes │ ├── PassingTestInputs │ │ ├── string.tsx │ │ ├── allowUndefined.tsx │ │ ├── boolean.tsx │ │ ├── tristate.tsx │ │ ├── integer.tsx │ │ ├── number.tsx │ │ ├── token.tsx │ │ ├── tokenlist.tsx │ │ └── canNotCheckUntilRunTime.tsx │ └── FailingTestInputs │ │ ├── notAllowUndefined.tsx │ │ ├── string.tsx │ │ ├── boolean.tsx │ │ ├── number.tsx │ │ ├── tristate.tsx │ │ ├── token.tsx │ │ ├── integer.tsx │ │ └── tokenlist.tsx ├── references.ts ├── NoUnnecessarySemicolonsTestInput.ts ├── a11yImgHasAlt │ ├── DefaltTests │ │ ├── FailingTestInputs │ │ │ ├── ImgElementHasNoAlt.tsx │ │ │ └── ImgElementHasNonEmptyAltValueAndPresentationRole.tsx │ │ └── PassingTestInputs │ │ │ ├── ElementNotImg.tsx │ │ │ ├── ImgElementHasSpreadAttribute.tsx │ │ │ ├── ImgElementNotLowerCase.tsx │ │ │ ├── ImgElementHasNonEmptyAltValueAndNotPresentationRole.tsx │ │ │ ├── ImgElementHasNonEmptyAltValueAndPresentationRole.tsx │ │ │ └── ImgElementHasNonEmptyAltValueAndUndefinedPresentationRole.tsx │ └── CustomElementTests │ │ ├── PassingTestInputs │ │ ├── ElementNeitherImgNorCustomElement.tsx │ │ └── CustomElementHasNonEmptyAltValueAndNotPresentationRole.tsx │ │ └── FailingTestInputs │ │ ├── CustomElementHasNoAltProp.tsx │ │ ├── CustomElementHasEmptyAltValueAndNotPresentationRole.tsx │ │ └── CustomElementHasNonEmptyAltValueAndPresentationRole.tsx ├── a11yRole │ ├── PassingTestInputs │ │ ├── AttributeNotRole.tsx │ │ ├── RoleNameNotStringLiteral.tsx │ │ ├── CorrectName.tsx │ │ └── MultipleCorrectRole.tsx │ └── FailingTestInputs │ │ ├── InvalidRole.tsx │ │ └── AbstractRole.tsx ├── NoFunctionExpressionWithInTSX.tsx ├── NoFunctionConstructorWithStringArgsTestInput.ts ├── a11yRoleSupportsAriaProps │ ├── FailingTestInputs │ │ ├── ElementHasNotSupportedAriaPropsForEmptyRole.tsx │ │ ├── ElementHasNotSupportedAriaPropsForImplicitRole.tsx │ │ └── ElementHasNotSupportedAriaPropsForExplicitRole.tsx │ └── PassingTestInputs │ │ ├── CustomElementSupportsAllAriaProps.tsx │ │ └── ImplicitRoleSupportsAllAriaProps.tsx ├── a11yTabindexNoPositive │ ├── PassingTestInputs │ │ ├── AttributeNotTabindex.tsx │ │ ├── CorrectTabindexValue.tsx │ │ └── TabindexValueNotLiteral.tsx │ └── FailingTestInputs │ │ └── TabindexValueNotNumericLiteral.tsx ├── a11yProps │ ├── PassingTestInputs │ │ ├── AttributeNotAria.tsx │ │ └── CorrectAriaAttributeName.tsx │ └── FailingTestInputs │ │ └── InvalidAriaAttributeName.tsx ├── a11yRoleHasRequiredAriaProps │ ├── PassingTestInputs │ │ ├── RoleHasNoRequiredProps.tsx │ │ ├── RoleValueNotLiteralString.tsx │ │ ├── AttributeHasNoValidRole.tsx │ │ └── RoleValueAndAttributesHaveRequiredProps.tsx │ └── FailingTestInputs │ │ └── ExplicitRoleMissingRequiredProps.tsx ├── NoReservedKeywords │ ├── NoReservedKeywordsTestInput-class.ts │ ├── NoReservedKeywordsTestInput-do.ts │ ├── NoReservedKeywordsTestInput-if.ts │ ├── NoReservedKeywordsTestInput-in.ts │ ├── NoReservedKeywordsTestInput-for.ts │ ├── NoReservedKeywordsTestInput-new.ts │ ├── NoReservedKeywordsTestInput-try.ts │ ├── NoReservedKeywordsTestInput-case.ts │ ├── NoReservedKeywordsTestInput-else.ts │ ├── NoReservedKeywordsTestInput-enum.ts │ ├── NoReservedKeywordsTestInput-null.ts │ ├── NoReservedKeywordsTestInput-this.ts │ ├── NoReservedKeywordsTestInput-true.ts │ ├── NoReservedKeywordsTestInput-void.ts │ ├── NoReservedKeywordsTestInput-with.ts │ ├── NoReservedKeywordsTestInput-break.ts │ ├── NoReservedKeywordsTestInput-catch.ts │ ├── NoReservedKeywordsTestInput-const.ts │ ├── NoReservedKeywordsTestInput-super.ts │ ├── NoReservedKeywordsTestInput-throw.ts │ ├── NoReservedKeywordsTestInput-while.ts │ ├── NoReservedKeywordsTestInput-delete.ts │ ├── NoReservedKeywordsTestInput-export.ts │ ├── NoReservedKeywordsTestInput-import.ts │ ├── NoReservedKeywordsTestInput-return.ts │ ├── NoReservedKeywordsTestInput-switch.ts │ ├── NoReservedKeywordsTestInput-typeof.ts │ ├── NoReservedKeywordsTestInput-default.ts │ ├── NoReservedKeywordsTestInput-extends.ts │ ├── NoReservedKeywordsTestInput-finally.ts │ ├── NoReservedKeywordsTestInput-continue.ts │ ├── NoReservedKeywordsTestInput-debugger.ts │ ├── NoReservedKeywordsTestInput-false.ts │ ├── NoReservedKeywordsTestInput-function.ts │ ├── NoReservedKeywordsTestInput-instanceof.ts │ ├── NoReservedKeywordsTestInput-var.ts │ ├── NoReservedKeywordsTestInput-let.ts │ ├── NoReservedKeywordsTestInput-yield.ts │ ├── NoReservedKeywordsTestInput-public.ts │ ├── NoReservedKeywordsTestInput-static.ts │ ├── NoReservedKeywordsTestInput-package.ts │ ├── NoReservedKeywordsTestInput-private.ts │ ├── NoReservedKeywordsTestInput-any.ts │ ├── NoReservedKeywordsTestInput-interface.ts │ ├── NoReservedKeywordsTestInput-protected.ts │ ├── NoReservedKeywordsTestInput-implements.ts │ ├── NoReservedKeywordsTestInput-as.ts │ ├── NoReservedKeywordsTestInput-of.ts │ ├── NoReservedKeywordsTestInput-get.ts │ ├── NoReservedKeywordsTestInput-number.ts │ ├── NoReservedKeywordsTestInput-set.ts │ ├── NoReservedKeywordsTestInput-string.ts │ ├── NoReservedKeywordsTestInput-symbol.ts │ ├── NoReservedKeywordsTestInput-boolean.ts │ ├── NoReservedKeywordsTestInput-from.ts │ ├── NoReservedKeywordsTestInput-module.ts │ ├── NoReservedKeywordsTestInput-type.ts │ ├── NoReservedKeywordsTestInput-require.ts │ ├── NoReservedKeywordsTestInput-constructor.ts │ └── NoReservedKeywordsTestInput-declare.ts ├── tsconfig.json ├── ReactThisBinding │ ├── ReactThisBindingIssueWithDecoratorDeclaredAfterUsage-passing.tsx │ ├── ReactThisBindingIssue-doublebinding.tsx │ ├── ReactThisBindingIssue-unbound.tsx │ ├── ReactThisBindingIssue-local-instance.tsx │ ├── ReactThisBindingIssue-anon-instance.tsx │ ├── ReactThisBindingIssueWithDecorator-passing.tsx │ └── ReactThisBindingIssue-passing.tsx └── NoOctalLiteral │ └── NoOctalLiteralTestInput-passing.ts ├── .gitattributes ├── src ├── utils │ ├── attributes │ │ ├── IDom.ts │ │ ├── IAria.ts │ │ ├── IRole.ts │ │ └── README.md │ ├── implicitRoles │ │ ├── README.md │ │ ├── dl.ts │ │ ├── ol.ts │ │ ├── td.ts │ │ ├── tr.ts │ │ ├── ul.ts │ │ ├── dd.ts │ │ ├── dt.ts │ │ ├── h1.ts │ │ ├── h2.ts │ │ ├── h3.ts │ │ ├── h4.ts │ │ ├── h5.ts │ │ ├── h6.ts │ │ ├── hr.ts │ │ ├── form.ts │ │ ├── main.ts │ │ ├── math.ts │ │ ├── nav.ts │ │ ├── body.ts │ │ ├── table.ts │ │ ├── button.ts │ │ ├── dialog.ts │ │ ├── meter.ts │ │ ├── tbody.ts │ │ ├── tfoot.ts │ │ ├── thead.ts │ │ ├── aside.ts │ │ ├── details.ts │ │ ├── option.ts │ │ ├── output.ts │ │ ├── section.ts │ │ ├── select.ts │ │ ├── summary.ts │ │ ├── article.ts │ │ ├── optgroup.ts │ │ ├── datalist.ts │ │ ├── progress.ts │ │ ├── textarea.ts │ │ ├── th.ts │ │ ├── header.ts │ │ ├── footer.ts │ │ ├── a.ts │ │ ├── area.ts │ │ ├── link.ts │ │ ├── img.ts │ │ ├── li.ts │ │ ├── menu.ts │ │ └── menuitem.ts │ ├── ExtendedMetadata.ts │ └── getImplicitRole.ts ├── tests │ ├── tslint.json │ ├── AstUtilsTests.ts │ ├── NoMultilineStringTests.ts │ ├── NoFunctionConstructorWithStringArgsTests.ts │ ├── PreferTypeCastRuleTests.ts │ ├── NoDisableAutoSanitizationTests.ts │ ├── NoEmptyLineAfterOpeningBraceRuleTests.ts │ ├── NoForInRuleTests.ts │ ├── NoMultipleVarDeclRuleTests.ts │ └── NoDeleteExpressionTests.ts ├── noStringBasedSetTimeoutRule.ts ├── noStringBasedSetImmediateRule.ts ├── noStringBasedSetIntervalRule.ts ├── noWithStatementRule.ts ├── fixNoVarKeywordFormatter.ts ├── missingJsdocRule.ts ├── preferTypeCastRule.ts ├── noRegexSpacesRule.ts ├── noMultilineStringRule.ts └── noExecScriptRule.ts ├── .editorconfig ├── .travis.yml ├── .gitignore ├── .prettierignore ├── .vscode ├── settings.json ├── extensions.json └── launch.json ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── rule-suggestion.md │ ├── bug_report.md │ └── feature_request.md └── ISSUE_TEMPLATE.md ├── configs └── latest.json ├── CODE_OF_CONDUCT.md ├── docs ├── react-a11y-props-Rule.md ├── README.md ├── react-a11y-tabindex-no-positive-Rule.md ├── react-ally-role-Rule.md ├── react-a11y-role-has-required-props-Rule.md └── react-no-dangerous-html-Rule.md ├── tsconfig.json ├── .azure-pipelines-steps.yml ├── LICENSE └── .azure-pipelines.yml /.prettierrc: -------------------------------------------------------------------------------- 1 | tabWidth: 4 2 | printWidth: 140 3 | singleQuote: true 4 | -------------------------------------------------------------------------------- /tests/void-zero/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "void-zero": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/valid-typeof/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "valid-typeof": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/export-name/defaults/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "export-name": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-useless-files/empty/test.ts.lint: -------------------------------------------------------------------------------- 1 | 2 | ~nil [This file is empty and should be deleted.] 3 | 4 | -------------------------------------------------------------------------------- /tests/no-var-self/default/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-var-self": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/chai-vague-errors/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "chai-vague-errors": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/detect-child-process/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "detect-child-process": true 4 | } 5 | } -------------------------------------------------------------------------------- /tests/no-unnecessary-bind/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unnecessary-bind": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-useless-files/code/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-useless-files": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-useless-files/empty/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-useless-files": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-with-statement/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-with-statement": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/non-literal-fs-path/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "non-literal-fs-path": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/non-literal-require/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "non-literal-require": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-a11y-iframes/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-a11y-iframes": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/PreferTypeCastRuleTests-passing.tsx: -------------------------------------------------------------------------------- 1 | let myVariable = 100; 2 | let myString = (myVariable as any) as string; 3 | -------------------------------------------------------------------------------- /tests/promise-must-complete/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "promise-must-complete": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/NoStringBasedSetTimeout/NoStringBasedSetTimeoutTestInput-error.ts: -------------------------------------------------------------------------------- 1 | setTimeout(function(): void {}.bind(this), 400); 2 | -------------------------------------------------------------------------------- /tests/no-unnecessary-override/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unnecessary-override": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-useless-files/mixed comments/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-useless-files": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-var-self/parameter/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-var-self": [true, "^self$"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/possible-timing-attack/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "possible-timing-attack": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/prefer-array-literal/default/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "prefer-array-literal": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.csv eol=lf 2 | *.js eol=lf 3 | *.jsx eol=lf 4 | *.fix eol=lf 5 | *.lint eol=lf 6 | *.ts eol=lf 7 | *.tsx eol=lf 8 | -------------------------------------------------------------------------------- /src/utils/attributes/IDom.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Interface of dom 3 | */ 4 | export interface IDom { 5 | supportAria: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /tests/export-name/defaults/re-export-external.ts.lint: -------------------------------------------------------------------------------- 1 | // should be skipped - no names to validate 2 | export * from './other'; 3 | -------------------------------------------------------------------------------- /tests/no-useless-files/multi line comments/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-useless-files": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-useless-files/single line comments/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-useless-files": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-a11y-media-captions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-a11y-media-captions": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-unnecessary-local-variable/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unnecessary-local-variable": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-unsupported-browser-code/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unsupported-browser-code": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-var-self/negation parameter/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-var-self": [true, "^(?!self$)"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | indent_style = space 6 | charset = utf-8 7 | 8 | [src/**] 9 | indent_size = 4 -------------------------------------------------------------------------------- /tests/no-useless-files/code/test.ts.lint: -------------------------------------------------------------------------------- 1 | export class MyClass { 2 | constructor () { 3 | console.log("foo"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/chai-prefer-contains-to-index-of/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "chai-prefer-contains-to-index-of": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/prefer-array-literal/allow-size-argument-typed/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/ExportName/PrefixedExpectedClassName.ts: -------------------------------------------------------------------------------- 1 | class ExpectedClassName {} 2 | export = ExpectedClassName; // doesn't match file name with prefix 3 | -------------------------------------------------------------------------------- /test-data/NoCookies/NoCookiesTestInput-error.ts: -------------------------------------------------------------------------------- 1 | namespace Sample { 2 | function method() { 3 | return document.cookie; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/no-unnecessary-field-initialization/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unnecessary-field-initialization": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-a11y-mouse-event-has-key-event/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-a11y-mouse-event-has-key-event": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/underscore-consistent-invocation/default/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "underscore-consistent-invocation": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-unused-props-and-state/functions/functions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-unused-props-and-state": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/ExportName/ExportNameRuleFailingTestInput.ts: -------------------------------------------------------------------------------- 1 | class ThisIsNotTheNameOfTheFile {} 2 | export = ThisIsNotTheNameOfTheFile; // does not match filename 3 | -------------------------------------------------------------------------------- /test-data/ExportName/ExportNameRulePassingTestInput.ts: -------------------------------------------------------------------------------- 1 | class ExportNameRulePassingTestInput {} 2 | export = ExportNameRulePassingTestInput; // matches filename 3 | -------------------------------------------------------------------------------- /test-data/NoStringBasedSetTimeout/NoStringBasedSetTimeoutFailingTestInput-template-strings.ts: -------------------------------------------------------------------------------- 1 | var data = 'alert(1)'; 2 | window.setTimeout(`${data}`, 200); 3 | -------------------------------------------------------------------------------- /tests/react-unused-props-and-state/class-components/default/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-unused-props-and-state": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-unused-props-and-state/functions/arrow-functions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-unused-props-and-state": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/ExportName/ExportNameRulePassingTestInput2.tsx: -------------------------------------------------------------------------------- 1 | class ExportNameRulePassingTestInput2 {} 2 | export = ExportNameRulePassingTestInput2; // matches filename 3 | -------------------------------------------------------------------------------- /tests/no-useless-files/single line comments/test.ts.lint: -------------------------------------------------------------------------------- 1 | // This is the only comment in this file 2 | ~nil [This file only contains comments and should be deleted.] 3 | -------------------------------------------------------------------------------- /tests/react-unused-props-and-state/functions/function-components/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-unused-props-and-state": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-unused-props-and-state/functions/stateless-functions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "react-unused-props-and-state": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-data/ExportName/ExportNameRuleFailingTestInput2.tsx: -------------------------------------------------------------------------------- 1 | class ExportNameRuleFailingTestInput {} 2 | export = ExportNameRuleFailingTestInput; // does not match filename 3 | -------------------------------------------------------------------------------- /test-data/ExportName/export-name-rule-passing-test-input-3.tsx: -------------------------------------------------------------------------------- 1 | class ExportNameRulePassingTestInput3 {} 2 | export = ExportNameRulePassingTestInput3; // matches filename 3 | -------------------------------------------------------------------------------- /test-data/ExportName/export_name_rule_passing_test_input_4.tsx: -------------------------------------------------------------------------------- 1 | class ExportNameRulePassingTestInput4 {} 2 | export = ExportNameRulePassingTestInput4; // matches filename 3 | -------------------------------------------------------------------------------- /test-data/NoStringBasedSetTimeout/NoStringBasedSetTimeoutTestInput-functionParamFunction.ts: -------------------------------------------------------------------------------- 1 | function foo(callback: Function) { 2 | setTimeout(callback, 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/prefer-array-literal/allow-size-argument/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "prefer-array-literal": [true, {"allow-size-argument": true}] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/prefer-array-literal/allow-type-parameters/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "prefer-array-literal": [true, {"allow-type-parameters": true}] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | - windows 4 | 5 | language: node_js 6 | 7 | node_js: 8 | - '6' 9 | - '8' 10 | - '10' 11 | - '11' 12 | 13 | sudo: false 14 | -------------------------------------------------------------------------------- /test-data/a11yProptypes/PassingTestInputs/string.tsx: -------------------------------------------------------------------------------- 1 | import React = require('react'); 2 | 3 | const a =
; 4 | const b = ; 5 | -------------------------------------------------------------------------------- /test-data/references.ts: -------------------------------------------------------------------------------- 1 | ///
;
11 | const f =
;
12 | const g =
;
13 |
--------------------------------------------------------------------------------
/src/utils/implicitRoles/li.ts:
--------------------------------------------------------------------------------
1 | import * as ts from 'typescript';
2 | import { isJsxElement } from '../TypeGuard';
3 |
4 | /**
5 | * @Returns the implicit role for an li tag.
6 | */
7 | function getImplicitRoleForLi(node: ts.Node): string | undefined {
8 | const parentNode: ts.Node = node.parent;
9 | let parentTagName: string | undefined;
10 |
11 | if (isJsxElement(parentNode)) {
12 | parentTagName = parentNode.openingElement.tagName.getText();
13 | }
14 |
15 | return parentTagName === 'ol' || parentTagName === 'ul' ? 'listitem' : undefined;
16 | }
17 |
18 | export { getImplicitRoleForLi as li };
19 |
--------------------------------------------------------------------------------
/tests/react-unused-props-and-state/class-components/default/passes-when-functions-are-used.tsx.lint:
--------------------------------------------------------------------------------
1 | import React = require('react');
2 |
3 | module VideoContainer {
4 | export interface Props {
5 | myProp: ();
6 | }
7 | export interface State {
8 | myState: ();
9 | }
10 | }
11 |
12 | class VideoContainer extends React.Componentextends BaseReactComponent
{
19 |
20 | public render(): ReactTypes.ReactElement