microsoft / dtslint Goto Github PK
View Code? Open in Web Editor NEWA utility built on TSLint for linting TypeScript declaration (.d.ts) files.
License: MIT License
A utility built on TSLint for linting TypeScript declaration (.d.ts) files.
License: MIT License
5.11.0 of tslint added a new rule file-name-casing
which defaults to camel-case
under tslint:all
which is what dtslint inherits from. This breaks DefinitelyTyped since dtsgen creates file names using kebab case. Just need to change the rule for file-name-casing
to fix it.
This is marked as a violation of the strict-export-declare-modifiers
rule, 'export' keyword is redundant here
:
declare namespace example {
export interface MyInterface {}
}
The current description of the rule doesn't explain this very well:
Avoid adding the
declare
keyword unnecessarily. Do add theexport
keyword unnecessarily, because sometimes it is necessary and we want to be consistent.
It even leaves the impression that export
should be added unnecessarily.
In #80 strictFunctionTypes
was made required.
Not a single tsconfig.json in DefinitelyTyped has this specified, so you get this when running npm run lint <type name>
for DefinitelyTyped definitions:
Error: Expected
"strictFunctionTypes": true
or"strictFunctionTypes": false
Not sure if this is intended or not, otherwise I'd make a PR
/cc @andy-ms
Repro available here.
Output from npm run lint semantic-ui-nag
:
> [email protected] lint S:\Projects\_GitHub\DefinitelyTyped
> dtslint types "semantic-ui-nag"
Output from tsc
:
../jquery/index.d.ts(171,29): error TS2304: Cannot find name 'XMLHttpRequest'.
../jquery/index.d.ts(492,41): error TS2304: Cannot find name 'Event'.
../jquery/index.d.ts(497,20): error TS2304: Cannot find name 'Element'.
../jquery/index.d.ts(507,21): error TS2304: Cannot find name 'Element'.
../jquery/index.d.ts(532,20): error TS2304: Cannot find name 'Event'.
...
Errror occurs because lib
in tsconfig.json
is missing dom
.
For very large tests, such as for Lodash, dtslint eventually runs out of memory.
Is there any way to workaround this issue?
Currently, people trying to contribute to the Lodash typings (and probably others) are being faced with sporadic memory errors, when trying to run the tests locally and in the Travis build. The advice is to try and rewrite the tests to avoid tipping the tests over the line of failure, but this is not really practice.
I have an index.d.ts file similar to the following:
export as namespace Foo;
export class Person {
name: string;
}
dtslint fails the strict-export-declare-modifiers rule on the line: export as namespace Foo;
. Is this behavior correct? If so, what is the correct way to both export for module loaders and provide a global namespace (UMD style)? dtsgen generates an example index.d.ts that follows this syntax, so if the dtslint behavior is correct it appears there's a disconnect between the two tools.
I apologize for asking the question in an issue, but I don't know of a better place to ask.
Ref: microsoft/TypeScript#26129 (comment)
no-unnecessary-generics
does not report certain TypeParameters if an Identifier with the same name is used somewhere within a parameter's type:
// unrelated identifier
declare function test<T>(param: {T: any}): any;
// shadowing
declare function test<T>(param: {[T in 'foo']: T}): any;
declare function test<T>(param: Foo extends () => infer T ? T : never): any;
Package compiles in TypeScript 2.3 but not in 2.0.
You can add a line '// TypeScript Version: 2.3' to the end of the header to specify a newer compiler version.
"You can add" means optional
The sentence should be "You should add" or "You must add"
Source code: https://github.com/Microsoft/dtslint/blob/927bb2f546a7915484bdbd152b1130224a734a62/src/index.ts#L108
"to the end" it is not "at the end"?
Hi, I'm trying to move typings from @types/ramda
to ramda
I've done everything like in readme, but getting this
~/projects/ramda feature/integrate_ts_typings ● yr dtslint
yarn run v1.1.0
$ dtslint types
Could not parse version: line is '// TypeScript Version: 2.4'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
dtslint's "expect" rule uses ts.forEachChild
from "typescript@next", but the AST is from an earlier version of TypeScript. The newest forEachChild
implementation does not visit any children of older ASTs; it looks like something changed for TS3.0. This breaks the "expect" rule since it cannot visit any nodes, so none of the assertions are evaluated.
I'm using dtslint's "expect" rule in my project's tslint configuration, as explained here: https://github.com/andy-ms/dtslint-ts-user
import * as ts29 from './ts2.9/node_modules/typescript'; // [email protected]
import * as tsnext from './tsnext/node_modules/typescript'; // TS@next (3.0.0-dev.20180609)
console.log(ts29.version);
console.log(tsnext.version);
// Parse with [email protected]
const sourceFile = ts29.createSourceFile('foo.ts', `
codeHere;
`, ts29.ScriptTarget.Latest, true, ts29.ScriptKind.TS);
// Traverse via typescript@next
tsnext.forEachChild(sourceFile, function(node) {
console.log('this message is never logged');
});
2.9.1
3.0.0-dev.20180609
For example
const foo: string = Math.random(); // $ExpectError
Gives
ERROR: 1:7 expect TypeScript compile error: Type 'number' is not assignable to type 'string'.
But this one works:
const foo: string = Math.random(); // $ExpectError
Math.random(); // $ExpectType number
I guess this line is the cause of problem.
In DefinitelyTyped/DefinitelyTyped#23412, I made a seemingly trivial change, which I suddenly couldn't test on Windows (W7 x64, node 8.9.4) because of FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
. Travis ran those tests with no problems, so it's a Windows thing. I finally managed to run the tests on Windows, but for this I had to patch node_modules/.bin/dtslint.cmd
:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max-old-space-size=4096 "%~dp0\..\dtslint\bin\index.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max-old-space-size=4096 "%~dp0\..\dtslint\bin\index.js" %*
)
I wonder if this fix can be made permanent somehow.
It would be useful to have the expect tslint rule published independently, so it can be used in tslint projects. palantir/tslint#2114
Would this be difficult to do, or is it just a case of moving the rule into a separate project and publishing?
Hello
configuration "interface-name": [true, "always-prefix"] not work
interface IDeferred<T> {
resolve(value?: T | IPromise<T>): void;
reject(reason?: any): void;
notify(state?: any): void;
promise: IPromise<T>;
}
interface IQService {
defer<T>(): IDeferred<T>; // error on this line
}
with tslint.json
configuration:
"no-unnecessary-generics": true
Error:
Type parameter is only used once
No error, the return type is an important information.
Given the docs:
Bad:
function parse(): T;
const x = parse();
Good:
function parse(): {};
const x = parse() as number;
Means that instead of doing
const deferred = $q.defer<string>();
We should doing
const deferred = $q.defer() as IDeferred<string>;
// or
const deferred = <IDeferred<string>>$q.defer();
I find the first syntax better than the 2 others. Is this still the official position?
Note that if we change from defer<T>(): IDeferred<T>;
to defer(): IDeferred<{}>;
, a lot of typescript builds are going to fail. This is the same linting error we found for HttpPromise.
Should we disable the rule for angular, or is the rule make sense on return types?
I believe all that is necessary, is upgrading definitelytyped-header-parser
a dependency, once that has TypeScript 2.8 support.
I have opened a PR over there for this support, and would be happy to open a PR here with that updated dependency, once it merges my PR or otherwise supports TypeScript 2.8.
How do you write that's something is a default
without the export
key word?
This is failing: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24144/files#diff-1c3d7581a68db8b801e724cb6478a526R11
Hi!
I'm using dtslint in a project that uses TS 2.4 (I've got a JS lib with a TS type definition file, and dtslint as a dev dependency to run on CI).
The latest npm release of dtslint (0.1.2
) seems pretty old, and chokes if your type definition file specifies a TypeScript version > 2.3. I was able to get around this by pointing my package.json directly to this repo's production
branch.
What's the desired way for folks to include this as a dependency? If it's npm, I'd love to see a more updated version published to the registry. If it's to use the production
branch, a few sentences added to the README would probably go a long way — I'm happy to open a PR.
Without that much context on the project, I'm curious if someone more familiar with it has thoughts about how best to proceed.
Thanks!
When we start using a new version of dtslint on DefinitelyTyped, people might not realize that it's the version of dtslint that is the problem when they get (or don't get) lint errors.
We could just compare the installed version to the one queried from NPM.
I'm struggling to interpret this error:
no-single-declare-module File has only 1 module declaration — write it as an external module.
for this declaration file:
declare module 'myutils' {
function map<T, U>(xs: T[], fn: (x: T) => U): U[];
}
How am I supposed to rewrite it?
This was one attempt, but it produced a similarly cryptic error:
declare namespace myutil {
function map<T, U>(xs: T[], fn: (x: T) => U): U[];
function sum(xs: number[]): number;
}
export = myutil;
export-just-namespace Instead of `export =`-ing a namespace, use the body of the namespace as the module body.
Some examples of before/afters for the lint rules would be really helpful.
see DefinitelyTyped/DefinitelyTyped#25742 (comment) and comments next to it.
It looks like the check on typescript version is inconsistent. To check the module itself the comment can be placed anywhere in the file but for checking with dependent modules it has to be part of the header.
So we could end up in broken dependents.
export function render<P, T extends Component<P, ComponentState>>(
element: CElement<P, T>,
container: Element | null,
callback?: () => void
): T;
The above code triggers no-unnecessary-generics because it thinks that P is only used once but type T is dependent on P.
ERROR: 8181:9 no-redundant-jsdoc-2 JSDoc tag '@param' is redundant in TypeScript code.
This occurs even when @param
is used only for documentation purposes and no type information is present.
This is just a minimal repro, the real use case is for types/npm-ramda to generate DT compatible tests so that we could put them on DT, but we got problems.
Is there any reason we can't pass the enclosingDeclaration
parameter to typeToString
in the expect rule?
Code
(index.d.ts)
export type Or<T, U> = T | U;
(something-tests.ts)
import * as something from 'something';
declare const result: something.Or<string, number>;
// $ExpectType string | number
result;
Expected
no errors
Actual
ERROR: 6:1 expect Expected type to be:
string | number
got:
Or<string, number>
Currently we always use the lowest TypeScript version that a package supports when linting it. This ensures that the expect
rule gets correct results. But tslint isn't compatibile with TypeScript 2.0, which causes bugs.
We should instead use typescript@latest for all other lint rules, and have expect
specially use a different Program that uses an older TypeScript. (As an optimization, we should not create this if there are not // $ExpectFoo
comments in the file.)
At the moment dtslint does not support the default generic types introduced in typescript 2.3
This causes pr builds to fail on DefinitelyTyped
Example:
DefinitelyTyped/DefinitelyTyped#16196
DefinitelyTyped/DefinitelyTyped#16198
edit: this is not the the only responsible for build fails on DT, but at the moment it fails when testing locally a package with default generic types
$ git clone https://github.com/DefinitelyTyped/DefinitelyTyped.git && cd DefinitelyTyped
$ npm install
$ npm run lint node
TypeError: ts.isVariableStatement is not a function
at getNodeForExpectType (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:241:12)
at iterate (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:228:52)
at visitEachNode (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8343:30)
at Object.forEachChild (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8501:24)
at iterate (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:235:12)
at visitEachNode (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8343:30)
at Object.forEachChild (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8501:24)
at iterate (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:235:12)
at visitNode (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8331:20)
at Object.forEachChild (/home/eps1lon/Development/src/js/forks/DefinitelyTyped/node_modules/dtslint/typescript-installs/2.0/node_modules/typescript/lib/typescript.js:8601:21)
Throwing line was added in ddf90bf but
isVariableStatement
was added to the public API in microsoft/TypeScript#16121 which was not backported to 2.0.
e.g. // Typescript Version: 2.3
or TypeScript Verison: 2.3
or // TypeScript Version:2.3
or // TypeScript: 2.3
const enums break single file compilation. we should add a check to flag them and make sure no new ones are added at least.
While trying to run dtslint
on some typings I got the following error:
.../DefinitelyTyped/node_modules/dtslint/bin/installer.js:79
throw new Error("Missing tslint version.");
^
Error: Missing tslint version.
at Object.<anonymous> (.../DefinitelyTyped/node_modules/dtslint/bin/installer.js:79:11)
On this line https://github.com/Microsoft/dtslint/blob/master/src/installer.ts#L65 the app is expecting tslint
as a devDependency
in package.json
however https://github.com/Microsoft/dtslint/blob/master/package.json#L30 tslint is specified as a dependency
I am getting these errors. Not sure if these are bugs or I am doing something wrong. There are no interfaces without "I" at begining as some errors say.
node: v8.11.2
yarn: 1.5.1
dtslint: 0.3.0
os: windows
https://ci.appveyor.com/project/elderapo/typed-event-emitter/build/1.0.1
$ dtslint test/types --onlyTestTsNext
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.0...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.1...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.2...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.3...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.4...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.5...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.6...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.7...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\2.8...
Installed!
Installing to C:\projects\typed-event-emitter\node_modules\dtslint\typescript-installs\next...
Installed!
The 'no-empty-interface' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEmptyInterfaceRule.js:50:26)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15331:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEmptyInterfaceRule.js:54:19)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15329:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEmptyInterfaceRule.js:54:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEmptyInterfaceRule.js:48:15)
The 'no-eval' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEvalRule.js:50:29)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15276:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEvalRule.js:53:19)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15333:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEvalRule.js:53:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noEvalRule.js:48:15)
The 'no-object-literal-type-assertion' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noObjectLiteralTypeAssertionRule.js:49:64)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15333:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noObjectLiteralTypeAssertionRule.js:53:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noObjectLiteralTypeAssertionRule.js:48:15)
at Rule.AbstractRule.applyWithFunction (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\language\rule\abstractRule.js:39:9)
at Rule.apply (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\noObjectLiteralTypeAssertionRule.js:29:21)
at Linter.applyRule (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\linter.js:197:29)
The 'radix' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\radixRule.js:49:64)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15276:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\radixRule.js:61:19)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15333:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\radixRule.js:61:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\radixRule.js:48:15)
The 'prefer-const' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at Object.isIdentifier (C:\projects\typed-event-emitter\node_modules\tsutils\typeguard\node.js:306:17)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferConstRule.js:159:27)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15276:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferConstRule.js:172:27)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15333:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferConstRule.js:167:20)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
The 'callable-types' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\callableTypesRule.js:52:29)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15331:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\callableTypesRule.js:64:19)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15329:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\callableTypesRule.js:64:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\callableTypesRule.js:50:15)
The 'prefer-object-spread' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferObjectSpreadRule.js:51:64)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15276:21)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferObjectSpreadRule.js:71:19)
at visitNode (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15089:24)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15333:24)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferObjectSpreadRule.js:71:19)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at walk (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferObjectSpreadRule.js:50:15)
The 'prefer-while' rule threw an error in 'C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'pos' of undefined
at Rule.createFailure (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferWhileRule.js:46:34)
at cb (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferWhileRule.js:34:37)
at visitNodes (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15098:30)
at Object.forEachChild (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\typescript\lib\typescript.js:15324:24)
at Rule.apply (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\rules\preferWhileRule.js:38:12)
at Linter.applyRule (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\linter.js:197:29)
at C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\linter.js:139:85
at Object.flatMap (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\utils.js:151:29)
at Linter.getAllFailures (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\linter.js:139:32)
at Linter.lint (C:\projects\typed-event-emitter\node_modules\dtslint\node_modules\tslint\lib\linter.js:99:33)
Error: C:/projects/typed-event-emitter/test/types/typed-event-emitter.ts:34:7
ERROR: 34:7 interface-name interface name must start with a capitalized I
at C:\projects\typed-event-emitter\node_modules\dtslint\bin\index.js:101:19
at Generator.next (<anonymous>)
at fulfilled (C:\projects\typed-event-emitter\node_modules\dtslint\bin\index.js:5:58)
at <anonymous>
error An unexpected error occurred: "Command failed.
Exit code: 1
node: v9.5.0
yarn: 1.6.0
dtslint: 0.3.0
os: ubuntu 14.04
yarn run v1.6.0
$ dtslint test/types --onlyTestTsNext
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.0...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.1...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.2...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.3...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.4...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.5...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.6...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.7...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/2.8...
Installed!
Installing to /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/typescript-installs/next...
Installed!
The 'no-empty-interface' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js:50:26)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15331:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js:54:19)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15329:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js:54:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js:48:15)
The 'no-eval' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEvalRule.js:50:29)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15276:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEvalRule.js:53:19)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15333:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEvalRule.js:53:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noEvalRule.js:48:15)
The 'no-object-literal-type-assertion' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js:49:64)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15333:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js:53:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js:48:15)
at Rule.AbstractRule.applyWithFunction (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
at Rule.apply (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js:29:21)
at Linter.applyRule (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/linter.js:197:29)
The 'radix' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/radixRule.js:49:64)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15276:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/radixRule.js:61:19)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15333:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/radixRule.js:61:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/radixRule.js:48:15)
The 'prefer-const' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'kind' of undefined
at Object.isIdentifier (/home/elderapo/nodejs/typed-event-emitter/node_modules/tsutils/typeguard/node.js:306:17)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferConstRule.js:159:27)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15276:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferConstRule.js:172:27)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15333:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferConstRule.js:167:20)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
The 'callable-types' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/callableTypesRule.js:52:29)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15331:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/callableTypesRule.js:64:19)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15329:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/callableTypesRule.js:64:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/callableTypesRule.js:50:15)
The 'prefer-object-spread' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'length' of undefined
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferObjectSpreadRule.js:51:64)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15276:21)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferObjectSpreadRule.js:71:19)
at visitNode (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15089:24)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15333:24)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferObjectSpreadRule.js:71:19)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at walk (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferObjectSpreadRule.js:50:15)
The 'prefer-while' rule threw an error in '/home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts':
TypeError: Cannot read property 'pos' of undefined
at Rule.createFailure (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferWhileRule.js:46:34)
at cb (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferWhileRule.js:34:37)
at visitNodes (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15098:30)
at Object.forEachChild (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/typescript/lib/typescript.js:15324:24)
at Rule.apply (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/rules/preferWhileRule.js:38:12)
at Linter.applyRule (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/linter.js:197:29)
at /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/linter.js:139:85
at Object.flatMap (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/utils.js:151:29)
at Linter.getAllFailures (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/linter.js:139:32)
at Linter.lint (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/node_modules/tslint/lib/linter.js:99:33)
Error: /home/elderapo/nodejs/typed-event-emitter/test/types/typed-event-emitter.ts:34:7
ERROR: 34:7 interface-name interface name must start with a capitalized I
at /home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/bin/index.js:101:19
at Generator.next (<anonymous>)
at fulfilled (/home/elderapo/nodejs/typed-event-emitter/node_modules/dtslint/bin/index.js:5:58)
at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Hi, this library looks useful to me, but I'm writing a native typescript library and I want to check that the inferred return types for various function calls are what I expect them to be. Is there a way to run this checker without the assumption that I'm checking a .d.ts
file? I previously tried typings-checker
, but I ran into a problem that the maintainer was at a loss to fix.
URLs for orgs which have maintainers mapped to their URLs should not be flagged as an error; eg asana.com
and microsoft.com
http://registry.npmjs.org/dtslint
The result is {}.
vscode: 1.20.1
typescript: 2.7.2
tslint: 5.9.1
dtslint: 0.2.0
{
"extends": "dtslint/dtslint.json",
"rules": {}
}
void-return.md Good: example test error
I have a TS project (which is distributed via NPM, with emitted .d.ts files included) that makes use of a lot of generics and overloading, and I use dtslint to verify the types are correct.
TS version 2.9 includes a breaking change to the behavior of keyof
. I can update my project to work with TS 2.9, but I also want to maintain a branch of my project that remains compatible with TS versions prior to 2.9.
It is currently impossible for my to run dtslint tests against code that is incompatible with the TS 2.9 breaking change because dtslint is hardcoded to test against typescript@next as its upper bound.
Is it possible to add support for an optional upper bound so that I can continue to maintain a branch of my project for TS versions 2.3-2.8, and instruct dtslint to only test with TS versions 2.3-2.8?
For reference, my project is here: https://github.com/UselessPickles/ts-enum-util
The dtslint tests are in the "/type_tests" folder, the npm script "dtslint" defined in package.json runs dtslint
I know that I'm not exactly using dtslint for its original intended purpose, but I have found it extremely useful to use in this way (technically not testing a .d.ts file, but testing the types of TS source code)
Perhaps dtslint only works on node 7.x ?
DefinitelyTyped$ node --version
v6.10.2 # latest LTS version
DefinitelyTyped$ npm --version
4.2.0
DefinitelyTyped$ git log -n 1
commit 43408431520aaedbb7520015d3fdba816f0f6fc6
...
DefinitelyTyped$ npm install
DefinitelyTyped$ grep '"version"' node_modules/dtslint/package.json
"version": "0.1.1",
DefinitelyTyped$ echo '{ "extends": "dtslint/dt.json" }' > types/boom/tslint.json
DefinitelyTyped$ cat types/boom/tslint.json
{ "extends": "dtslint/dt.json" }
DefinitelyTyped$ npm run lint boom
> [email protected] lint /abc/DefinitelyTyped
> dtslint types "boom"
Object.entries is not a function
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node@6/6.10.2/bin/node" "/usr/local/bin/npm" "run" "lint" "boom"
npm ERR! node v6.10.2
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: `dtslint types "boom"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script 'dtslint types "boom"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the definitely-typed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! dtslint types "boom"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs definitely-typed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls definitely-typed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/bcd/.npm/_logs/2017-04-21T14_48_46_581Z-debug.log
DefinitelyTyped$ cat /Users/bcd/.npm/_logs/2017-04-21T14_48_46_581Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node@6/6.10.2/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'lint',
1 verbose cli 'boom' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle [email protected]~prelint: [email protected]
6 silly lifecycle [email protected]~prelint: no script for prelint, continuing
7 info lifecycle [email protected]~lint: [email protected]
8 verbose lifecycle [email protected]~lint: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~lint: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/abc/DefinitelyTyped/node_modules/.bin:/usr/local/bin:/usr/local/opt/node@6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/bcd/.rvm/bin:/Users/bcd/bin:/usr/local/opt/go/libexec/bin
10 verbose lifecycle [email protected]~lint: CWD: /abc/DefinitelyTyped
11 silly lifecycle [email protected]~lint: Args: [ '-c', 'dtslint types "boom"' ]
12 silly lifecycle [email protected]~lint: Returned: code: 1 signal: null
13 info lifecycle [email protected]~lint: Failed to exec lint script
14 verbose stack Error: [email protected] lint: `dtslint types "boom"`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /abc/DefinitelyTyped
17 error Darwin 15.6.0
18 error argv "/usr/local/Cellar/node@6/6.10.2/bin/node" "/usr/local/bin/npm" "run" "lint" "boom"
19 error node v6.10.2
20 error npm v4.2.0
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] lint: `dtslint types "boom"`
23 error Exit status 1
24 error Failed at the [email protected] lint script 'dtslint types "boom"'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the definitely-typed package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error dtslint types "boom"
24 error You can get information on how to open an issue for this project with:
24 error npm bugs definitely-typed
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls definitely-typed
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
Running dtslint on this:
declare module 'a' {
import { Component } from 'react'
}
declare module 'a/b' {
import { Component } from 'react'
}
results in
no-duplicate-imports Multiple imports from 'react' can be combined into one.
@types/jquery
has several test files that contains code copied from jQuery documentation. They're useful in helping test @types/jquery
but are written in JavaScript and are aligned to jQuery's style guidelines.
It'd be nice to be able to disable rules for these files without either disabling them for the entire package (which can negatively impact the quality of the declarations) or disabling them per line (which is a lot of work).
Now that we have tests (#22), it would be nice to run them.
I'm trying to lint the React types in DefinitelyTyped, but I get:
❯ npm run lint react
> [email protected] lint /Users/OliverJAsh/Development/DefinitelyTyped
> dtslint types "react"
Error: Could not parse version: line is '// TypeScript Version: 2.6'
at Object.parseTypeScriptVersionLine (/Users/OliverJAsh/Development/DefinitelyTyped/node_modules/definitelytyped-header-parser/index.js:180:15)
at getTypeScriptVersion (/Users/OliverJAsh/Development/DefinitelyTyped/node_modules/dtslint/bin/index.js:90:44)
at /Users/OliverJAsh/Development/DefinitelyTyped/node_modules/dtslint/bin/index.js:66:28
at Generator.next (<anonymous>)
at fulfilled (/Users/OliverJAsh/Development/DefinitelyTyped/node_modules/dtslint/bin/index.js:5:58)
at <anonymous>
This is after a fresh install of Node modules.
For example:
function Range(start?: number, end?: number, step?: number): Seq.Indexed<number>;
Range; // $ExpectType (start?: number | undefined, end?: number | undefined, step?: number | undefined) => Indexed<number>
Gives
Expected type to be '(start?: number | undefined, end?: number | undefined, step?: number | undefined) => Indexed<number>'; got '(start?: number | undefined, end?: number | undefined, step?: number | undefined) => Indexed<numb...'.
import { Browser } from "puppeteer";
// $ExpectType Browser
browser;
Feels like this should be documented.
I have definitions file with multiple module declarations like:
declare module 'react-google-maps/lib/components/Circle' {
import { Component } from 'react'
export interface CircleProps {
}
export default class Circle extends Component<CircleProps> {
}
Running dtslint results in strict-export-declare-modifiers
for each export
keyword.
Full example at tomchentw/react-google-maps#646 (remove "strict-export-declare-modifiers": false
from tslint.json
).
In effect, this cannot be used stand alone and is meant for use with DefinitelyTyped only.
Error: .../package.json should set `"private": true`
at Object.<anonymous> (.../bump-regex/node_modules/dtslint/bin/checks.js:22:19)
Please remove this rather arbitrary restriction in order to allow us to integrate required typings directly into our packages and enable to reuse this tool.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.