Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Check for exports from TS files always 馃帄 #241

Merged
merged 2 commits into from Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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