add eslint-visitor-keys

This commit is contained in:
Toru Nagashima
2018-02-17 16:01:18 +09:00
parent 423ace8fe7
commit a1698b4ecc
4 changed files with 53 additions and 0 deletions
@@ -0,0 +1,12 @@
import * as evk from "eslint-visitor-keys";
const keys = evk.KEYS.ArrayExpression;
if (keys) {
const stringArray: ReadonlyArray<string> = keys;
}
const stringArray: ReadonlyArray<string> = evk.getKeys({type: "Literal", value: 777, raw: "777"});
const keys2: evk.VisitorKeys = evk.unionWith({
Decorator: ["expression"],
CustomType: [],
CustomType2: ["aaaa", "bbbb"]
});
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for eslint-visitor-keys 1.0
// Project: https://github.com/eslint/eslint-visitor-keys#readme
// Definitions by: Toru Nagashima <https://github.com/mysticatea>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*~ If this module is a UMD module that exposes a global variable 'myLib' when
*~ loaded outside a module loader environment, declare that global here.
*~ Otherwise, delete this declaration.
*/
export type VisitorKeys = Readonly<{
[type: string]: ReadonlyArray<string> | undefined
}>;
export const KEYS: VisitorKeys;
export function getKeys(node: {}): ReadonlyArray<string>;
export function unionWith(keys: VisitorKeys): VisitorKeys;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"eslint-visitor-keys-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }