Skip to content

Commit

Permalink
Fix: Check for exports from TS files always 🎊 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
DHedgecock committed Sep 12, 2020
1 parent 07179f7 commit 83d22d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
34 changes: 22 additions & 12 deletions src/__snapshots__/index.spec.js.snap
Expand Up @@ -114,12 +114,9 @@ Object {
"valid-typeof": "off",
},
"settings": Object {
"import/extensions": Array [
".js",
".jsx",
".ts",
".tsx",
".d.ts",
"import/external-module-folders": Array [
"node_modules",
"node_modules/@types",
],
"import/parsers": Object {
"@typescript-eslint/parser": Array [
Expand Down Expand Up @@ -1009,6 +1006,14 @@ Object {
},
"settings": Object {
"import/cache": 60,
"import/extensions": Array [
".js",
".jsx",
".mjs",
".ts",
".tsx",
".d.ts",
],
"import/internal-regex": /\\^@\\\\//,
"import/resolver": "/mock/test/path",
"react": Object {
Expand Down Expand Up @@ -1137,12 +1142,9 @@ Object {
"valid-typeof": "off",
},
"settings": Object {
"import/extensions": Array [
".js",
".jsx",
".ts",
".tsx",
".d.ts",
"import/external-module-folders": Array [
"node_modules",
"node_modules/@types",
],
"import/parsers": Object {
"@typescript-eslint/parser": Array [
Expand Down Expand Up @@ -2453,6 +2455,14 @@ Object {
},
"settings": Object {
"import/cache": 60,
"import/extensions": Array [
".js",
".jsx",
".mjs",
".ts",
".tsx",
".d.ts",
],
"import/internal-regex": /\\^@\\\\//,
"import/resolver": "/mock/test/path",
"react": Object {
Expand Down
9 changes: 7 additions & 2 deletions src/index.js
Expand Up @@ -125,6 +125,10 @@ module.exports = function eloquence({
// Use webpack to resolve projects to handle src alias
'import/resolver': path.resolve(__dirname, 'resolver'),

// Extensions that will be parsed to check for exports, including JS, TS,
// React extenions, Node ESM, and type definitions
'import/extensions': ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'],

// --- React plugin settings ---
'react': {
pragma: 'React',
Expand Down Expand Up @@ -203,9 +207,10 @@ module.exports = function eloquence({

plugins: ['@typescript-eslint'],
settings: {
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
// Config from plugin:import/typescript
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
// Use the ESLint-TS parser when parsing TS and type definition files
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
},
},
Expand Down

0 comments on commit 83d22d4

Please sign in to comment.