Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
feat: Improve 'import' plugin settings (#143)
Browse files Browse the repository at this point in the history
* Resolve type definition packages in `node_modules`
* Include `d.ts` extension
  • Loading branch information
kripod authored Oct 18, 2020
1 parent 50785b8 commit 5aef889
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
module.exports = {
extends: ['eslint-config-airbnb', './lib/shared'].map(require.resolve),
settings: {
// Append 'ts' and 'tsx' extensions to Airbnb 'import/resolver' setting
// Append 'ts' extensions to Airbnb 'import/resolver' setting
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.d.ts'],
},
},
// Append 'ts' and 'tsx' extensions to Airbnb 'import/extensions' setting
'import/extensions': ['.js', '.ts', '.mjs', '.jsx', '.tsx'],
},
rules: {
// Append 'tsx' to Airbnb 'react/jsx-filename-extension' rule
Expand Down
6 changes: 4 additions & 2 deletions lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ module.exports = {
// Append 'ts' extensions to Airbnb 'import/resolver' setting
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.ts', '.json'],
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
},
},
// Append 'ts' extensions to Airbnb 'import/extensions' setting
'import/extensions': ['.js', '.ts', '.mjs'],
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
// Resolve type definition packages
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
},
rules: {
// Replace Airbnb 'brace-style' rule with '@typescript-eslint' version
Expand Down

0 comments on commit 5aef889

Please sign in to comment.