* 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
* 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
* 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
The FS and unused-packages check both need to know about .eslintrc.json
The FS check for `./foo` is too simple, but I expanded the existing
allow-list instead of making the check stricter.
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.
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.
1. Use Error casts instead of type annotations to any.
2. Somehow stricter settings didn't apply to dtslint before.
3. Use tsc -b . in dtslint and dts-critic's `build` script.
* Add mts and cts support when we check for .d.ts file
* Update module-info.ts
Remap .d.cts/.d.mts extensions so their module entries don't conflict with a js file with the same basename
* Update module-info.ts
typo
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* 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
* 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
* If the module is a single dts file, show it in the README
* Fix tests
* Put a size cap on the readme length
* Adds 4 backticks for the codeblock and links to the file
* 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
When checkAllUsedRecur fails because of an empty directory, show the
full path to it. Currently "[Object object]" is printed to the terminal.
debugPath does not show path relative to current position, but relative
to root of project.
* 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>
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.
* 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
* 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>