@definitelytyped/eslint-plugin 0.0.191 → 0.0.193
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.
- package/CHANGELOG.md +16 -0
- package/dist/configs/all.js +29 -2
- package/dist/configs/all.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/rules/export-just-namespace.js +1 -1
- package/dist/rules/export-just-namespace.js.map +1 -1
- package/dist/rules/no-bad-reference.js +6 -5
- package/dist/rules/no-bad-reference.js.map +1 -1
- package/dist/rules/no-dead-reference.js +6 -3
- package/dist/rules/no-dead-reference.js.map +1 -1
- package/dist/rules/no-declare-current-package.js +2 -2
- package/dist/rules/no-declare-current-package.js.map +1 -1
- package/dist/rules/no-import-default-of-export-equals.js +1 -1
- package/dist/rules/no-import-default-of-export-equals.js.map +1 -1
- package/dist/rules/no-import-of-dev-dependencies.js +20 -9
- package/dist/rules/no-import-of-dev-dependencies.js.map +1 -1
- package/dist/rules/no-old-dt-header.js +2 -2
- package/dist/rules/no-old-dt-header.js.map +1 -1
- package/dist/rules/no-relative-import-in-test.js +32 -18
- package/dist/rules/no-relative-import-in-test.js.map +1 -1
- package/dist/rules/no-self-import.js +24 -13
- package/dist/rules/no-self-import.js.map +1 -1
- package/dist/rules/no-single-declare-module.js +2 -2
- package/dist/rules/no-single-declare-module.js.map +1 -1
- package/dist/rules/no-useless-files.js +2 -2
- package/dist/rules/no-useless-files.js.map +1 -1
- package/dist/rules/prefer-declare-function.js +1 -1
- package/dist/rules/prefer-declare-function.js.map +1 -1
- package/dist/rules/strict-export-declare-modifiers.js +1 -1
- package/dist/rules/strict-export-declare-modifiers.js.map +1 -1
- package/dist/util.d.ts +1 -0
- package/dist/util.js +13 -1
- package/dist/util.js.map +1 -1
- package/package.json +7 -4
- package/src/configs/all.ts +28 -1
- package/src/index.ts +17 -5
- package/src/rules/export-just-namespace.ts +1 -1
- package/src/rules/no-bad-reference.ts +6 -5
- package/src/rules/no-dead-reference.ts +6 -3
- package/src/rules/no-declare-current-package.ts +2 -2
- package/src/rules/no-import-default-of-export-equals.ts +1 -1
- package/src/rules/no-import-of-dev-dependencies.ts +23 -10
- package/src/rules/no-old-dt-header.ts +2 -2
- package/src/rules/no-relative-import-in-test.ts +38 -21
- package/src/rules/no-self-import.ts +27 -13
- package/src/rules/no-single-declare-module.ts +2 -2
- package/src/rules/no-useless-files.ts +2 -2
- package/src/rules/prefer-declare-function.ts +1 -1
- package/src/rules/strict-export-declare-modifiers.ts +1 -1
- package/src/util.ts +18 -0
- package/test/__file_snapshots__/types/export-just-namespace/bad1.d.ts.lint +11 -0
- package/test/__file_snapshots__/types/export-just-namespace/bad2.d.ts.lint +11 -0
- package/test/__file_snapshots__/types/export-just-namespace/bad3.d.ts.lint +12 -0
- package/test/__file_snapshots__/types/export-just-namespace/export-just-namespace-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/export-just-namespace/good1.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good2.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good3.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good4.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good5.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good6.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/export-just-namespace/good7.d.ts.lint +7 -0
- package/test/__file_snapshots__/types/export-just-namespace/good8.d.ts.lint +7 -0
- package/test/__file_snapshots__/types/export-just-namespace/good9.d.ts.lint +15 -0
- package/test/__file_snapshots__/types/foo/foo-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/foo/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/foo/v1/foo-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/foo/v1/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-any-union/bad.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-any-union/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-any-union/no-any-union-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-bad-reference/index.d.ts.lint +43 -0
- package/test/__file_snapshots__/types/no-bad-reference/no-bad-reference-tests.ts.lint +14 -0
- package/test/__file_snapshots__/types/no-bad-reference/v0.1/index.d.ts.lint +48 -0
- package/test/__file_snapshots__/types/no-bad-reference/v0.1/no-bad-reference-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-bad-reference/v11/index.d.ts.lint +48 -0
- package/test/__file_snapshots__/types/no-bad-reference/v11/no-bad-reference-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-const-enum/bad.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-const-enum/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-const-enum/no-const-enum-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-dead-reference/bad.d.ts.lint +18 -0
- package/test/__file_snapshots__/types/no-dead-reference/bad2.d.ts.lint +15 -0
- package/test/__file_snapshots__/types/no-dead-reference/bad3.d.ts.lint +17 -0
- package/test/__file_snapshots__/types/no-dead-reference/index.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-dead-reference/no-dead-reference-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-declare-current-package/index.d.ts.lint +13 -0
- package/test/__file_snapshots__/types/no-declare-current-package/no-declare-current-package-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-declare-current-package/test/deep/import.d.ts.lint +13 -0
- package/test/__file_snapshots__/types/no-declare-current-package-other/index.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-declare-current-package-other/no-declare-current-package-other-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-import-default-of-export-equals/bad.d.ts.lint +17 -0
- package/test/__file_snapshots__/types/no-import-default-of-export-equals/index.d.ts.lint +12 -0
- package/test/__file_snapshots__/types/no-import-default-of-export-equals/no-import-default-of-export-equals-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-import-of-dev-dependencies/bad.d.ts.lint +44 -0
- package/test/__file_snapshots__/types/no-import-of-dev-dependencies/index.d.ts.lint +25 -0
- package/test/__file_snapshots__/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts.lint +39 -0
- package/test/__file_snapshots__/types/no-old-dt-header/index.d.ts.lint +23 -0
- package/test/__file_snapshots__/types/no-old-dt-header/index2.d.ts.lint +14 -0
- package/test/__file_snapshots__/types/no-old-dt-header/no-old-dt-header-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-old-dt-header/ok1.ts.lint +11 -0
- package/test/__file_snapshots__/types/no-old-dt-header/ok2.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-old-dt-header/ok3.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-old-dt-header/ok4.d.ts.lint +12 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/abc.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/bad.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test/abc.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests2.ts.lint +7 -0
- package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-relative-references/index.d.ts.lint +51 -0
- package/test/__file_snapshots__/types/no-relative-references/no-relative-references-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-relative-references/other/other.d.ts.lint +31 -0
- package/test/__file_snapshots__/types/no-relative-references/v1/index.d.ts.lint +57 -0
- package/test/__file_snapshots__/types/no-relative-references/v1/no-relative-references-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-relative-references/v1/other/other.d.ts.lint +31 -0
- package/test/__file_snapshots__/types/no-self-import/bad.d.ts.lint +65 -0
- package/test/__file_snapshots__/types/no-self-import/index.d.ts.lint +19 -0
- package/test/__file_snapshots__/types/no-self-import/no-self-import-tests.ts.lint +39 -0
- package/test/__file_snapshots__/types/no-single-declare-module/bad.d.ts.lint +13 -0
- package/test/__file_snapshots__/types/no-single-declare-module/index.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-single-declare-module/index2.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/no-single-declare-module/index3.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-single-declare-module/no-single-declare-module-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-single-element-tuple-type/bad.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-single-element-tuple-type/index.d.ts.lint +9 -0
- package/test/__file_snapshots__/types/no-single-element-tuple-type/no-single-element-tuple-type-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-unnecessary-generics/bad.d.ts.lint +14 -0
- package/test/__file_snapshots__/types/no-unnecessary-generics/index.d.ts.lint +11 -0
- package/test/__file_snapshots__/types/no-unnecessary-generics/no-unnecessary-generics-tests.ts.lint +44 -0
- package/test/__file_snapshots__/types/no-useless-files/bad.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-useless-files/bad2.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-useless-files/bad3.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/no-useless-files/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-useless-files/index2.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-useless-files/index3.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/no-useless-files/no-useless-files-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/other/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/other/other-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/other/v1/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/other/v1/other-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/prefer-declare-function/bad.d.ts.lint +33 -0
- package/test/__file_snapshots__/types/prefer-declare-function/index.d.ts.lint +14 -0
- package/test/__file_snapshots__/types/prefer-declare-function/prefer-declare-function-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/redundant-undefined/bad.d.ts.lint +15 -0
- package/test/__file_snapshots__/types/redundant-undefined/index.d.ts.lint +9 -0
- package/test/__file_snapshots__/types/redundant-undefined/redundant-undefined-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__foo/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/scoped__foo/scoped__foo-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__foo/v1/index.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/scoped__foo/v1/scoped__foo-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__no-declare-current-package/index.d.ts.lint +13 -0
- package/test/__file_snapshots__/types/scoped__no-declare-current-package/no-declare-current-package-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__no-declare-current-package/test/deep/import.d.ts.lint +13 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/index.d.ts.lint +51 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/no-relative-references-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/other/other.d.ts.lint +31 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/v1/index.d.ts.lint +57 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/v1/no-relative-references-tests.ts.lint +10 -0
- package/test/__file_snapshots__/types/scoped__no-relative-references/v1/other/other.d.ts.lint +31 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad1.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad2.d.ts.lint +12 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad3.d.ts.lint +10 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad4.d.ts.lint +12 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad5.d.ts.lint +11 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad6.d.ts.lint +14 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/bad7.d.ts.lint +14 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good1.ts.lint +5 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good2.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good3.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good4.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good5.d.ts.lint +5 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good6.ts.lint +7 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good7.d.ts.lint +6 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good8.d.ts.lint +9 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/good9.d.ts.lint +7 -0
- package/test/__file_snapshots__/types/strict-export-declare-modifiers/strict-export-declare-modifiers-tests.ts.lint +10 -0
- package/test/eslint.test.ts +134 -0
- package/test/fixtures/.eslintrc.cjs +4 -0
- package/test/fixtures/types/export-just-namespace/bad1.d.ts +2 -0
- package/test/fixtures/types/export-just-namespace/bad2.d.ts +2 -0
- package/test/fixtures/types/export-just-namespace/bad3.d.ts +3 -0
- package/test/fixtures/types/export-just-namespace/export-just-namespace-tests.ts +0 -0
- package/test/fixtures/types/export-just-namespace/good1.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good2.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good3.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good4.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good5.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good6.d.ts +1 -0
- package/test/fixtures/types/export-just-namespace/good7.d.ts +3 -0
- package/test/fixtures/types/export-just-namespace/good8.d.ts +3 -0
- package/test/fixtures/types/export-just-namespace/good9.d.ts +3 -0
- package/test/fixtures/types/export-just-namespace/package.json +8 -0
- package/test/fixtures/types/export-just-namespace/tsconfig.json +31 -0
- package/test/fixtures/types/no-any-union/bad.d.ts +1 -0
- package/test/fixtures/types/no-any-union/index.d.ts +1 -0
- package/test/fixtures/types/no-any-union/no-any-union-tests.ts +1 -0
- package/test/fixtures/types/no-any-union/package.json +8 -0
- package/test/fixtures/types/no-any-union/tsconfig.json +21 -0
- package/test/fixtures/types/no-bad-reference/tsconfig.json +1 -1
- package/test/fixtures/types/no-bad-reference/v0.1/tsconfig.json +1 -1
- package/test/fixtures/types/no-bad-reference/v11/tsconfig.json +1 -1
- package/test/fixtures/types/no-const-enum/bad.d.ts +1 -0
- package/test/fixtures/types/no-const-enum/index.d.ts +1 -0
- package/test/fixtures/types/no-const-enum/no-const-enum-tests.ts +0 -0
- package/test/fixtures/types/no-const-enum/package.json +8 -0
- package/test/fixtures/types/no-const-enum/tsconfig.json +21 -0
- package/test/fixtures/types/no-dead-reference/bad.d.ts +6 -0
- package/test/fixtures/types/no-dead-reference/bad2.d.ts +3 -0
- package/test/fixtures/types/no-dead-reference/bad3.d.ts +5 -0
- package/test/fixtures/types/no-dead-reference/index.d.ts +2 -0
- package/test/fixtures/types/no-dead-reference/no-dead-reference-tests.ts +0 -0
- package/test/fixtures/types/no-dead-reference/package.json +8 -0
- package/test/fixtures/types/no-dead-reference/tsconfig.json +23 -0
- package/test/fixtures/types/no-declare-current-package/tsconfig.json +2 -1
- package/test/fixtures/types/no-declare-current-package-other/tsconfig.json +1 -1
- package/test/fixtures/types/no-import-default-of-export-equals/bad.d.ts +8 -0
- package/test/fixtures/types/no-import-default-of-export-equals/index.d.ts +8 -0
- package/test/fixtures/types/no-import-default-of-export-equals/no-import-default-of-export-equals-tests.ts +0 -0
- package/test/fixtures/types/no-import-default-of-export-equals/package.json +8 -0
- package/test/fixtures/types/no-import-default-of-export-equals/tsconfig.json +21 -0
- package/test/fixtures/types/no-import-of-dev-dependencies/bad.d.ts +3 -0
- package/test/fixtures/types/no-import-of-dev-dependencies/index.d.ts +3 -0
- package/test/fixtures/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts +6 -0
- package/test/fixtures/types/no-import-of-dev-dependencies/tsconfig.json +1 -0
- package/test/fixtures/types/no-old-dt-header/index.d.ts +14 -0
- package/test/fixtures/types/no-old-dt-header/index2.d.ts +2 -0
- package/test/fixtures/types/no-old-dt-header/no-old-dt-header-tests.ts +0 -0
- package/test/fixtures/types/no-old-dt-header/ok1.ts +2 -0
- package/test/fixtures/types/no-old-dt-header/ok2.d.ts +1 -0
- package/test/fixtures/types/no-old-dt-header/ok3.d.ts +1 -0
- package/test/fixtures/types/no-old-dt-header/ok4.d.ts +3 -0
- package/test/fixtures/types/no-old-dt-header/package.json +8 -0
- package/test/fixtures/types/no-old-dt-header/tsconfig.json +25 -0
- package/test/fixtures/types/no-relative-import-in-test/bad.d.ts +0 -0
- package/test/fixtures/types/no-relative-import-in-test/index.d.ts +1 -0
- package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests.ts +1 -0
- package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests2.ts +3 -0
- package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts +1 -0
- package/test/fixtures/types/no-relative-import-in-test/package.json +8 -0
- package/test/fixtures/types/no-relative-import-in-test/tsconfig.json +25 -0
- package/test/fixtures/types/no-relative-references/tsconfig.json +1 -0
- package/test/fixtures/types/no-relative-references/v1/tsconfig.json +1 -0
- package/test/fixtures/types/no-self-import/bad.d.ts +9 -0
- package/test/fixtures/types/no-self-import/index.d.ts +8 -0
- package/test/fixtures/types/no-self-import/no-self-import-tests.ts +6 -0
- package/test/fixtures/types/no-self-import/tsconfig.json +2 -1
- package/test/fixtures/types/no-single-declare-module/bad.d.ts +4 -0
- package/test/fixtures/types/no-single-declare-module/index.d.ts +2 -0
- package/test/fixtures/types/no-single-declare-module/index2.d.ts +2 -0
- package/test/fixtures/types/no-single-declare-module/index3.d.ts +1 -0
- package/test/fixtures/types/no-single-declare-module/no-single-declare-module-tests.ts +0 -0
- package/test/fixtures/types/no-single-declare-module/package.json +8 -0
- package/test/fixtures/types/no-single-declare-module/tsconfig.json +23 -0
- package/test/fixtures/types/no-single-element-tuple-type/bad.d.ts +1 -0
- package/test/fixtures/types/no-single-element-tuple-type/index.d.ts +5 -0
- package/test/fixtures/types/no-single-element-tuple-type/no-single-element-tuple-type-tests.ts +0 -0
- package/test/fixtures/types/no-single-element-tuple-type/package.json +8 -0
- package/test/fixtures/types/no-single-element-tuple-type/tsconfig.json +21 -0
- package/test/fixtures/types/no-unnecessary-generics/bad.d.ts +2 -0
- package/test/fixtures/types/no-unnecessary-generics/index.d.ts +7 -0
- package/test/fixtures/types/no-unnecessary-generics/no-unnecessary-generics-tests.ts +14 -0
- package/test/fixtures/types/no-unnecessary-generics/package.json +8 -0
- package/test/fixtures/types/no-unnecessary-generics/tsconfig.json +21 -0
- package/test/fixtures/types/no-useless-files/bad.d.ts +1 -0
- package/test/fixtures/types/no-useless-files/bad2.d.ts +0 -0
- package/test/fixtures/types/no-useless-files/bad3.d.ts +1 -0
- package/test/fixtures/types/no-useless-files/index.d.ts +1 -0
- package/test/fixtures/types/no-useless-files/index2.d.ts +1 -0
- package/test/fixtures/types/no-useless-files/index3.d.ts +1 -0
- package/test/fixtures/types/no-useless-files/no-useless-files-tests.ts +0 -0
- package/test/fixtures/types/no-useless-files/package.json +8 -0
- package/test/fixtures/types/no-useless-files/tsconfig.json +25 -0
- package/test/fixtures/types/other/tsconfig.json +1 -1
- package/test/fixtures/types/other/v1/tsconfig.json +1 -1
- package/test/fixtures/types/prefer-declare-function/bad.d.ts +9 -0
- package/test/fixtures/types/prefer-declare-function/index.d.ts +2 -0
- package/test/fixtures/types/prefer-declare-function/package.json +8 -0
- package/test/fixtures/types/prefer-declare-function/prefer-declare-function-tests.ts +0 -0
- package/test/fixtures/types/prefer-declare-function/tsconfig.json +21 -0
- package/test/fixtures/types/redundant-undefined/bad.d.ts +3 -0
- package/test/fixtures/types/redundant-undefined/index.d.ts +5 -0
- package/test/fixtures/types/redundant-undefined/package.json +8 -0
- package/test/fixtures/types/redundant-undefined/redundant-undefined-tests.ts +1 -0
- package/test/fixtures/types/redundant-undefined/tsconfig.json +21 -0
- package/test/fixtures/types/scoped__foo/tsconfig.json +1 -1
- package/test/fixtures/types/scoped__foo/v1/tsconfig.json +1 -1
- package/test/fixtures/types/scoped__no-declare-current-package/tsconfig.json +2 -1
- package/test/fixtures/types/scoped__no-relative-references/tsconfig.json +1 -0
- package/test/fixtures/types/scoped__no-relative-references/v1/tsconfig.json +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad1.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad2.d.ts +3 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad3.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad4.d.ts +3 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad5.d.ts +2 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad6.d.ts +2 -0
- package/test/fixtures/types/strict-export-declare-modifiers/bad7.d.ts +2 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good1.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good2.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good3.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good4.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good5.d.ts +1 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good6.ts +3 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good7.d.ts +2 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good8.d.ts +5 -0
- package/test/fixtures/types/strict-export-declare-modifiers/good9.d.ts +3 -0
- package/test/fixtures/types/strict-export-declare-modifiers/package.json +8 -0
- package/test/fixtures/types/strict-export-declare-modifiers/strict-export-declare-modifiers-tests.ts +0 -0
- package/test/fixtures/types/strict-export-declare-modifiers/tsconfig.json +35 -0
- package/test/util.test.ts +6 -1
- package/test/util.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/test/export-just-namespace.test.ts +0 -68
- package/test/fixtureTester.ts +0 -63
- package/test/no-any-union.test.ts +0 -20
- package/test/no-bad-reference.test.ts +0 -127
- package/test/no-const-enum.test.ts +0 -20
- package/test/no-dead-reference.test.ts +0 -64
- package/test/no-declare-current-package.test.ts +0 -59
- package/test/no-import-default-of-export-equals.test.ts +0 -49
- package/test/no-import-of-dev-dependencies.test.ts +0 -27
- package/test/no-old-dt-header.test.ts +0 -69
- package/test/no-relative-import-in-test.test.ts +0 -27
- package/test/no-self-import.test.ts +0 -30
- package/test/no-single-declare-module.test.ts +0 -49
- package/test/no-single-element-tuple-type.test.ts +0 -26
- package/test/no-unnecessary-generics.test.ts +0 -152
- package/test/no-useless-files.test.ts +0 -40
- package/test/prefer-declare-function.test.ts +0 -64
- package/test/redundant-undefined.test.ts +0 -37
- package/test/strict-export-declare-modifiers.test.ts +0 -156
- package/test/tsconfig.no-declare-current-package.json +0 -11
- package/test/tsconfig.no-declare-current-package2.json +0 -11
- package/test/tsconfig.no-import-default-of-export-equals.json +0 -11
- package/test/tsconfig.no-relative-import-in-test.json +0 -14
- package/test/tsconfig.no-self-import.json +0 -7
- package/test/tsconfig.no-single-declare-module.json +0 -7
- package/test/tsconfig.test.json +0 -10
- /package/test/{abc.d.ts → fixtures/types/no-relative-import-in-test/abc.d.ts} +0 -0
- /package/test/{no-relative-import-in-test → fixtures/types/no-relative-import-in-test/no-relative-import-in-test}/abc.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
types/strict-export-declare-modifiers/bad5.d.ts
|
|
2
|
+
1:11 error All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting @definitelytyped/strict-export-declare-modifiers
|
|
3
|
+
|
|
4
|
+
✖ 1 problem (1 error, 0 warnings)
|
|
5
|
+
|
|
6
|
+
==== types/strict-export-declare-modifiers/bad5.d.ts ====
|
|
7
|
+
|
|
8
|
+
interface I { i: any }
|
|
9
|
+
~
|
|
10
|
+
!!! @definitelytyped/strict-export-declare-modifiers: All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting.
|
|
11
|
+
export namespace M {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
types/strict-export-declare-modifiers/bad6.d.ts
|
|
2
|
+
1:1 error 'declare' keyword is redundant here @definitelytyped/strict-export-declare-modifiers
|
|
3
|
+
1:18 error All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting @definitelytyped/strict-export-declare-modifiers
|
|
4
|
+
|
|
5
|
+
✖ 2 problems (2 errors, 0 warnings)
|
|
6
|
+
|
|
7
|
+
==== types/strict-export-declare-modifiers/bad6.d.ts ====
|
|
8
|
+
|
|
9
|
+
declare function g(): void;
|
|
10
|
+
~~~~~~~
|
|
11
|
+
!!! @definitelytyped/strict-export-declare-modifiers: 'declare' keyword is redundant here.
|
|
12
|
+
~
|
|
13
|
+
!!! @definitelytyped/strict-export-declare-modifiers: All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting.
|
|
14
|
+
export namespace M {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
types/strict-export-declare-modifiers/bad7.d.ts
|
|
2
|
+
1:1 error 'declare' keyword is redundant here @definitelytyped/strict-export-declare-modifiers
|
|
3
|
+
1:19 error All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting @definitelytyped/strict-export-declare-modifiers
|
|
4
|
+
|
|
5
|
+
✖ 2 problems (2 errors, 0 warnings)
|
|
6
|
+
|
|
7
|
+
==== types/strict-export-declare-modifiers/bad7.d.ts ====
|
|
8
|
+
|
|
9
|
+
declare namespace N {}
|
|
10
|
+
~~~~~~~
|
|
11
|
+
!!! @definitelytyped/strict-export-declare-modifiers: 'declare' keyword is redundant here.
|
|
12
|
+
~
|
|
13
|
+
!!! @definitelytyped/strict-export-declare-modifiers: All declarations in this module are exported automatically. Prefer to explicitly write 'export' for clarity. If you have a good reason not to export this declaration, add 'export {}' to the module to shut off automatic exporting.
|
|
14
|
+
export namespace M {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
types/strict-export-declare-modifiers/strict-export-declare-modifiers-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/strict-export-declare-modifiers/strict-export-declare-modifiers-tests.ts ====
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
~
|
|
10
|
+
!!! @definitelytyped/no-useless-files: File has no content.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ESLint, Linter } from "eslint";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import stripAnsi from "strip-ansi";
|
|
4
|
+
import { globSync } from "glob";
|
|
5
|
+
import { fixtureRoot } from "./util";
|
|
6
|
+
import { toMatchFile } from "jest-file-snapshot";
|
|
7
|
+
import * as plugin from "../src/index";
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
|
|
10
|
+
expect.extend({ toMatchFile });
|
|
11
|
+
const snapshotDir = path.join(__dirname, "__file_snapshots__");
|
|
12
|
+
|
|
13
|
+
const allFixtures = globSync(["**/*.ts", "**/*.cts", "**/*.mts", "**/*.tsx"], { cwd: fixtureRoot });
|
|
14
|
+
|
|
15
|
+
function getLintSnapshotPath(fixture: string): string {
|
|
16
|
+
return path.join(snapshotDir, `${fixture}.lint`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getAllLintSnapshots() {
|
|
20
|
+
return new Set(globSync("**/*.lint", { cwd: snapshotDir, absolute: true }));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getAllExpectedLintSnapshots() {
|
|
24
|
+
return new Set(allFixtures.map(getLintSnapshotPath));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let eslint: ESLint;
|
|
28
|
+
|
|
29
|
+
beforeAll(() => {
|
|
30
|
+
eslint = new ESLint({
|
|
31
|
+
cwd: fixtureRoot,
|
|
32
|
+
plugins: { [plugin.meta.name]: plugin },
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterAll(() => {
|
|
37
|
+
eslint = undefined as any;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Force one test per fixture so we can see when a file has no errors.
|
|
41
|
+
for (const fixture of allFixtures) {
|
|
42
|
+
describe(`fixture ${fixture}`, () => {
|
|
43
|
+
it("should lint", async () => {
|
|
44
|
+
const results = await eslint.lintFiles([fixture]);
|
|
45
|
+
for (const result of results) {
|
|
46
|
+
result.filePath = path.relative(fixtureRoot, result.filePath);
|
|
47
|
+
}
|
|
48
|
+
const formatter = await eslint.loadFormatter("stylish");
|
|
49
|
+
const formatted = await formatter.format(results);
|
|
50
|
+
const resultText = stripAnsi(formatted).trim() || "No errors";
|
|
51
|
+
expect(resultText).not.toContain("Parsing error");
|
|
52
|
+
const newOutput = formatResultsWithInlineErrors(results);
|
|
53
|
+
expect(resultText + "\n\n" + newOutput).toMatchFile(getLintSnapshotPath(fixture));
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function formatResultsWithInlineErrors(results: ESLint.LintResult[]): string {
|
|
59
|
+
const output: string[] = [];
|
|
60
|
+
|
|
61
|
+
function pushMessage(message: Linter.LintMessage): void {
|
|
62
|
+
const ruleId = message.ruleId;
|
|
63
|
+
if (!ruleId) {
|
|
64
|
+
throw new Error("Expected ruleId");
|
|
65
|
+
}
|
|
66
|
+
const lines = message.message.split(/\r?\n/);
|
|
67
|
+
for (let i = 0; i < lines.length; i++) {
|
|
68
|
+
const line = lines[i];
|
|
69
|
+
const prefix = `!!! ${i === 0 ? ruleId : " ".repeat(ruleId.length)}: `;
|
|
70
|
+
output.push(prefix + line);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const indent = " ";
|
|
75
|
+
|
|
76
|
+
for (const result of results) {
|
|
77
|
+
output.push(`==== ${result.filePath} ====`);
|
|
78
|
+
output.push("");
|
|
79
|
+
|
|
80
|
+
const sourceText = fs.readFileSync(path.join(fixtureRoot, result.filePath), "utf-8");
|
|
81
|
+
|
|
82
|
+
const lines = sourceText.split(/\r?\n/);
|
|
83
|
+
|
|
84
|
+
for (let i = 0; i < lines.length; i++) {
|
|
85
|
+
const line = lines[i];
|
|
86
|
+
output.push(indent + line);
|
|
87
|
+
|
|
88
|
+
for (const message of result.messages) {
|
|
89
|
+
const startLine = message.line - 1;
|
|
90
|
+
const endLine = message.endLine === undefined ? startLine : message.endLine - 1;
|
|
91
|
+
const startColumn = message.column - 1;
|
|
92
|
+
const endColumn = message.endColumn === undefined ? startColumn : message.endColumn - 1;
|
|
93
|
+
if (i < startLine || i > endLine) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (i === startLine) {
|
|
97
|
+
const squiggle = "~".repeat(Math.max(1, endColumn - startColumn));
|
|
98
|
+
output.push(indent + " ".repeat(startColumn) + squiggle);
|
|
99
|
+
pushMessage(message);
|
|
100
|
+
} else {
|
|
101
|
+
const squiggle = "~".repeat(Math.max(1, line.length - startColumn));
|
|
102
|
+
output.push(indent + squiggle);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
output.push("");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return output.join("\n").trim() + "\n";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Similar to https://github.com/storybookjs/storybook/blob/df357020e010f49e7c325942f0c891e6702527d6/code/addons/storyshots-core/src/api/integrityTestTemplate.ts
|
|
114
|
+
describe("lint snapshots", () => {
|
|
115
|
+
it("abandoned snapshots", () => {
|
|
116
|
+
const expectedSnapshots = getAllExpectedLintSnapshots();
|
|
117
|
+
const actualSnapshots = getAllLintSnapshots();
|
|
118
|
+
const abandonedSnapshots = [...actualSnapshots].filter((s) => !expectedSnapshots.has(s));
|
|
119
|
+
|
|
120
|
+
if (abandonedSnapshots.length === 0) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// https://github.com/jestjs/jest/issues/8732#issuecomment-516445064
|
|
125
|
+
if (expect.getState().snapshotState._updateSnapshot === "all") {
|
|
126
|
+
for (const abandoned of abandonedSnapshots) {
|
|
127
|
+
fs.rmSync(abandoned);
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
expect(abandonedSnapshots).toHaveLength(0);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const value = 3;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default class Hello {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const value = 123;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = stuff;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = createStuff();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6",
|
|
6
|
+
"dom"
|
|
7
|
+
],
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"noImplicitThis": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"good1.d.ts",
|
|
18
|
+
"good2.d.ts",
|
|
19
|
+
"good3.d.ts",
|
|
20
|
+
"good4.d.ts",
|
|
21
|
+
"good5.d.ts",
|
|
22
|
+
"good6.d.ts",
|
|
23
|
+
"good7.d.ts",
|
|
24
|
+
"good8.d.ts",
|
|
25
|
+
"good9.d.ts",
|
|
26
|
+
"bad1.d.ts",
|
|
27
|
+
"bad2.d.ts",
|
|
28
|
+
"bad3.d.ts",
|
|
29
|
+
"export-just-namespace-tests.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const y: string | any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const x: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const z: string | any;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6",
|
|
6
|
+
"dom"
|
|
7
|
+
],
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"noImplicitThis": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"bad.d.ts",
|
|
19
|
+
"no-any-union-tests.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const enum E { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
enum F {}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6",
|
|
6
|
+
"dom"
|
|
7
|
+
],
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"noImplicitThis": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"bad.d.ts",
|
|
19
|
+
"no-const-enum-tests.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6",
|
|
6
|
+
"dom"
|
|
7
|
+
],
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"noImplicitThis": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"bad.d.ts",
|
|
19
|
+
"bad2.d.ts",
|
|
20
|
+
"bad3.d.ts",
|
|
21
|
+
"no-dead-reference-tests.ts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6",
|
|
6
|
+
"dom"
|
|
7
|
+
],
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"noImplicitThis": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"bad.d.ts",
|
|
19
|
+
"no-import-default-of-export-equals-tests.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/test/fixtures/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts
CHANGED
|
@@ -7,3 +7,9 @@ import self from "no-import-of-dev-dependencies";
|
|
|
7
7
|
|
|
8
8
|
import devdep from "devdep";
|
|
9
9
|
import * as otherdevdep from "otherdevdep";
|
|
10
|
+
|
|
11
|
+
import other2 = require("other");
|
|
12
|
+
import self2 = require("no-import-of-dev-dependencies");
|
|
13
|
+
|
|
14
|
+
import devdep2 = require("devdep");
|
|
15
|
+
import otherdevdep2 = require("otherdevdep");
|