From 5c5439dc60a0474dbe22e3df60fe32481314d38e Mon Sep 17 00:00:00 2001 From: Kirill Konshin Date: Mon, 7 Jan 2019 11:37:15 -0800 Subject: [PATCH] Fix for #1256 --- config/typescript.js | 22 ++++++++++++++++++++++ src/index.js | 1 + 2 files changed, 23 insertions(+) create mode 100644 config/typescript.js diff --git a/config/typescript.js b/config/typescript.js new file mode 100644 index 000000000..d2d707c58 --- /dev/null +++ b/config/typescript.js @@ -0,0 +1,22 @@ +/** + * Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing. + */ +var jsExtensions = ['.js', '.jsx']; +var tsExtensions = ['.ts', '.tsx']; +var allExtensions = jsExtensions.concat(tsExtensions); + +module.exports = { + + settings: { + 'import/extensions': allExtensions, + 'import/parsers': { + 'typescript-eslint-parser': tsExtensions + }, + 'import/resolver': { + 'node': { + 'extensions': allExtensions + } + } + } + +} diff --git a/src/index.js b/src/index.js index f5794595d..6cbe0a642 100644 --- a/src/index.js +++ b/src/index.js @@ -62,4 +62,5 @@ export const configs = { 'react': require('../config/react'), 'react-native': require('../config/react-native'), 'electron': require('../config/electron'), + 'typescript': require('../config/typescript'), }