Commit Graph

55 Commits

Author SHA1 Message Date
Josh Goldberg
f2d538de14 Converted no-self-import from TSLint to ESLint (#652)
* Converted no-self-import from TSLint to ESLint

* Update packages/dtslint/src/rules/no-self-import.ts
2023-03-24 10:16:09 -07:00
Andrew Branch
7c82ab4ff2 Allow --module node16 (#647) 2023-03-22 14:39:56 -07:00
TypeScript Bot
2b5703939b Format 2023-03-13 23:48:29 +00:00
Nathan Shively-Sanders
f3b30c31d4 Handle EmptyStatement at top-level in global files (#635)
* Handle EmptyStatement at top-level in global files

getModuleInfo's per-node handling of top-level statements in a
non-module sourcefile forgot to include EmptyStatement.

* improve naming of test variables
2023-03-13 16:44:21 -07:00
TypeScript Bot
bd014a1e14 Format 2023-02-27 22:00:59 +00:00
Andrew Branch
ed2a4f3350 Use real resolution for used file detection (#615)
* Use real TypeScript resolution for determining used files

* getTypingInfo needs the whole DT FS

* Fix a few things not showing up in tests

* Disable superfluous OTHER_FILES error

* Replace internal API

* Bring back error for relatively referencing other packages

* Fix `getLocallyInstalledDefinitelyTyped`

* PR suggestions
2023-02-27 13:57:22 -08:00
Jack Bates
00712c8734 Don't omit dependencies if only some deep modules are declared (#484)
* Don't omit dependencies if only some deep modules are declared

* Run just check parse results from the workflow

* Base test on styled-components-react-native
2022-09-27 11:08:15 -07:00
Jack Bates
90eac4dbf8 Use pacote second attempt (#483)
* Use cached npm metadata

* Simply read the npm cache

* Use pacote
2022-06-28 10:51:02 -07:00
Jack Bates
3e6aab8c62 Registry API no longer needs %2f-encoding (#445) 2022-06-22 11:43:32 -07:00
Andrew Branch
cbb1d4d1fa Revert "Use cached npm info (#451)" (#480)
* Revert "Use cached npm info (#451)"

This reverts commit e246b08817.

* Fix package.json version
2022-06-09 13:34:46 -07:00
Jack Bates
e246b08817 Use cached npm info (#451)
* Registry API no longer needs %2f-encoding

* Use cached npm info

* Simply read the npm cache

* Delete create-search-index.ts

* Use pacote
2022-06-09 11:41:21 -07:00
Jack Bates
575fd10bc8 Use valid semvers internally (#436)
* Update test position after upgrading Prettier

* Use valid semvers internally
2022-04-21 14:26:08 -07:00
TypeScript Bot
8665394ff1 Format 2022-04-21 18:44:48 +00:00
TypeScript Bot
57f0c23b9d Format 2022-02-03 19:31:38 +00:00
Nathan Shively-Sanders
4d8d66e96f Improve unused path mapping error. (#386)
1. Report all unused path mappings of the first unused-having package.
   Previously it was only the first unused path mapping of the first
   package.

2. Direct the user to check for missing mappings in dependencies in the
   case of path mappings that aren't actually unused.
2022-02-03 11:28:47 -08:00
TypeScript Bot
2b82a76d87 Format 2022-01-19 00:11:13 +00:00
Nathan Shively-Sanders
8ff6e2a7a0 testDependencies omits entries from 'declare module' (#384)
The list of declared modules includes deep paths, which I think may be
correct for general usage, but not for comparing with the list of
dependencies, which must be package names.

Found by @chriskrycho while trying to update Ember's types.
2022-01-18 16:07:51 -08:00
Nathan Shively-Sanders
eed63f27e2 Allow node/buffer path mapping (#270)
* Allow "paths" mapping buffer->node/buffer

Needed because DT infrastructure depends on a real package named
"buffer" which ships its own types, which preempts lookup of the ambient
module "buffer" from node.

I don't think this will be needed for anything except for node and
particularly buffer, so I just added a single exception.

* improve comment

* fix element access lint
2021-05-28 09:05:57 -07:00
TypeScript Bot
a2ec5628f3 Format 2021-05-27 18:28:00 +00:00
Nathan Shively-Sanders
9e4d8b6c17 Require lowercase package names in notNeededPackages.json (#268)
* Require lowercase package names in notNeededPackages.json

This means we can't deprecate packages with uppercase letters, but I
don't think there are many on npm -- possibly none.

* fix mock data: not-needed libraryName for angular
2021-05-27 11:24:31 -07:00
TypeScript Bot
4bdab7de7d Format 2021-05-13 16:31:34 +00:00
Nathan Shively-Sanders
4dcf82b758 Allow deleted files outside notNeededPackages entries (#253)
* Allow deleted files outside notNeededPackages entries

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52719 needs to
deprecate @types/socket.io@2 and in doing so modify its dependents. One
of its dependents needs to delete a file, but this isn't allowed
currently.

This changes it to be allowed. I'm not sure I've covered all the
interesting cases, so check whether the new code is now too permissive.

* fix whitespace lint
2021-05-13 09:28:51 -07:00
James Garbutt
cdfc9ae382 add tests for typingsdata (#228)
* add tests for typingsdata

* add tests for notneeded

* a few more
2021-05-06 10:42:34 -07:00
Federico Panico
05b41ea595 Fix: Allow /* in versioned mappings. (#231)
* definition-parser: Use scoped names when testing mappings for relative
imports.
* miscellany/utils: When removing version number, keeps wildcard at the
end of mapping.
* miscellany/utils: When checking the existence of a version number,
catch those packages that include a wildcard path mapping.

Co-authored-by: Federico Panico <federicopanico@gmail.com>
2021-04-08 10:17:38 -07:00
Nathan Shively-Sanders
0c9257237f Allow passthrough anywhere. (#226)
Turns out that passthroughs need to be allowed anywhere.

Since you can only add passthroughs to `./node_modules`, you can only
add passthroughs to things in package.json, which means that that file
remains the security bottleneck.
2021-03-29 10:48:46 -07:00
Nathan Shively-Sanders
8cdbe73054 Allow ./node_modules passthrough in paths (#224)
* Allow ./node_modules passthrough in paths

I introduced a node_modules passthrough in webpack in
DefinitelyTyped/DefinitelyTyped#51712: the entire index.d.ts is

```ts
import webpack = require('./node_modules/webpack')
export = webpack
```

This allows @types/webpack@5 to delegate its entire type definition to
webpack@5, while still allowing @types/webpack@4 to be maintained on
DT.

However, the correct module specifier is actually just 'webpack', since
there's no guarantee of the exact location where webpack will be
installed. This can be made to compile on DT with a path mapping:

```json
"paths": {
    "webpack": [
        "./node_modules/webpack"
    ]
}
```

Previously, path mappings like this were not allowed. This PR allows
them.

* fix === lint
2021-03-29 10:07:29 -07:00
Nathan Shively-Sanders
925652e8bf Cleanup NotNeededPackage[Raw] (#220)
* Cleanup NotNeededPackage[Raw]

Better construction interface
Also fix a lot of tests for some reason?

* remove temp notes
2021-03-23 09:46:14 -07:00
Andrew Branch
29ca889c0d Merge pull request #167 from jablko/patch-28
Make notNeededPackages.json an object
2021-03-22 15:13:28 -07:00
TypeScript Bot
d5b6f3ed43 Format 2021-03-22 22:12:01 +00:00
Federico
4738bf342f Fix path mapping not created for older scoped packages 2021-03-10 12:39:37 -03:00
Federico Panico
fd4be462c3 fix: parser fails with older scoped packages. (#208)
* fix: parser fails with older scoped packages.

Given a path mapping as

```
"paths": {
	"@ckeditor/ckeditor5-utils": [
		"ckeditor__ckeditor5-utils/v10"
	]
}
```

definitions-parser failed to understand that `/v10` is not part of the
package name, and that the key of the mapping must be a scoped name.

* Resolve PR comments

- add test coverage
- simplify implementation

* Add test in definition-parser

* Use scopedPackageName in Error for missing mapping

Co-authored-by: Piotr Błażejewicz <peterblazejewicz@users.noreply.github.com>
2021-03-05 13:59:19 -05:00
Jack Bates
d1b49560d6 Make notNeededPackages.json an object 2020-11-16 15:04:28 -07:00
Andrew Branch
6ea64a6333 Merge pull request #142 from jablko/patch-25
Use libraryName homepage for not-needed stub
2020-11-16 11:04:33 -08:00
Andrew Branch
aec2e2b6ce Fix deleting old versions of packages 2020-10-29 13:21:42 -07:00
Jack Bates
22b761e9a8 Use libraryName homepage for not-needed stub 2020-10-27 12:01:37 -07:00
Jack Bates
7c7f00d90c Add dependencies for import types (#95)
* Add dependencies for types imports

* Add tests

* Improve style 🎨

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-09-25 09:15:05 -07:00
Jack Bates
92a0242d39 Allow wildcard scope path mappings (#96)
* Allow wildcard scope path mappings

* Add tests
2020-09-24 10:30:55 -07:00
Jack Bates
b670ec39df Handle local references in scoped packages (#93)
* Handle local references in scoped packages

* Add tests

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-09-17 16:26:22 -07:00
Jack Bates
e347e6057d Merge #87 and #88 (#117) 2020-09-17 16:18:27 -07:00
Jack Bates
4a27d6efdb Parse the same files as the compiler (#92)
* Parse the same files as the compiler

* Wait for promises

* Use .toThrow()

* Add tests
2020-09-17 15:51:37 -07:00
Jack Bates
4305da4f44 Non-relative reference in typesVersions parent (#89)
* Non-relative reference in typesVersions parent

* Add tests

* Normalize ../${baseDirectory}/ for seenReferences

* Cosmetic
2020-09-17 14:50:30 -07:00
Jack Bates
af2d374cae Make path mappings an object (#88) 2020-09-17 13:48:38 -07:00
Jack Bates
752943bf68 Make .allDependencyTypings() respect path mappings (#87)
* Make .allDependencyTypings() respect path mappings

* Make tests more specific

* Test multiple versions

* Add tests
2020-09-17 13:27:50 -07:00
Andrew Branch
6e46bd013f Fix mocks 2020-08-19 10:09:38 -07:00
Andrew Branch
376e2f3a11 Fix GitHub download 2020-08-19 09:58:54 -07:00
Andrew Branch
8a501a0ad5 Read allowedPackageJsonDependencies from GitHub 2020-08-18 14:35:30 -07:00
Nathan Shively-Sanders
70563d7500 definition-parser: include package name in error (#60)
Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

This proposed change is intended to allow developers quickly figure out
the real reason of `getTypingInfo` failing due to version mismatch.
Current error message and related stack trace does not contain a clue
about the package failing and with the context of DT repository and
local development artifacts, this removes the problem with definition
parser failing on the stale data from local repository (non tracked
folders, etc).

Thanks!
2020-06-10 14:38:41 -07:00
Nathan Shively-Sanders
068213db72 Deduplicate dependencies (#57)
* Deduplicate dependencies

Use the more common object format, which is technically less powerful,
but we've never needed the additional power of the array format.

Co-authored-by: Jack Bates <jack@nottheoilrig.com>

* forgot yarn format again

Co-authored-by: Jack Bates <jack@nottheoilrig.com>
2020-06-09 16:58:27 -07:00
Andrew Branch
20f28a0678 Delete obsolete stuff and move tests around 2020-04-24 15:25:03 -07:00
Andrew Branch
71b734c97a Port #752 from types-publisher
Co-authored-by: Nathan Shively-Sanders <sandersn@noreply.users.github.com>
2020-03-12 15:54:26 -07:00