From a1698b4eccef4ea74faa982126a878030e741d39 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 17 Feb 2018 16:01:18 +0900 Subject: [PATCH] add eslint-visitor-keys --- .../eslint-visitor-keys-tests.ts | 12 ++++++++++ types/eslint-visitor-keys/index.d.ts | 17 ++++++++++++++ types/eslint-visitor-keys/tsconfig.json | 23 +++++++++++++++++++ types/eslint-visitor-keys/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 types/eslint-visitor-keys/eslint-visitor-keys-tests.ts create mode 100644 types/eslint-visitor-keys/index.d.ts create mode 100644 types/eslint-visitor-keys/tsconfig.json create mode 100644 types/eslint-visitor-keys/tslint.json diff --git a/types/eslint-visitor-keys/eslint-visitor-keys-tests.ts b/types/eslint-visitor-keys/eslint-visitor-keys-tests.ts new file mode 100644 index 0000000000..99aba7dad8 --- /dev/null +++ b/types/eslint-visitor-keys/eslint-visitor-keys-tests.ts @@ -0,0 +1,12 @@ +import * as evk from "eslint-visitor-keys"; + +const keys = evk.KEYS.ArrayExpression; +if (keys) { + const stringArray: ReadonlyArray = keys; +} +const stringArray: ReadonlyArray = evk.getKeys({type: "Literal", value: 777, raw: "777"}); +const keys2: evk.VisitorKeys = evk.unionWith({ + Decorator: ["expression"], + CustomType: [], + CustomType2: ["aaaa", "bbbb"] +}); diff --git a/types/eslint-visitor-keys/index.d.ts b/types/eslint-visitor-keys/index.d.ts new file mode 100644 index 0000000000..e0527b5890 --- /dev/null +++ b/types/eslint-visitor-keys/index.d.ts @@ -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 +// 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 | undefined +}>; + +export const KEYS: VisitorKeys; +export function getKeys(node: {}): ReadonlyArray; +export function unionWith(keys: VisitorKeys): VisitorKeys; diff --git a/types/eslint-visitor-keys/tsconfig.json b/types/eslint-visitor-keys/tsconfig.json new file mode 100644 index 0000000000..e514d4322f --- /dev/null +++ b/types/eslint-visitor-keys/tsconfig.json @@ -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" + ] +} diff --git a/types/eslint-visitor-keys/tslint.json b/types/eslint-visitor-keys/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/eslint-visitor-keys/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }