Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/config/typescript.js
828 views
1
/**
2
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
3
*/
4
5
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
6
// types are resolved, and 2) it would mask an unresolved
7
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
8
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];
9
10
module.exports = {
11
12
settings: {
13
'import/extensions': allExtensions,
14
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
15
'import/parsers': {
16
'@typescript-eslint/parser': ['.ts', '.tsx'],
17
},
18
'import/resolver': {
19
'node': {
20
'extensions': allExtensions,
21
},
22
},
23
},
24
25
rules: {
26
// analysis/correctness
27
28
// TypeScript compilation already ensures that named imports exist in the referenced module
29
'import/named': 'off',
30
},
31
};
32
33