Permalink
Browse files

feat(eslint-plugin): Migrate plugin to ts (#120)

  • Loading branch information...
bradzacher authored and JamesHenry committed Feb 11, 2019
1 parent 5e3e285 commit 61c60dc047da680b8cc74943c52c33562942c95a
Showing with 7,846 additions and 5,632 deletions.
  1. +3 −16 .eslintrc.json
  2. +0 −3 .gitignore
  3. +3 −2 .vscode/launch.json
  4. +6 −0 azure-pipelines.yml
  5. +2 −1 package.json
  6. +3 −2 packages/eslint-plugin-tslint/package.json
  7. +7 −0 packages/eslint-plugin-tslint/tsconfig.build.json
  8. +3 −6 packages/eslint-plugin-tslint/tsconfig.json
  9. +0 −6 packages/eslint-plugin/.npmignore
  10. +2 −2 packages/eslint-plugin/jest.config.js
  11. +0 −25 packages/eslint-plugin/lib/index.js
  12. +0 −138 packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js
  13. +0 −96 packages/eslint-plugin/lib/rules/class-name-casing.js
  14. +0 −118 packages/eslint-plugin/lib/rules/explicit-function-return-type.js
  15. +0 −83 packages/eslint-plugin/lib/rules/explicit-member-accessibility.js
  16. +0 −53 packages/eslint-plugin/lib/rules/generic-type-naming.js
  17. +0 −399 packages/eslint-plugin/lib/rules/indent.js
  18. +0 −85 packages/eslint-plugin/lib/rules/interface-name-prefix.js
  19. +0 −46 packages/eslint-plugin/lib/rules/no-angle-bracket-type-assertion.js
  20. +0 −53 packages/eslint-plugin/lib/rules/no-empty-interface.js
  21. +0 −37 packages/eslint-plugin/lib/rules/no-explicit-any.js
  22. +0 −191 packages/eslint-plugin/lib/rules/no-inferrable-types.js
  23. +0 −99 packages/eslint-plugin/lib/rules/no-misused-new.js
  24. +0 −40 packages/eslint-plugin/lib/rules/no-non-null-assertion.js
  25. +0 −96 packages/eslint-plugin/lib/rules/no-object-literal-type-assertion.js
  26. +0 −99 packages/eslint-plugin/lib/rules/no-parameter-properties.js
  27. +0 −50 packages/eslint-plugin/lib/rules/no-require-imports.js
  28. +0 −77 packages/eslint-plugin/lib/rules/no-this-alias.js
  29. +0 −66 packages/eslint-plugin/lib/rules/no-triple-slash-reference.js
  30. +0 −45 packages/eslint-plugin/lib/rules/no-var-requires.js
  31. +0 −171 packages/eslint-plugin/lib/rules/prefer-function-type.js
  32. +0 −129 packages/eslint-plugin/lib/util.js
  33. +16 −4 packages/eslint-plugin/package.json
  34. +1 −3 packages/eslint-plugin/{lib → src}/configs/recommended.json
  35. +27 −0 packages/eslint-plugin/src/index.ts
  36. +148 −0 packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts
  37. +67 −65 packages/eslint-plugin/{lib/rules/array-type.js → src/rules/array-type.ts}
  38. +58 −51 packages/eslint-plugin/{lib/rules/ban-types.js → src/rules/ban-types.ts}
  39. +45 −44 packages/eslint-plugin/{lib/rules/camelcase.js → src/rules/camelcase.ts}
  40. +102 −0 packages/eslint-plugin/src/rules/class-name-casing.ts
  41. +120 −0 packages/eslint-plugin/src/rules/explicit-function-return-type.ts
  42. +77 −0 packages/eslint-plugin/src/rules/explicit-member-accessibility.ts
  43. +53 −0 packages/eslint-plugin/src/rules/generic-type-naming.ts
  44. +445 −0 packages/eslint-plugin/src/rules/indent.ts
  45. +67 −0 packages/eslint-plugin/src/rules/interface-name-prefix.ts
  46. +73 −54 packages/eslint-plugin/{lib/rules/member-delimiter-style.js → src/rules/member-delimiter-style.ts}
  47. +30 −29 packages/eslint-plugin/{lib/rules/member-naming.js → src/rules/member-naming.ts}
  48. +139 −132 packages/eslint-plugin/{lib/rules/member-ordering.js → src/rules/member-ordering.ts}
  49. +41 −0 packages/eslint-plugin/src/rules/no-angle-bracket-type-assertion.ts
  50. +15 −16 packages/eslint-plugin/{lib/rules/no-array-constructor.js → src/rules/no-array-constructor.ts}
  51. +48 −0 packages/eslint-plugin/src/rules/no-empty-interface.ts
  52. +35 −0 packages/eslint-plugin/src/rules/no-explicit-any.ts
  53. +40 −33 packages/eslint-plugin/{lib/rules/no-extraneous-class.js → src/rules/no-extraneous-class.ts}
  54. +13 −18 packages/eslint-plugin/{lib/rules/no-for-in-array.js → src/rules/no-for-in-array.ts}
  55. +199 −0 packages/eslint-plugin/src/rules/no-inferrable-types.ts
  56. +114 −0 packages/eslint-plugin/src/rules/no-misused-new.ts
  57. +23 −25 packages/eslint-plugin/{lib/rules/no-namespace.js → src/rules/no-namespace.ts}
  58. +36 −0 packages/eslint-plugin/src/rules/no-non-null-assertion.ts
  59. +88 −0 packages/eslint-plugin/src/rules/no-object-literal-type-assertion.ts
  60. +116 −0 packages/eslint-plugin/src/rules/no-parameter-properties.ts
  61. +41 −0 packages/eslint-plugin/src/rules/no-require-imports.ts
  62. +83 −0 packages/eslint-plugin/src/rules/no-this-alias.ts
  63. +47 −0 packages/eslint-plugin/src/rules/no-triple-slash-reference.ts
  64. +116 −116 packages/eslint-plugin/{lib/rules/no-type-alias.js → src/rules/no-type-alias.ts}
  65. +42 −55 ...-plugin/{lib/rules/no-unnecessary-type-assertion.js → src/rules/no-unnecessary-type-assertion.ts}
  66. +22 −29 packages/eslint-plugin/{lib/rules/no-unused-vars.js → src/rules/no-unused-vars.ts}
  67. +72 −99 packages/eslint-plugin/{lib/rules/no-use-before-define.js → src/rules/no-use-before-define.ts}
  68. +20 −24 packages/eslint-plugin/{lib/rules/no-useless-constructor.js → src/rules/no-useless-constructor.ts}
  69. +46 −0 packages/eslint-plugin/src/rules/no-var-requires.ts
  70. +160 −0 packages/eslint-plugin/src/rules/prefer-function-type.ts
  71. +23 −23 packages/eslint-plugin/{lib/rules/prefer-interface.js → src/rules/prefer-interface.ts}
  72. +20 −20 ...ges/eslint-plugin/{lib/rules/prefer-namespace-keyword.js → src/rules/prefer-namespace-keyword.ts}
  73. +55 −42 packages/eslint-plugin/{lib/rules/promise-function-async.js → src/rules/promise-function-async.ts}
  74. +18 −22 packages/eslint-plugin/{lib/rules/restrict-plus-operands.js → src/rules/restrict-plus-operands.ts}
  75. +57 −43 packages/eslint-plugin/{lib/rules/type-annotation-spacing.js → src/rules/type-annotation-spacing.ts}
  76. +34 −0 packages/eslint-plugin/src/util/applyDefault.ts
  77. +62 −0 packages/eslint-plugin/src/util/createRule.ts
  78. +49 −0 packages/eslint-plugin/src/util/deepMerge.ts
  79. +29 −0 packages/eslint-plugin/src/util/getParserServices.ts
  80. +6 −0 packages/eslint-plugin/src/util/index.ts
  81. +65 −0 packages/eslint-plugin/src/util/misc.ts
  82. +9 −10 packages/eslint-plugin/{lib/utils/types.js → src/util/types.ts}
  83. +68 −0 packages/eslint-plugin/tests/RuleTester.ts
  84. +2 −8 packages/eslint-plugin/tests/{lib/eslint-rules/arrow-parens.js → eslint-rules/arrow-parens.test.ts}
  85. +2 −8 packages/eslint-plugin/tests/{lib/eslint-rules/no-dupe-args.js → eslint-rules/no-dupe-args.test.ts}
  86. +2 −8 ...plugin/tests/{lib/eslint-rules/no-implicit-globals.js → eslint-rules/no-implicit-globals.test.ts}
  87. +2 −8 packages/eslint-plugin/tests/{lib/eslint-rules/no-redeclare.js → eslint-rules/no-redeclare.test.ts}
  88. +2 −8 ...in/tests/{lib/eslint-rules/no-restricted-globals.js → eslint-rules/no-restricted-globals.test.ts}
  89. +2 −8 packages/eslint-plugin/tests/{lib/eslint-rules/no-shadow.js → eslint-rules/no-shadow.test.ts}
  90. +2 −12 packages/eslint-plugin/tests/{lib/eslint-rules/no-undef.js → eslint-rules/no-undef.test.ts}
  91. +2 −8 ...es/eslint-plugin/tests/{lib/eslint-rules/no-unused-vars.js → eslint-rules/no-unused-vars.test.ts}
  92. +2 −8 ...ugin/tests/{lib/eslint-rules/no-use-before-define.js → eslint-rules/no-use-before-define.test.ts}
  93. +3 −9 packages/eslint-plugin/tests/{lib/eslint-rules/strict.js → eslint-rules/strict.test.ts}
  94. +0 −93 packages/eslint-plugin/tests/lib/rules/no-array-constructor.js
  95. +0 −69 packages/eslint-plugin/tests/lib/rules/no-for-in-array.js
  96. +0 −36 packages/eslint-plugin/tests/lib/rules/no-non-null-assertion.js
  97. +0 −56 packages/eslint-plugin/tests/lib/rules/no-var-requires.js
  98. +0 −83 packages/eslint-plugin/tests/lib/rules/prefer-namespace-keyword.js
  99. +4 −20 ...in/tests/{lib/rules/adjacent-overload-signatures.js → rules/adjacent-overload-signatures.test.ts}
  100. +22 −38 packages/eslint-plugin/tests/{lib/rules/array-type.js → rules/array-type.test.ts}
  101. +29 −44 packages/eslint-plugin/tests/{lib/rules/ban-types.js → rules/ban-types.test.ts}
  102. +35 −27 packages/eslint-plugin/tests/{lib/rules/camelcase.js → rules/camelcase.test.ts}
  103. +42 −25 packages/eslint-plugin/tests/{lib/rules/class-name-casing.js → rules/class-name-casing.test.ts}
  104. +9 −23 .../tests/{lib/rules/explicit-function-return-type.js → rules/explicit-function-return-type.test.ts}
  105. +22 −20 .../tests/{lib/rules/explicit-member-accessibility.js → rules/explicit-member-accessibility.test.ts}
  106. +2 −15 packages/eslint-plugin/tests/{lib/rules/generic-type-naming.js → rules/generic-type-naming.test.ts}
  107. +347 −84 packages/eslint-plugin/tests/{lib/rules/indent.js → rules/indent.test.ts}
  108. +7 −21 ...es/eslint-plugin/tests/{lib/rules/interface-name-prefix.js → rules/interface-name-prefix.test.ts}
  109. +2 −17 .../eslint-plugin/tests/{lib/rules/member-delimiter-style.js → rules/member-delimiter-style.test.ts}
  110. +98 −32 packages/eslint-plugin/tests/{lib/rules/member-naming.js → rules/member-naming.test.ts}
  111. +627 −193 packages/eslint-plugin/tests/{lib/rules/member-ordering.js → rules/member-ordering.test.ts}
  112. +37 −35 ...ts/{lib/rules/no-angle-bracket-type-assertion.js → rules/no-angle-bracket-type-assertion.test.ts}
  113. +119 −0 packages/eslint-plugin/tests/rules/no-array-constructor.test.ts
  114. +5 −20 packages/eslint-plugin/tests/{lib/rules/no-empty-interface.js → rules/no-empty-interface.test.ts}
  115. +49 −63 packages/eslint-plugin/tests/{lib/rules/no-explicit-any.js → rules/no-explicit-any.test.ts}
  116. +27 −29 packages/eslint-plugin/tests/{lib/rules/no-extraneous-class.js → rules/no-extraneous-class.test.ts}
  117. +54 −0 packages/eslint-plugin/tests/rules/no-for-in-array.test.ts
  118. +42 −36 packages/eslint-plugin/tests/{lib/rules/no-inferrable-types.js → rules/no-inferrable-types.test.ts}
  119. +7 −16 packages/eslint-plugin/tests/{lib/rules/no-misused-new.js → rules/no-misused-new.test.ts}
  120. +24 −38 packages/eslint-plugin/tests/{lib/rules/no-namespace.js → rules/no-namespace.test.ts}
  121. +22 −0 packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts
  122. +2 −16 .../{lib/rules/no-object-literal-type-assertion.js → rules/no-object-literal-type-assertion.test.ts}
  123. +158 −55 ...slint-plugin/tests/{lib/rules/no-parameter-properties.js → rules/no-parameter-properties.test.ts}
  124. +7 −21 packages/eslint-plugin/tests/{lib/rules/no-require-imports.js → rules/no-require-imports.test.ts}
  125. +14 −25 packages/eslint-plugin/tests/{lib/rules/no-this-alias.js → rules/no-this-alias.test.ts}
  126. +2 −16 ...t-plugin/tests/{lib/rules/no-triple-slash-reference.js → rules/no-triple-slash-reference.test.ts}
  127. +200 −214 packages/eslint-plugin/tests/{lib/rules/no-type-alias.js → rules/no-type-alias.test.ts}
  128. +3 −17 .../tests/{lib/rules/no-unnecessary-type-assertion.js → rules/no-unnecessary-type-assertion.test.ts}
  129. +44 −51 packages/eslint-plugin/tests/{lib/rules/no-unused-vars.js → rules/no-unused-vars.test.ts}
  130. +240 −133 ...ages/eslint-plugin/tests/{lib/rules/no-use-before-define.js → rules/no-use-before-define.test.ts}
  131. +7 −9 .../eslint-plugin/tests/{lib/rules/no-useless-constructor.js → rules/no-useless-constructor.test.ts}
  132. +42 −0 packages/eslint-plugin/tests/rules/no-var-requires.test.ts
  133. +12 −26 ...ages/eslint-plugin/tests/{lib/rules/prefer-function-type.js → rules/prefer-function-type.test.ts}
  134. +2 −16 packages/eslint-plugin/tests/{lib/rules/prefer-interface.js → rules/prefer-interface.test.ts}
  135. +64 −0 packages/eslint-plugin/tests/rules/prefer-namespace-keyword.test.ts
  136. +69 −55 .../eslint-plugin/tests/{lib/rules/promise-function-async.js → rules/promise-function-async.test.ts}
  137. +3 −18 .../eslint-plugin/tests/{lib/rules/restrict-plus-operands.js → rules/restrict-plus-operands.test.ts}
  138. +826 −388 ...slint-plugin/tests/{lib/rules/type-annotation-spacing.js → rules/type-annotation-spacing.test.ts}
  139. +10 −10 packages/eslint-plugin/tests/{lib/util.js → util.test.ts}
  140. +18 −13 packages/eslint-plugin/tools/{update-recommended.js → update-recommended.ts}
  141. +16 −0 packages/eslint-plugin/tsconfig.build.json
  142. +11 −0 packages/eslint-plugin/tsconfig.json
  143. +332 −0 packages/eslint-plugin/typings/eslint-rules.d.ts
  144. +9 −0 packages/eslint-plugin/typings/requireindex.d.ts
  145. +536 −0 packages/eslint-plugin/typings/ts-eslint.d.ts
  146. +3 −2 packages/parser/package.json
  147. +3 −1 packages/parser/src/analyze-scope.ts
  148. +3 −0 packages/parser/src/parser.ts
  149. +6 −22 packages/parser/tests/lib/parser.ts
  150. +8 −0 packages/parser/tsconfig.build.json
  151. +3 −6 packages/parser/tsconfig.json
  152. +6 −0 packages/parser/{src → typings}/eslint-scope.d.ts
  153. +4 −2 packages/typescript-estree/package.json
  154. +1 −2 packages/typescript-estree/src/convert.ts
  155. +18 −19 packages/typescript-estree/src/node-utils.ts
  156. +1 −1 packages/typescript-estree/src/parser-options.ts
  157. +2 −4 packages/typescript-estree/src/parser.ts
  158. +0 −2 packages/typescript-estree/src/ts-estree.ts
  159. +16 −0 packages/typescript-estree/src/{ → ts-estree}/ast-node-types.ts
  160. +5 −0 packages/typescript-estree/src/ts-estree/index.ts
  161. +10 −17 packages/typescript-estree/src/{typedefs.ts → ts-estree/ts-estree.ts}
  162. +1 −1 packages/typescript-estree/tests/ast-alignment/utils.ts
  163. +1 −1 packages/typescript-estree/tests/lib/semanticInfo.ts
  164. +7 −0 packages/typescript-estree/tsconfig.build.json
  165. +2 −6 packages/typescript-estree/tsconfig.json
  166. +19 −0 tsconfig.base.json
  167. +0 −9 tsconfig.json
  168. +38 −45 yarn.lock
@@ -30,7 +30,7 @@
{
"files": [
"packages/eslint-plugin-tslint/tests/**/*.ts",
"packages/eslint-plugin/tests/**/*.js",
"packages/eslint-plugin/tests/**/*.test.ts",
"packages/parser/tests/**/*.ts",
"packages/typescript-estree/tests/**/*.ts"
],
@@ -53,22 +53,9 @@
}
},
{
"files": ["packages/eslint-plugin/**/*.js"],
"files": ["packages/eslint-plugin/test/**/*.ts"],
"rules": {
"eslint-plugin/fixer-return": "error",
"eslint-plugin/no-identical-tests": "error",
"eslint-plugin/no-missing-placeholders": "error",
"eslint-plugin/no-unused-placeholders": "error",
"eslint-plugin/no-useless-token-range": "error",
"eslint-plugin/require-meta-fixable": "error",
"eslint-plugin/prefer-placeholders": "error",
"eslint-plugin/prefer-replace-text": "error",
"eslint-plugin/no-deprecated-report-api": "error",
"eslint-plugin/report-message-format": ["error", "^[A-Z'{].*[\\.}]$"],
"eslint-plugin/no-deprecated-context-methods": "error",
"eslint-plugin/prefer-output-null": "error",
"eslint-plugin/test-case-shorthand-strings": "error",
"eslint-plugin/require-meta-type": "error"
"eslint-plugin/no-identical-tests": "error"
}
}
]
@@ -36,9 +36,6 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

@@ -11,9 +11,10 @@
"cwd": "${workspaceFolder}/packages/eslint-plugin/",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"args": [
"--colors",
"tests/lib/rules/${fileBasename}"
"--runInBand",
"tests/rules/${fileBasenameNoExtension}"
],
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
@@ -17,6 +17,12 @@ jobs:
# bootstrap
yarn --ignore-engines --frozen-lockfile
- script: |
# Note that this command *also* typechecks tests/tools,
# whereas the build only checks src files
yarn typecheck
displayName: 'Typecheck all packages'
- script: |
yarn check-format
displayName: 'Check code formatting'
@@ -7,7 +7,7 @@
"contributors": [
"James Henry <typescript-eslint@jameshenry.blog>",
"Nicholas C. Zakas",
"Brad Zacher",
"Brad Zacher <brad.zacher@gmail.com>",
"armano2",
"Jed Fox"
],
@@ -21,6 +21,7 @@
"test": "lerna run test --parallel",
"build": "lerna run build",
"clean": "lerna clean && lerna run clean",
"typecheck": "lerna run typecheck",
"lint": "eslint . --ext .js,.ts",
"lint-fix": "eslint . --ext .js,.ts --fix",
"cz": "git-cz",
@@ -21,8 +21,9 @@
"scripts": {
"test": "jest --coverage",
"prebuild": "npm run clean",
"build": "tsc",
"clean": "rimraf dist/"
"build": "tsc -p tsconfig.build.json",
"clean": "rimraf dist/",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"lodash.memoize": "^4.1.2"
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["src"]
}
@@ -1,8 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "./dist"
},
"include": ["src"]
"extends": "./tsconfig.build.json",
"include": ["src", "tests"],
"exclude": ["tests/test-project", "tests/test-tslint-rules-directory"]
}

This file was deleted.

Oops, something went wrong.
@@ -5,9 +5,9 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
testRegex: './tests/lib/.+\\.js$',
testRegex: './tests/.+\\.test\\.ts$',
collectCoverage: false,
collectCoverageFrom: ['lib/**/*.{js,jsx,ts,tsx}'],
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
coverageReporters: ['text-summary', 'lcov']
};

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 61c60dc

Please sign in to comment.