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'), }