-
-
Save Chris911/69305fa1697683b90f578e9d9244fdec to your computer and use it in GitHub Desktop.
TS eslint no-unused-vars types example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parserOptions": { | |
"ecmaVersion": 2018, | |
"sourceType": "module" | |
}, | |
"rules": { | |
"@typescript-eslint/no-unused-vars": "error" | |
}, | |
"parser": "@typescript-eslint/parser", | |
"plugins": ["@typescript-eslint"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ts-eslint-test ./node_modules/.bin/eslint --ext .ts . | |
/Users/chris/Documents/Development/ts-eslint-test/types.d.ts | |
1:19 error 'MongooseTypes' is defined but never used @typescript-eslint/no-unused-vars | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ts-eslint-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@typescript-eslint/eslint-plugin": "^1.1.1", | |
"@typescript-eslint/parser": "^1.1.1", | |
"eslint": "^5.12.1", | |
"typescript": "^3.2.4" | |
}, | |
"dependencies": { | |
"mongoose": "^5.4.7" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Types as MongooseTypes } from "mongoose"; | |
declare global { | |
namespace MY_TYPES { | |
export interface Session { | |
_id: MongooseTypes.ObjectId; | |
token: string; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment