Skip to content

Commit

Permalink
chore: update ESLint rules for TypeScript (#23)
Browse files Browse the repository at this point in the history
Some of these ESLint rules cause TS/TSX files to improperly report that the imported files don't exist, when they do. This is because it's currently set to `['.js', '.jsx']`. We're now adjusting the rule (specifically for TypeScript) so it will resolve for TS/TSX modules.
  • Loading branch information
JimmyMultani authored Feb 11, 2020
1 parent 63f5377 commit af65d55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@ module.exports = {
'plugin:@typescript-eslint/eslint-recommended',
// turns on rules from their TypeScript-specific plugin
'plugin:@typescript-eslint/recommended',
// enables ts/tsx file usage when importing modules
'plugin:import/typescript',
],
rules: {
// Allow TypeScript files to have JSX
'react/jsx-filename-extension': [WARNING, { 'extensions': ['.ts', '.tsx', '.js', '.jsx'] }],
'import/extensions': [
'error',
'ignorePackages',
{
'js': 'never',
'jsx': 'never',
'ts': 'never',
'tsx': 'never',
},
],
},
};

0 comments on commit af65d55

Please sign in to comment.