@definitelytyped/eslint-plugin 0.0.203 → 0.0.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/configs/all.ts +0 -189
  4. package/src/index.ts +0 -18
  5. package/src/rules/expect.ts +0 -556
  6. package/src/rules/export-just-namespace.ts +0 -82
  7. package/src/rules/index.ts +0 -43
  8. package/src/rules/no-any-union.ts +0 -33
  9. package/src/rules/no-bad-reference.ts +0 -199
  10. package/src/rules/no-const-enum.ts +0 -31
  11. package/src/rules/no-dead-reference.ts +0 -47
  12. package/src/rules/no-declare-current-package.ts +0 -45
  13. package/src/rules/no-import-default-of-export-equals.ts +0 -68
  14. package/src/rules/no-import-of-dev-dependencies.ts +0 -93
  15. package/src/rules/no-old-dt-header.ts +0 -40
  16. package/src/rules/no-relative-import-in-test.ts +0 -72
  17. package/src/rules/no-self-import.ts +0 -56
  18. package/src/rules/no-single-declare-module.ts +0 -57
  19. package/src/rules/no-single-element-tuple-type.ts +0 -30
  20. package/src/rules/no-unnecessary-generics.ts +0 -119
  21. package/src/rules/no-useless-files.ts +0 -51
  22. package/src/rules/npm-naming/types.ts +0 -14
  23. package/src/rules/npm-naming.ts +0 -211
  24. package/src/rules/prefer-declare-function.ts +0 -37
  25. package/src/rules/redundant-undefined.ts +0 -61
  26. package/src/rules/strict-export-declare-modifiers.ts +0 -195
  27. package/src/suggestions.ts +0 -75
  28. package/src/util.ts +0 -138
  29. package/test/__file_snapshots__/types/expect/expect-tests.ts.lint +0 -79
  30. package/test/__file_snapshots__/types/expect/index.d.ts.lint +0 -19
  31. package/test/__file_snapshots__/types/export-just-namespace/bad1.d.ts.lint +0 -11
  32. package/test/__file_snapshots__/types/export-just-namespace/bad2.d.ts.lint +0 -11
  33. package/test/__file_snapshots__/types/export-just-namespace/bad3.d.ts.lint +0 -12
  34. package/test/__file_snapshots__/types/export-just-namespace/export-just-namespace-tests.ts.lint +0 -10
  35. package/test/__file_snapshots__/types/export-just-namespace/good1.d.ts.lint +0 -5
  36. package/test/__file_snapshots__/types/export-just-namespace/good2.d.ts.lint +0 -5
  37. package/test/__file_snapshots__/types/export-just-namespace/good3.d.ts.lint +0 -5
  38. package/test/__file_snapshots__/types/export-just-namespace/good4.d.ts.lint +0 -5
  39. package/test/__file_snapshots__/types/export-just-namespace/good5.d.ts.lint +0 -5
  40. package/test/__file_snapshots__/types/export-just-namespace/good6.d.ts.lint +0 -5
  41. package/test/__file_snapshots__/types/export-just-namespace/good7.d.ts.lint +0 -7
  42. package/test/__file_snapshots__/types/export-just-namespace/good8.d.ts.lint +0 -7
  43. package/test/__file_snapshots__/types/export-just-namespace/good9.d.ts.lint +0 -15
  44. package/test/__file_snapshots__/types/foo/foo-tests.ts.lint +0 -10
  45. package/test/__file_snapshots__/types/foo/index.d.ts.lint +0 -5
  46. package/test/__file_snapshots__/types/foo/v1/foo-tests.ts.lint +0 -10
  47. package/test/__file_snapshots__/types/foo/v1/index.d.ts.lint +0 -5
  48. package/test/__file_snapshots__/types/no-any-union/bad.d.ts.lint +0 -10
  49. package/test/__file_snapshots__/types/no-any-union/index.d.ts.lint +0 -5
  50. package/test/__file_snapshots__/types/no-any-union/no-any-union-tests.ts.lint +0 -10
  51. package/test/__file_snapshots__/types/no-bad-reference/index.d.ts.lint +0 -43
  52. package/test/__file_snapshots__/types/no-bad-reference/no-bad-reference-tests.ts.lint +0 -14
  53. package/test/__file_snapshots__/types/no-bad-reference/v0.1/index.d.ts.lint +0 -48
  54. package/test/__file_snapshots__/types/no-bad-reference/v0.1/no-bad-reference-tests.ts.lint +0 -10
  55. package/test/__file_snapshots__/types/no-bad-reference/v11/index.d.ts.lint +0 -48
  56. package/test/__file_snapshots__/types/no-bad-reference/v11/no-bad-reference-tests.ts.lint +0 -10
  57. package/test/__file_snapshots__/types/no-const-enum/bad.d.ts.lint +0 -10
  58. package/test/__file_snapshots__/types/no-const-enum/index.d.ts.lint +0 -5
  59. package/test/__file_snapshots__/types/no-const-enum/no-const-enum-tests.ts.lint +0 -10
  60. package/test/__file_snapshots__/types/no-dead-reference/bad.d.ts.lint +0 -18
  61. package/test/__file_snapshots__/types/no-dead-reference/bad2.d.ts.lint +0 -15
  62. package/test/__file_snapshots__/types/no-dead-reference/bad3.d.ts.lint +0 -17
  63. package/test/__file_snapshots__/types/no-dead-reference/index.d.ts.lint +0 -6
  64. package/test/__file_snapshots__/types/no-dead-reference/no-dead-reference-tests.ts.lint +0 -10
  65. package/test/__file_snapshots__/types/no-declare-current-package/index.d.ts.lint +0 -13
  66. package/test/__file_snapshots__/types/no-declare-current-package/no-declare-current-package-tests.ts.lint +0 -10
  67. package/test/__file_snapshots__/types/no-declare-current-package/test/deep/import.d.ts.lint +0 -13
  68. package/test/__file_snapshots__/types/no-declare-current-package-other/index.d.ts.lint +0 -6
  69. package/test/__file_snapshots__/types/no-declare-current-package-other/no-declare-current-package-other-tests.ts.lint +0 -10
  70. package/test/__file_snapshots__/types/no-import-default-of-export-equals/bad.d.ts.lint +0 -17
  71. package/test/__file_snapshots__/types/no-import-default-of-export-equals/index.d.ts.lint +0 -12
  72. package/test/__file_snapshots__/types/no-import-default-of-export-equals/no-import-default-of-export-equals-tests.ts.lint +0 -10
  73. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/bad.d.ts.lint +0 -44
  74. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/index.d.ts.lint +0 -25
  75. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts.lint +0 -39
  76. package/test/__file_snapshots__/types/no-old-dt-header/index.d.ts.lint +0 -23
  77. package/test/__file_snapshots__/types/no-old-dt-header/index2.d.ts.lint +0 -14
  78. package/test/__file_snapshots__/types/no-old-dt-header/no-old-dt-header-tests.ts.lint +0 -10
  79. package/test/__file_snapshots__/types/no-old-dt-header/ok1.ts.lint +0 -11
  80. package/test/__file_snapshots__/types/no-old-dt-header/ok2.d.ts.lint +0 -10
  81. package/test/__file_snapshots__/types/no-old-dt-header/ok3.d.ts.lint +0 -10
  82. package/test/__file_snapshots__/types/no-old-dt-header/ok4.d.ts.lint +0 -12
  83. package/test/__file_snapshots__/types/no-relative-import-in-test/abc.d.ts.lint +0 -6
  84. package/test/__file_snapshots__/types/no-relative-import-in-test/bad.d.ts.lint +0 -10
  85. package/test/__file_snapshots__/types/no-relative-import-in-test/index.d.ts.lint +0 -5
  86. package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test/abc.d.ts.lint +0 -6
  87. package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests.ts.lint +0 -10
  88. package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests2.ts.lint +0 -7
  89. package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts.lint +0 -10
  90. package/test/__file_snapshots__/types/no-relative-references/index.d.ts.lint +0 -51
  91. package/test/__file_snapshots__/types/no-relative-references/no-relative-references-tests.ts.lint +0 -10
  92. package/test/__file_snapshots__/types/no-relative-references/other/other.d.ts.lint +0 -31
  93. package/test/__file_snapshots__/types/no-relative-references/v1/index.d.ts.lint +0 -57
  94. package/test/__file_snapshots__/types/no-relative-references/v1/no-relative-references-tests.ts.lint +0 -10
  95. package/test/__file_snapshots__/types/no-relative-references/v1/other/other.d.ts.lint +0 -31
  96. package/test/__file_snapshots__/types/no-self-import/bad.d.ts.lint +0 -65
  97. package/test/__file_snapshots__/types/no-self-import/index.d.ts.lint +0 -19
  98. package/test/__file_snapshots__/types/no-self-import/no-self-import-tests.ts.lint +0 -39
  99. package/test/__file_snapshots__/types/no-single-declare-module/bad.d.ts.lint +0 -13
  100. package/test/__file_snapshots__/types/no-single-declare-module/index.d.ts.lint +0 -6
  101. package/test/__file_snapshots__/types/no-single-declare-module/index2.d.ts.lint +0 -6
  102. package/test/__file_snapshots__/types/no-single-declare-module/index3.d.ts.lint +0 -5
  103. package/test/__file_snapshots__/types/no-single-declare-module/no-single-declare-module-tests.ts.lint +0 -10
  104. package/test/__file_snapshots__/types/no-single-element-tuple-type/bad.d.ts.lint +0 -10
  105. package/test/__file_snapshots__/types/no-single-element-tuple-type/index.d.ts.lint +0 -9
  106. package/test/__file_snapshots__/types/no-single-element-tuple-type/no-single-element-tuple-type-tests.ts.lint +0 -10
  107. package/test/__file_snapshots__/types/no-unnecessary-generics/bad.d.ts.lint +0 -14
  108. package/test/__file_snapshots__/types/no-unnecessary-generics/index.d.ts.lint +0 -11
  109. package/test/__file_snapshots__/types/no-unnecessary-generics/no-unnecessary-generics-tests.ts.lint +0 -44
  110. package/test/__file_snapshots__/types/no-useless-files/bad.d.ts.lint +0 -10
  111. package/test/__file_snapshots__/types/no-useless-files/bad2.d.ts.lint +0 -10
  112. package/test/__file_snapshots__/types/no-useless-files/bad3.d.ts.lint +0 -10
  113. package/test/__file_snapshots__/types/no-useless-files/index.d.ts.lint +0 -5
  114. package/test/__file_snapshots__/types/no-useless-files/index2.d.ts.lint +0 -5
  115. package/test/__file_snapshots__/types/no-useless-files/index3.d.ts.lint +0 -5
  116. package/test/__file_snapshots__/types/no-useless-files/no-useless-files-tests.ts.lint +0 -10
  117. package/test/__file_snapshots__/types/other/index.d.ts.lint +0 -5
  118. package/test/__file_snapshots__/types/other/other-tests.ts.lint +0 -10
  119. package/test/__file_snapshots__/types/other/v1/index.d.ts.lint +0 -5
  120. package/test/__file_snapshots__/types/other/v1/other-tests.ts.lint +0 -10
  121. package/test/__file_snapshots__/types/prefer-declare-function/bad.d.ts.lint +0 -33
  122. package/test/__file_snapshots__/types/prefer-declare-function/index.d.ts.lint +0 -14
  123. package/test/__file_snapshots__/types/prefer-declare-function/prefer-declare-function-tests.ts.lint +0 -10
  124. package/test/__file_snapshots__/types/redundant-undefined/bad.d.ts.lint +0 -15
  125. package/test/__file_snapshots__/types/redundant-undefined/index.d.ts.lint +0 -9
  126. package/test/__file_snapshots__/types/redundant-undefined/redundant-undefined-tests.ts.lint +0 -10
  127. package/test/__file_snapshots__/types/scoped__foo/index.d.ts.lint +0 -5
  128. package/test/__file_snapshots__/types/scoped__foo/scoped__foo-tests.ts.lint +0 -10
  129. package/test/__file_snapshots__/types/scoped__foo/v1/index.d.ts.lint +0 -5
  130. package/test/__file_snapshots__/types/scoped__foo/v1/scoped__foo-tests.ts.lint +0 -10
  131. package/test/__file_snapshots__/types/scoped__no-declare-current-package/index.d.ts.lint +0 -13
  132. package/test/__file_snapshots__/types/scoped__no-declare-current-package/no-declare-current-package-tests.ts.lint +0 -10
  133. package/test/__file_snapshots__/types/scoped__no-declare-current-package/test/deep/import.d.ts.lint +0 -13
  134. package/test/__file_snapshots__/types/scoped__no-relative-references/index.d.ts.lint +0 -51
  135. package/test/__file_snapshots__/types/scoped__no-relative-references/no-relative-references-tests.ts.lint +0 -10
  136. package/test/__file_snapshots__/types/scoped__no-relative-references/other/other.d.ts.lint +0 -31
  137. package/test/__file_snapshots__/types/scoped__no-relative-references/v1/index.d.ts.lint +0 -57
  138. package/test/__file_snapshots__/types/scoped__no-relative-references/v1/no-relative-references-tests.ts.lint +0 -10
  139. package/test/__file_snapshots__/types/scoped__no-relative-references/v1/other/other.d.ts.lint +0 -31
  140. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad1.d.ts.lint +0 -10
  141. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad2.d.ts.lint +0 -12
  142. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad3.d.ts.lint +0 -10
  143. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad4.d.ts.lint +0 -12
  144. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad5.d.ts.lint +0 -11
  145. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad6.d.ts.lint +0 -14
  146. package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad7.d.ts.lint +0 -14
  147. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good1.ts.lint +0 -5
  148. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good2.d.ts.lint +0 -5
  149. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good3.d.ts.lint +0 -5
  150. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good4.d.ts.lint +0 -5
  151. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good5.d.ts.lint +0 -5
  152. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good6.ts.lint +0 -7
  153. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good7.d.ts.lint +0 -6
  154. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good8.d.ts.lint +0 -9
  155. package/test/__file_snapshots__/types/strict-export-declare-modifiers/good9.d.ts.lint +0 -7
  156. package/test/__file_snapshots__/types/strict-export-declare-modifiers/strict-export-declare-modifiers-tests.ts.lint +0 -10
  157. package/test/__snapshots__/plugin.test.ts.snap +0 -262
  158. package/test/eslint.test.ts +0 -134
  159. package/test/fixtures/.eslintrc.cjs +0 -4
  160. package/test/fixtures/notNeededPackages.json +0 -3
  161. package/test/fixtures/package.json +0 -4
  162. package/test/fixtures/types/expect/expect-tests.ts +0 -49
  163. package/test/fixtures/types/expect/index.d.ts +0 -9
  164. package/test/fixtures/types/expect/package.json +0 -5
  165. package/test/fixtures/types/expect/tsconfig.json +0 -20
  166. package/test/fixtures/types/export-just-namespace/bad1.d.ts +0 -2
  167. package/test/fixtures/types/export-just-namespace/bad2.d.ts +0 -2
  168. package/test/fixtures/types/export-just-namespace/bad3.d.ts +0 -3
  169. package/test/fixtures/types/export-just-namespace/export-just-namespace-tests.ts +0 -0
  170. package/test/fixtures/types/export-just-namespace/good1.d.ts +0 -1
  171. package/test/fixtures/types/export-just-namespace/good2.d.ts +0 -1
  172. package/test/fixtures/types/export-just-namespace/good3.d.ts +0 -1
  173. package/test/fixtures/types/export-just-namespace/good4.d.ts +0 -1
  174. package/test/fixtures/types/export-just-namespace/good5.d.ts +0 -1
  175. package/test/fixtures/types/export-just-namespace/good6.d.ts +0 -1
  176. package/test/fixtures/types/export-just-namespace/good7.d.ts +0 -3
  177. package/test/fixtures/types/export-just-namespace/good8.d.ts +0 -3
  178. package/test/fixtures/types/export-just-namespace/good9.d.ts +0 -3
  179. package/test/fixtures/types/export-just-namespace/package.json +0 -8
  180. package/test/fixtures/types/export-just-namespace/tsconfig.json +0 -31
  181. package/test/fixtures/types/foo/foo-tests.ts +0 -0
  182. package/test/fixtures/types/foo/index.d.ts +0 -1
  183. package/test/fixtures/types/foo/package.json +0 -5
  184. package/test/fixtures/types/foo/tsconfig.json +0 -20
  185. package/test/fixtures/types/foo/v1/foo-tests.ts +0 -0
  186. package/test/fixtures/types/foo/v1/index.d.ts +0 -1
  187. package/test/fixtures/types/foo/v1/package.json +0 -5
  188. package/test/fixtures/types/foo/v1/tsconfig.json +0 -20
  189. package/test/fixtures/types/no-any-union/bad.d.ts +0 -1
  190. package/test/fixtures/types/no-any-union/index.d.ts +0 -1
  191. package/test/fixtures/types/no-any-union/no-any-union-tests.ts +0 -1
  192. package/test/fixtures/types/no-any-union/package.json +0 -8
  193. package/test/fixtures/types/no-any-union/tsconfig.json +0 -21
  194. package/test/fixtures/types/no-bad-reference/index.d.ts +0 -16
  195. package/test/fixtures/types/no-bad-reference/no-bad-reference-tests.ts +0 -2
  196. package/test/fixtures/types/no-bad-reference/package.json +0 -5
  197. package/test/fixtures/types/no-bad-reference/tsconfig.json +0 -20
  198. package/test/fixtures/types/no-bad-reference/v0.1/index.d.ts +0 -15
  199. package/test/fixtures/types/no-bad-reference/v0.1/no-bad-reference-tests.ts +0 -0
  200. package/test/fixtures/types/no-bad-reference/v0.1/package.json +0 -5
  201. package/test/fixtures/types/no-bad-reference/v0.1/tsconfig.json +0 -20
  202. package/test/fixtures/types/no-bad-reference/v11/index.d.ts +0 -15
  203. package/test/fixtures/types/no-bad-reference/v11/no-bad-reference-tests.ts +0 -0
  204. package/test/fixtures/types/no-bad-reference/v11/package.json +0 -5
  205. package/test/fixtures/types/no-bad-reference/v11/tsconfig.json +0 -20
  206. package/test/fixtures/types/no-const-enum/bad.d.ts +0 -1
  207. package/test/fixtures/types/no-const-enum/index.d.ts +0 -1
  208. package/test/fixtures/types/no-const-enum/no-const-enum-tests.ts +0 -0
  209. package/test/fixtures/types/no-const-enum/package.json +0 -8
  210. package/test/fixtures/types/no-const-enum/tsconfig.json +0 -21
  211. package/test/fixtures/types/no-dead-reference/bad.d.ts +0 -6
  212. package/test/fixtures/types/no-dead-reference/bad2.d.ts +0 -3
  213. package/test/fixtures/types/no-dead-reference/bad3.d.ts +0 -5
  214. package/test/fixtures/types/no-dead-reference/index.d.ts +0 -2
  215. package/test/fixtures/types/no-dead-reference/no-dead-reference-tests.ts +0 -0
  216. package/test/fixtures/types/no-dead-reference/package.json +0 -8
  217. package/test/fixtures/types/no-dead-reference/tsconfig.json +0 -23
  218. package/test/fixtures/types/no-declare-current-package/index.d.ts +0 -1
  219. package/test/fixtures/types/no-declare-current-package/no-declare-current-package-tests.ts +0 -0
  220. package/test/fixtures/types/no-declare-current-package/package.json +0 -8
  221. package/test/fixtures/types/no-declare-current-package/test/deep/import.d.ts +0 -1
  222. package/test/fixtures/types/no-declare-current-package/tsconfig.json +0 -21
  223. package/test/fixtures/types/no-declare-current-package-other/index.d.ts +0 -2
  224. package/test/fixtures/types/no-declare-current-package-other/no-declare-current-package-other-tests.ts +0 -0
  225. package/test/fixtures/types/no-declare-current-package-other/package.json +0 -8
  226. package/test/fixtures/types/no-declare-current-package-other/tsconfig.json +0 -20
  227. package/test/fixtures/types/no-import-default-of-export-equals/bad.d.ts +0 -8
  228. package/test/fixtures/types/no-import-default-of-export-equals/index.d.ts +0 -8
  229. package/test/fixtures/types/no-import-default-of-export-equals/no-import-default-of-export-equals-tests.ts +0 -0
  230. package/test/fixtures/types/no-import-default-of-export-equals/package.json +0 -8
  231. package/test/fixtures/types/no-import-default-of-export-equals/tsconfig.json +0 -21
  232. package/test/fixtures/types/no-import-of-dev-dependencies/bad.d.ts +0 -8
  233. package/test/fixtures/types/no-import-of-dev-dependencies/index.d.ts +0 -7
  234. package/test/fixtures/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts +0 -15
  235. package/test/fixtures/types/no-import-of-dev-dependencies/package.json +0 -14
  236. package/test/fixtures/types/no-import-of-dev-dependencies/tsconfig.json +0 -21
  237. package/test/fixtures/types/no-old-dt-header/index.d.ts +0 -14
  238. package/test/fixtures/types/no-old-dt-header/index2.d.ts +0 -2
  239. package/test/fixtures/types/no-old-dt-header/no-old-dt-header-tests.ts +0 -0
  240. package/test/fixtures/types/no-old-dt-header/ok1.ts +0 -2
  241. package/test/fixtures/types/no-old-dt-header/ok2.d.ts +0 -1
  242. package/test/fixtures/types/no-old-dt-header/ok3.d.ts +0 -1
  243. package/test/fixtures/types/no-old-dt-header/ok4.d.ts +0 -3
  244. package/test/fixtures/types/no-old-dt-header/package.json +0 -8
  245. package/test/fixtures/types/no-old-dt-header/tsconfig.json +0 -25
  246. package/test/fixtures/types/no-relative-import-in-test/abc.d.ts +0 -2
  247. package/test/fixtures/types/no-relative-import-in-test/bad.d.ts +0 -0
  248. package/test/fixtures/types/no-relative-import-in-test/index.d.ts +0 -1
  249. package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test/abc.d.ts +0 -2
  250. package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests.ts +0 -1
  251. package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests2.ts +0 -3
  252. package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts +0 -1
  253. package/test/fixtures/types/no-relative-import-in-test/package.json +0 -8
  254. package/test/fixtures/types/no-relative-import-in-test/tsconfig.json +0 -25
  255. package/test/fixtures/types/no-relative-references/index.d.ts +0 -12
  256. package/test/fixtures/types/no-relative-references/no-relative-references-tests.ts +0 -0
  257. package/test/fixtures/types/no-relative-references/other/other.d.ts +0 -7
  258. package/test/fixtures/types/no-relative-references/package.json +0 -5
  259. package/test/fixtures/types/no-relative-references/tsconfig.json +0 -21
  260. package/test/fixtures/types/no-relative-references/v1/index.d.ts +0 -15
  261. package/test/fixtures/types/no-relative-references/v1/no-relative-references-tests.ts +0 -0
  262. package/test/fixtures/types/no-relative-references/v1/other/other.d.ts +0 -7
  263. package/test/fixtures/types/no-relative-references/v1/package.json +0 -5
  264. package/test/fixtures/types/no-relative-references/v1/tsconfig.json +0 -21
  265. package/test/fixtures/types/no-self-import/bad.d.ts +0 -17
  266. package/test/fixtures/types/no-self-import/index.d.ts +0 -15
  267. package/test/fixtures/types/no-self-import/no-self-import-tests.ts +0 -15
  268. package/test/fixtures/types/no-self-import/package.json +0 -11
  269. package/test/fixtures/types/no-self-import/tsconfig.json +0 -21
  270. package/test/fixtures/types/no-single-declare-module/bad.d.ts +0 -4
  271. package/test/fixtures/types/no-single-declare-module/index.d.ts +0 -2
  272. package/test/fixtures/types/no-single-declare-module/index2.d.ts +0 -2
  273. package/test/fixtures/types/no-single-declare-module/index3.d.ts +0 -1
  274. package/test/fixtures/types/no-single-declare-module/no-single-declare-module-tests.ts +0 -0
  275. package/test/fixtures/types/no-single-declare-module/package.json +0 -8
  276. package/test/fixtures/types/no-single-declare-module/tsconfig.json +0 -23
  277. package/test/fixtures/types/no-single-element-tuple-type/bad.d.ts +0 -1
  278. package/test/fixtures/types/no-single-element-tuple-type/index.d.ts +0 -5
  279. package/test/fixtures/types/no-single-element-tuple-type/no-single-element-tuple-type-tests.ts +0 -0
  280. package/test/fixtures/types/no-single-element-tuple-type/package.json +0 -8
  281. package/test/fixtures/types/no-single-element-tuple-type/tsconfig.json +0 -21
  282. package/test/fixtures/types/no-unnecessary-generics/bad.d.ts +0 -2
  283. package/test/fixtures/types/no-unnecessary-generics/index.d.ts +0 -7
  284. package/test/fixtures/types/no-unnecessary-generics/no-unnecessary-generics-tests.ts +0 -14
  285. package/test/fixtures/types/no-unnecessary-generics/package.json +0 -8
  286. package/test/fixtures/types/no-unnecessary-generics/tsconfig.json +0 -21
  287. package/test/fixtures/types/no-useless-files/bad.d.ts +0 -1
  288. package/test/fixtures/types/no-useless-files/bad2.d.ts +0 -0
  289. package/test/fixtures/types/no-useless-files/bad3.d.ts +0 -1
  290. package/test/fixtures/types/no-useless-files/index.d.ts +0 -1
  291. package/test/fixtures/types/no-useless-files/index2.d.ts +0 -1
  292. package/test/fixtures/types/no-useless-files/index3.d.ts +0 -1
  293. package/test/fixtures/types/no-useless-files/no-useless-files-tests.ts +0 -0
  294. package/test/fixtures/types/no-useless-files/package.json +0 -8
  295. package/test/fixtures/types/no-useless-files/tsconfig.json +0 -25
  296. package/test/fixtures/types/other/index.d.ts +0 -1
  297. package/test/fixtures/types/other/other-tests.ts +0 -0
  298. package/test/fixtures/types/other/package.json +0 -5
  299. package/test/fixtures/types/other/tsconfig.json +0 -20
  300. package/test/fixtures/types/other/v1/index.d.ts +0 -1
  301. package/test/fixtures/types/other/v1/other-tests.ts +0 -0
  302. package/test/fixtures/types/other/v1/package.json +0 -5
  303. package/test/fixtures/types/other/v1/tsconfig.json +0 -20
  304. package/test/fixtures/types/prefer-declare-function/bad.d.ts +0 -9
  305. package/test/fixtures/types/prefer-declare-function/index.d.ts +0 -2
  306. package/test/fixtures/types/prefer-declare-function/package.json +0 -8
  307. package/test/fixtures/types/prefer-declare-function/prefer-declare-function-tests.ts +0 -0
  308. package/test/fixtures/types/prefer-declare-function/tsconfig.json +0 -21
  309. package/test/fixtures/types/redundant-undefined/bad.d.ts +0 -3
  310. package/test/fixtures/types/redundant-undefined/index.d.ts +0 -5
  311. package/test/fixtures/types/redundant-undefined/package.json +0 -8
  312. package/test/fixtures/types/redundant-undefined/redundant-undefined-tests.ts +0 -1
  313. package/test/fixtures/types/redundant-undefined/tsconfig.json +0 -21
  314. package/test/fixtures/types/scoped__foo/index.d.ts +0 -1
  315. package/test/fixtures/types/scoped__foo/package.json +0 -5
  316. package/test/fixtures/types/scoped__foo/scoped__foo-tests.ts +0 -0
  317. package/test/fixtures/types/scoped__foo/tsconfig.json +0 -20
  318. package/test/fixtures/types/scoped__foo/v1/index.d.ts +0 -1
  319. package/test/fixtures/types/scoped__foo/v1/package.json +0 -5
  320. package/test/fixtures/types/scoped__foo/v1/scoped__foo-tests.ts +0 -0
  321. package/test/fixtures/types/scoped__foo/v1/tsconfig.json +0 -20
  322. package/test/fixtures/types/scoped__no-declare-current-package/index.d.ts +0 -1
  323. package/test/fixtures/types/scoped__no-declare-current-package/no-declare-current-package-tests.ts +0 -0
  324. package/test/fixtures/types/scoped__no-declare-current-package/package.json +0 -8
  325. package/test/fixtures/types/scoped__no-declare-current-package/test/deep/import.d.ts +0 -1
  326. package/test/fixtures/types/scoped__no-declare-current-package/tsconfig.json +0 -21
  327. package/test/fixtures/types/scoped__no-relative-references/index.d.ts +0 -12
  328. package/test/fixtures/types/scoped__no-relative-references/no-relative-references-tests.ts +0 -0
  329. package/test/fixtures/types/scoped__no-relative-references/other/other.d.ts +0 -7
  330. package/test/fixtures/types/scoped__no-relative-references/package.json +0 -5
  331. package/test/fixtures/types/scoped__no-relative-references/tsconfig.json +0 -21
  332. package/test/fixtures/types/scoped__no-relative-references/v1/index.d.ts +0 -15
  333. package/test/fixtures/types/scoped__no-relative-references/v1/no-relative-references-tests.ts +0 -0
  334. package/test/fixtures/types/scoped__no-relative-references/v1/other/other.d.ts +0 -7
  335. package/test/fixtures/types/scoped__no-relative-references/v1/package.json +0 -5
  336. package/test/fixtures/types/scoped__no-relative-references/v1/tsconfig.json +0 -21
  337. package/test/fixtures/types/strict-export-declare-modifiers/bad1.d.ts +0 -1
  338. package/test/fixtures/types/strict-export-declare-modifiers/bad2.d.ts +0 -3
  339. package/test/fixtures/types/strict-export-declare-modifiers/bad3.d.ts +0 -1
  340. package/test/fixtures/types/strict-export-declare-modifiers/bad4.d.ts +0 -3
  341. package/test/fixtures/types/strict-export-declare-modifiers/bad5.d.ts +0 -2
  342. package/test/fixtures/types/strict-export-declare-modifiers/bad6.d.ts +0 -2
  343. package/test/fixtures/types/strict-export-declare-modifiers/bad7.d.ts +0 -2
  344. package/test/fixtures/types/strict-export-declare-modifiers/good1.ts +0 -1
  345. package/test/fixtures/types/strict-export-declare-modifiers/good2.d.ts +0 -1
  346. package/test/fixtures/types/strict-export-declare-modifiers/good3.d.ts +0 -1
  347. package/test/fixtures/types/strict-export-declare-modifiers/good4.d.ts +0 -1
  348. package/test/fixtures/types/strict-export-declare-modifiers/good5.d.ts +0 -1
  349. package/test/fixtures/types/strict-export-declare-modifiers/good6.ts +0 -3
  350. package/test/fixtures/types/strict-export-declare-modifiers/good7.d.ts +0 -2
  351. package/test/fixtures/types/strict-export-declare-modifiers/good8.d.ts +0 -5
  352. package/test/fixtures/types/strict-export-declare-modifiers/good9.d.ts +0 -3
  353. package/test/fixtures/types/strict-export-declare-modifiers/package.json +0 -8
  354. package/test/fixtures/types/strict-export-declare-modifiers/strict-export-declare-modifiers-tests.ts +0 -0
  355. package/test/fixtures/types/strict-export-declare-modifiers/tsconfig.json +0 -35
  356. package/test/npm-naming.test.ts +0 -57
  357. package/test/plugin.test.ts +0 -14
  358. package/test/tsconfig.json +0 -13
  359. package/test/types/dts-critic/index.d.ts +0 -9
  360. package/test/types/dts-critic/package.json +0 -17
  361. package/test/types/wenceslas/index.d.ts +0 -0
  362. package/test/types/wenceslas/package.json +0 -17
  363. package/test/util.test.ts +0 -40
  364. package/test/util.ts +0 -3
  365. package/tsconfig.json +0 -11
  366. package/tsconfig.tsbuildinfo +0 -1
@@ -1,195 +0,0 @@
1
- import { ESLintUtils } from "@typescript-eslint/utils";
2
- import * as ts from "typescript";
3
- import { createRule } from "../util";
4
-
5
- const rule = createRule({
6
- name: "strict-export-declare-modifiers",
7
- defaultOptions: [],
8
- meta: {
9
- type: "problem",
10
- docs: {
11
- description: "Enforces strict rules about where the 'export' and 'declare' modifiers may appear.",
12
- },
13
- messages: {
14
- missingExplicitExport:
15
- "All declarations in this module are exported automatically. " +
16
- "Prefer to explicitly write 'export' for clarity. " +
17
- "If you have a good reason not to export this declaration, " +
18
- "add 'export {}' to the module to shut off automatic exporting.",
19
- redundantDeclare: "'declare' keyword is redundant here.",
20
- redundantExport:
21
- "'export' keyword is redundant here because " +
22
- "all declarations in this module are exported automatically. " +
23
- "If you have a good reason to export some declarations and not others, " +
24
- "add 'export {}' to the module to shut off automatic exporting.",
25
- },
26
- schema: [],
27
- },
28
- // TODO: This code is a modified version of the old TSLint rule,
29
- // and still primarily uses TypeScript nodes. It would be better
30
- // to switch it to using TSESTree nodes like other ESLint rules.
31
- create(context) {
32
- const services = ESLintUtils.getParserServices(context, true);
33
- const sourceCode = context.sourceCode;
34
- const sourceFile = services.esTreeNodeToTSNodeMap.get(sourceCode.ast);
35
-
36
- const isExternal =
37
- sourceFile.isDeclarationFile &&
38
- !sourceFile.statements.some(
39
- (s) =>
40
- s.kind === ts.SyntaxKind.ExportAssignment ||
41
- (s.kind === ts.SyntaxKind.ExportDeclaration && !!(s as ts.ExportDeclaration).exportClause),
42
- ) &&
43
- ts.isExternalModule(sourceFile);
44
-
45
- for (const node of sourceFile.statements) {
46
- if (isExternal) {
47
- checkInExternalModule(node, isAutomaticExport(sourceFile));
48
- } else {
49
- checkInOther(node, sourceFile.isDeclarationFile);
50
- }
51
-
52
- if (isModuleDeclaration(node) && (sourceFile.isDeclarationFile || isDeclare(node))) {
53
- checkModule(node);
54
- }
55
- }
56
-
57
- function checkInExternalModule(node: ts.Statement, autoExportEnabled: boolean) {
58
- // Ignore certain node kinds (these can't have 'export' or 'default' modifiers)
59
- switch (node.kind) {
60
- case ts.SyntaxKind.ImportDeclaration:
61
- case ts.SyntaxKind.ImportEqualsDeclaration:
62
- case ts.SyntaxKind.ExportDeclaration:
63
- case ts.SyntaxKind.NamespaceExportDeclaration:
64
- return;
65
- }
66
-
67
- // `declare global` and `declare module "foo"` OK. `declare namespace N` not OK, should be `export namespace`.
68
- if (!isDeclareGlobalOrExternalModuleDeclaration(node)) {
69
- if (isDeclare(node)) {
70
- context.report({
71
- loc: getModifierLoc(node as ts.HasModifiers, ts.SyntaxKind.DeclareKeyword)!,
72
- messageId: "redundantDeclare",
73
- });
74
- }
75
- if (autoExportEnabled && !isExport(node)) {
76
- const n = (node as ts.DeclarationStatement).name || node;
77
- context.report({
78
- messageId: "missingExplicitExport",
79
- loc: {
80
- end: sourceCode.getLocFromIndex(n.end),
81
- start: sourceCode.getLocFromIndex(n.getStart(sourceFile)),
82
- },
83
- });
84
- }
85
- }
86
- }
87
-
88
- function checkInOther(node: ts.Statement, inDeclarationFile: boolean): void {
89
- // Compiler will enforce presence of 'declare' where necessary. But types do not need 'declare'.
90
- if (isDeclare(node)) {
91
- if (
92
- (isExport(node) && inDeclarationFile) ||
93
- ts.isInterfaceDeclaration(node) ||
94
- ts.isTypeAliasDeclaration(node)
95
- ) {
96
- context.report({
97
- loc: getModifierLoc(node as ts.HasModifiers, ts.SyntaxKind.DeclareKeyword),
98
- messageId: "redundantDeclare",
99
- });
100
- }
101
- }
102
- }
103
-
104
- function getModifierLoc(node: ts.HasModifiers, kind: ts.SyntaxKind) {
105
- const modifier = ts.getModifiers(node)?.find((modifier) => modifier.kind === kind)!;
106
-
107
- return {
108
- end: sourceCode.getLocFromIndex(modifier.end),
109
- start: sourceCode.getLocFromIndex(modifier.getStart(sourceFile)),
110
- };
111
- }
112
-
113
- function checkModule(moduleDeclaration: ts.ModuleDeclaration): void {
114
- const body = moduleDeclaration.body;
115
- if (!body) {
116
- return;
117
- }
118
-
119
- switch (body.kind) {
120
- case ts.SyntaxKind.ModuleDeclaration:
121
- checkModule(body);
122
- break;
123
- case ts.SyntaxKind.ModuleBlock:
124
- checkBlock(body, isAutomaticExport(moduleDeclaration));
125
- break;
126
- }
127
- }
128
-
129
- function checkBlock(block: ts.ModuleBlock, autoExportEnabled: boolean): void {
130
- for (const statement of block.statements) {
131
- // Compiler will error for 'declare' here anyway, so just check for 'export'.
132
- if (isExport(statement) && autoExportEnabled && !isDefault(statement)) {
133
- context.report({
134
- loc: getModifierLoc(statement as ts.HasModifiers, ts.SyntaxKind.ExportKeyword),
135
- messageId: "redundantExport",
136
- });
137
- }
138
-
139
- if (isModuleDeclaration(statement)) {
140
- checkModule(statement);
141
- }
142
- }
143
- }
144
-
145
- return {};
146
- },
147
- });
148
-
149
- function isDeclareGlobalOrExternalModuleDeclaration(node: ts.Node): boolean {
150
- return (
151
- isModuleDeclaration(node) &&
152
- (node.name.kind === ts.SyntaxKind.StringLiteral ||
153
- (node.name.kind === ts.SyntaxKind.Identifier && node.name.text === "global"))
154
- );
155
- }
156
-
157
- function isModuleDeclaration(node: ts.Node): node is ts.ModuleDeclaration {
158
- return node.kind === ts.SyntaxKind.ModuleDeclaration;
159
- }
160
-
161
- function isDeclare(node: ts.Node): boolean {
162
- return ts.canHaveModifiers(node) && !!ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.DeclareKeyword);
163
- }
164
-
165
- function isExport(node: ts.Node): boolean {
166
- return ts.canHaveModifiers(node) && !!ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
167
- }
168
-
169
- function isDefault(node: ts.Node): boolean {
170
- return ts.canHaveModifiers(node) && !!ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
171
- }
172
-
173
- // Copied from https://github.com/Microsoft/TypeScript/blob/dd9b8cab34a3e389e924d768eb656cf50656f582/src/compiler/binder.ts#L1571-L1581
174
- function hasExportDeclarations(node: ts.SourceFile | ts.ModuleDeclaration): boolean {
175
- const body = node.kind === ts.SyntaxKind.SourceFile ? node : node.body;
176
- if (body && (body.kind === ts.SyntaxKind.SourceFile || body.kind === ts.SyntaxKind.ModuleBlock)) {
177
- for (const stat of (body as ts.BlockLike).statements) {
178
- if (stat.kind === ts.SyntaxKind.ExportDeclaration || stat.kind === ts.SyntaxKind.ExportAssignment) {
179
- return true;
180
- }
181
- }
182
- }
183
- return false;
184
- }
185
-
186
- function isAutomaticExport(node: ts.SourceFile | ts.ModuleDeclaration): boolean {
187
- // We'd like to just test ts.NodeFlags.ExportContext, but we don't run the
188
- // binder, so that flag won't be set, so duplicate the logic instead. :(
189
- //
190
- // ts.NodeFlags.Ambient is @internal, but all modules that get here should
191
- // be ambient.
192
- return !hasExportDeclarations(node);
193
- }
194
-
195
- export = rule;
@@ -1,75 +0,0 @@
1
- import fs = require("fs");
2
- import os = require("os");
3
- import path = require("path");
4
-
5
- const suggestionsDir = path.join(os.homedir(), ".dts", "suggestions");
6
-
7
- interface Suggestion {
8
- fileName: string;
9
- ruleName: string;
10
- message: string;
11
- start?: number;
12
- width?: number;
13
- }
14
-
15
- // Packages for which suggestions were already added in this run of dtslint.
16
- const existingPackages = new Set();
17
-
18
- /**
19
- * A rule should call this function to provide a suggestion instead of a lint failure.
20
- */
21
- export function addSuggestion(fileName: string, ruleName: string, message: string, start?: number, width?: number) {
22
- const suggestion: Suggestion = {
23
- fileName,
24
- ruleName,
25
- message,
26
- start,
27
- width,
28
- };
29
-
30
- const packageName = dtPackageName(fileName);
31
- if (!packageName) {
32
- return;
33
- }
34
- let flag = "a";
35
- if (!existingPackages.has(packageName)) {
36
- flag = "w";
37
- existingPackages.add(packageName);
38
- }
39
- try {
40
- if (!fs.existsSync(suggestionsDir)) {
41
- fs.mkdirSync(suggestionsDir, { recursive: true });
42
- }
43
- fs.writeFileSync(
44
- path.join(suggestionsDir, packageName + ".txt"),
45
- flag === "a" ? "\n" + formatSuggestion(suggestion) : formatSuggestion(suggestion),
46
- { flag, encoding: "utf8" },
47
- );
48
- } catch (e) {
49
- console.log(`Could not write suggestions for package ${packageName}. ${(e as Error).message || ""}`);
50
- }
51
- }
52
-
53
- const dtPath = path.join("DefinitelyTyped", "types");
54
-
55
- function dtPackageName(filePath: string): string | undefined {
56
- const dtIndex = filePath.indexOf(dtPath);
57
- if (dtIndex === -1) {
58
- return undefined;
59
- }
60
- const basePath = filePath.substr(dtIndex + dtPath.length);
61
- const dirs = basePath.split(path.sep).filter((dir) => dir !== "");
62
- if (dirs.length === 0) {
63
- return undefined;
64
- }
65
- const packageName = dirs[0];
66
- // Check if this is an old version of a package.
67
- if (dirs.length > 1 && /^v\d+(\.\d+)?$/.test(dirs[1])) {
68
- return packageName + dirs[1];
69
- }
70
- return packageName;
71
- }
72
-
73
- function formatSuggestion(suggestion: Suggestion): string {
74
- return JSON.stringify(suggestion, /*replacer*/ undefined, 0);
75
- }
package/src/util.ts DELETED
@@ -1,138 +0,0 @@
1
- import { isDeclarationPath, typesPackageNameToRealName } from "@definitelytyped/utils";
2
- import { TSESLint, TSESTree, ESLintUtils } from "@typescript-eslint/utils";
3
- import path from "path";
4
- import fs from "fs";
5
-
6
- // Possible TS bug can't figure out how to do declaration emit of created rules
7
- // without an explicit type annotation here due to pnpm symlink stuff
8
- export type RuleModule<TOptions extends readonly unknown[], TMessageIds extends string> = TSESLint.RuleModule<
9
- TMessageIds,
10
- TOptions
11
- >;
12
-
13
- export const createRule: <TOptions extends readonly unknown[], TMessageIds extends string>(
14
- opts: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds>>,
15
- ) => RuleModule<TOptions, TMessageIds> = ESLintUtils.RuleCreator(
16
- (name) => `https://github.com/microsoft/DefinitelyTyped-tools/tree/main/packages/eslint-plugin/docs/rules/${name}.md`,
17
- );
18
-
19
- export function getTypesPackageForDeclarationFile(file: string) {
20
- if (!isDeclarationPath(file)) {
21
- return undefined;
22
- }
23
- return findTypesPackage(file)?.realName;
24
- }
25
-
26
- export function commentsMatching(
27
- sourceFile: Readonly<TSESLint.SourceCode>,
28
- regex: RegExp,
29
- f: (match: string, c: TSESTree.Comment) => void,
30
- ): void {
31
- for (const comment of sourceFile.ast.comments) {
32
- const m = comment.value.match(regex);
33
- if (m) f(m[1], comment);
34
- }
35
- }
36
-
37
- export function findUp<T extends {}>(p: string, fn: (p: string) => T | undefined): T | undefined {
38
- p = path.resolve(p);
39
- const root = path.parse(p).root;
40
-
41
- while (true) {
42
- const v = fn(p);
43
- if (v !== undefined) {
44
- return v;
45
- }
46
- if (p === root) {
47
- break;
48
- }
49
- p = path.dirname(p);
50
- }
51
-
52
- return undefined;
53
- }
54
-
55
- export interface TypesPackageInfo {
56
- dir: string;
57
- /** package.json with name="@types/foo__bar-baz" */
58
- packageJson: PackageJSON;
59
- /** real package name being typed, like "@foo/bar-baz" */
60
- realName: string;
61
- }
62
-
63
- export interface PackageJSON {
64
- name: string;
65
- version: string;
66
- owners: string[];
67
- dependencies?: Record<string, string | undefined>;
68
- devDependencies?: Record<string, string | undefined>;
69
- }
70
-
71
- // TODO(jakebailey): pull this helper out to util package?
72
- function isTypesPackage(packageJson: Partial<PackageJSON>): boolean {
73
- return (
74
- typeof packageJson.name === "string" &&
75
- packageJson.name.startsWith("@types/") &&
76
- typeof packageJson.version === "string" &&
77
- Array.isArray(packageJson.owners)
78
- );
79
- }
80
-
81
- export function findTypesPackage(file: string): TypesPackageInfo | undefined {
82
- return findUp(file, (p) => {
83
- const packageJsonPath = path.join(p, "package.json");
84
- if (!fs.existsSync(packageJsonPath)) {
85
- return undefined;
86
- }
87
-
88
- const packageJsonContents = fs.readFileSync(packageJsonPath, "utf8");
89
- const packageJson = JSON.parse(packageJsonContents);
90
- if (!isTypesPackage(packageJson)) {
91
- return undefined;
92
- }
93
- return {
94
- dir: p,
95
- packageJson,
96
- realName: typesPackageNameToRealName(packageJson.name),
97
- };
98
- });
99
- }
100
-
101
- export function getImportSource(
102
- node: TSESTree.ImportDeclaration | TSESTree.TSImportEqualsDeclaration,
103
- ): TSESTree.StringLiteral | undefined {
104
- if (node.type === "ImportDeclaration") {
105
- return node.source;
106
- }
107
-
108
- if (
109
- node.moduleReference.type === "TSExternalModuleReference" &&
110
- node.moduleReference.expression.type === "Literal" &&
111
- typeof node.moduleReference.expression.value === "string"
112
- ) {
113
- return node.moduleReference.expression;
114
- }
115
-
116
- return undefined;
117
- }
118
-
119
- export function isMainFile(fileName: string, allowNested: boolean) {
120
- // Linter may be run with cwd of the package. We want `index.d.ts` but not `submodule/index.d.ts` to match.
121
- if (fileName === "index.d.ts") {
122
- return true;
123
- }
124
-
125
- if (path.basename(fileName) !== "index.d.ts") {
126
- return false;
127
- }
128
-
129
- let parent = path.dirname(fileName);
130
- // May be a directory for an older version, e.g. `v0`.
131
- // Note a types redirect `foo/ts3.1` should not have its own header.
132
- if (allowNested && /^v(0\.)?\d+$/.test(path.basename(parent))) {
133
- parent = path.dirname(parent);
134
- }
135
-
136
- // Allow "types/foo/index.d.ts", not "types/foo/utils/index.d.ts"
137
- return path.basename(path.dirname(parent)) === "types";
138
- }
@@ -1,79 +0,0 @@
1
- types/expect/expect-tests.ts
2
- 6:1 error TypeScript expected type to be:
3
- number
4
- got:
5
- 1234 @definitelytyped/expect
6
- 14:1 error TypeScript expected type to be:
7
- NotRightAtAll
8
- got:
9
- 1234 @definitelytyped/expect
10
- 45:1 error Cannot match a node to this assertion. If this is a multiline function call, ensure the assertion is on the line above @definitelytyped/expect
11
- 49:1 error Cannot match a node to this assertion. If this is a multiline function call, ensure the assertion is on the line above @definitelytyped/expect
12
-
13
- ✖ 4 problems (4 errors, 0 warnings)
14
-
15
- ==== types/expect/expect-tests.ts ====
16
-
17
- // eslint-disable-next-line @definitelytyped/no-relative-import-in-test
18
- import * as expect from "./";
19
-
20
-
21
- // $ExpectType number
22
- expect.foo;
23
- ~~~~~~~~~~
24
- !!! @definitelytyped/expect: TypeScript expected type to be:
25
- !!! : number
26
- !!! : got:
27
- !!! : 1234
28
-
29
-
30
- // $ExpectType 1234
31
- expect.foo;
32
-
33
-
34
- // $ExpectType NotRightAtAll
35
- expect.foo;
36
- ~~~~~~~~~~
37
- !!! @definitelytyped/expect: TypeScript expected type to be:
38
- !!! : NotRightAtAll
39
- !!! : got:
40
- !!! : 1234
41
-
42
-
43
- // $ExpectType string | number | undefined
44
- expect.aUnion;
45
-
46
- // $ExpectType string | undefined | number
47
- expect.aUnion;
48
-
49
- // $ExpectType number | string | undefined
50
- expect.aUnion;
51
-
52
- // $ExpectType number | undefined | string
53
- expect.aUnion;
54
-
55
- // $ExpectType undefined | string | number
56
- expect.aUnion;
57
-
58
- // $ExpectType undefined | number | string
59
- expect.aUnion;
60
-
61
- // $ExpectType any || undefined | number | string
62
- expect.aUnion;
63
-
64
- // $ExpectType { prop1: "a" | "b" | "c"; prop2: readonly (string | number)[]; prop3: readonly (string | number)[]; }
65
- expect.complicatedUnion(1, 2);
66
-
67
- // $ExpectType { prop1: "c" | "b" | "a"; prop2: ReadonlyArray<number | string>; prop3: ReadonlyArray<string | number>; }
68
- expect.complicatedUnion(1, 2);
69
-
70
-
71
- // $ExpectType NotMatched
72
- ~~~~~~~~~~~~~~~~~~~~~~~~~
73
- !!! @definitelytyped/expect: Cannot match a node to this assertion. If this is a multiline function call, ensure the assertion is on the line above.
74
- // Whoops
75
-
76
-
77
- // $ExpectType NotMatched
78
- ~~~~~~~~~~~~~~~~~~~~~~~~~
79
- !!! @definitelytyped/expect: Cannot match a node to this assertion. If this is a multiline function call, ensure the assertion is on the line above.
@@ -1,19 +0,0 @@
1
- types/expect/index.d.ts
2
- 7:12 error Array type using 'readonly T[]' is forbidden for non-simple types. Use 'ReadonlyArray<T>' instead @typescript-eslint/array-type
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
- 1 error and 0 warnings potentially fixable with the `--fix` option.
6
-
7
- ==== types/expect/index.d.ts ====
8
-
9
- export const foo = 1234;
10
-
11
- export const aUnion: string | number | undefined;
12
-
13
- export function complicatedUnion<T extends string | number>(x: T, y: T): {
14
- prop1: "a" | "b" | "c";
15
- prop2: readonly (string | number)[];
16
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
- !!! @typescript-eslint/array-type: Array type using 'readonly T[]' is forbidden for non-simple types. Use 'ReadonlyArray<T>' instead.
18
- prop3: ReadonlyArray<string | number>;
19
- };
@@ -1,11 +0,0 @@
1
- types/export-just-namespace/bad1.d.ts
2
- 1:1 error Instead of `export =`-ing a namespace, use the body of the namespace as the module body @definitelytyped/export-just-namespace
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/export-just-namespace/bad1.d.ts ====
7
-
8
- export = Stuff;
9
- ~~~~~~~~~~~~~~~
10
- !!! @definitelytyped/export-just-namespace: Instead of `export =`-ing a namespace, use the body of the namespace as the module body.
11
- namespace Stuff {}
@@ -1,11 +0,0 @@
1
- types/export-just-namespace/bad2.d.ts
2
- 2:1 error Instead of `export =`-ing a namespace, use the body of the namespace as the module body @definitelytyped/export-just-namespace
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/export-just-namespace/bad2.d.ts ====
7
-
8
- namespace Stuff {}
9
- export = Stuff;
10
- ~~~~~~~~~~~~~~~
11
- !!! @definitelytyped/export-just-namespace: Instead of `export =`-ing a namespace, use the body of the namespace as the module body.
@@ -1,12 +0,0 @@
1
- types/export-just-namespace/bad3.d.ts
2
- 3:1 error Instead of `export =`-ing a namespace, use the body of the namespace as the module body @definitelytyped/export-just-namespace
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/export-just-namespace/bad3.d.ts ====
7
-
8
- namespace Stuff {}
9
- const other = "code";
10
- export = Stuff;
11
- ~~~~~~~~~~~~~~~
12
- !!! @definitelytyped/export-just-namespace: Instead of `export =`-ing a namespace, use the body of the namespace as the module body.
@@ -1,10 +0,0 @@
1
- types/export-just-namespace/export-just-namespace-tests.ts
2
- 1:1 error File has no content @definitelytyped/no-useless-files
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/export-just-namespace/export-just-namespace-tests.ts ====
7
-
8
-
9
- ~
10
- !!! @definitelytyped/no-useless-files: File has no content.
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good1.d.ts ====
4
-
5
- export const value = 3;
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good2.d.ts ====
4
-
5
- export default class Hello {}
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good3.d.ts ====
4
-
5
- import * as fs from "fs";
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good4.d.ts ====
4
-
5
- const value = 123;
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good5.d.ts ====
4
-
5
- export = stuff;
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good6.d.ts ====
4
-
5
- export = createStuff();
@@ -1,7 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good7.d.ts ====
4
-
5
- class Stuff {}
6
- namespace Stuff {}
7
- export = Stuff;
@@ -1,7 +0,0 @@
1
- No errors
2
-
3
- ==== types/export-just-namespace/good8.d.ts ====
4
-
5
- export = First
6
- namespace First {}
7
- declare function First()
@@ -1,15 +0,0 @@
1
- types/export-just-namespace/good9.d.ts
2
- 3:25 error Type parameter U is used only once @definitelytyped/no-unnecessary-generics
3
- 3:28 error Type parameter S is used only once @definitelytyped/no-unnecessary-generics
4
-
5
- ✖ 2 problems (2 errors, 0 warnings)
6
-
7
- ==== types/export-just-namespace/good9.d.ts ====
8
-
9
- declare namespace Second {}
10
- export = Second
11
- declare function Second<U, S>(s: U): S
12
- ~
13
- !!! @definitelytyped/no-unnecessary-generics: Type parameter U is used only once.
14
- ~
15
- !!! @definitelytyped/no-unnecessary-generics: Type parameter S is used only once.
@@ -1,10 +0,0 @@
1
- types/foo/foo-tests.ts
2
- 1:1 error File has no content @definitelytyped/no-useless-files
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/foo/foo-tests.ts ====
7
-
8
-
9
- ~
10
- !!! @definitelytyped/no-useless-files: File has no content.
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/foo/index.d.ts ====
4
-
5
- export const foo = 1234;
@@ -1,10 +0,0 @@
1
- types/foo/v1/foo-tests.ts
2
- 1:1 error File has no content @definitelytyped/no-useless-files
3
-
4
- ✖ 1 problem (1 error, 0 warnings)
5
-
6
- ==== types/foo/v1/foo-tests.ts ====
7
-
8
-
9
- ~
10
- !!! @definitelytyped/no-useless-files: File has no content.
@@ -1,5 +0,0 @@
1
- No errors
2
-
3
- ==== types/foo/v1/index.d.ts ====
4
-
5
- export const foo = 1234;