-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
typescript.js
34 lines (29 loc) · 950 Bytes
/
typescript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* This config:
* 1) adds `.jsx`, `.ts`, `.cts`, `.mts`, and `.tsx` as an extension
* 2) enables JSX/TSX parsing
*/
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
// types are resolved, and 2) it would mask an unresolved
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
const typeScriptExtensions = ['.ts', '.cts', '.mts', '.tsx'];
const allExtensions = [...typeScriptExtensions, '.js', '.jsx', '.mjs', '.cjs'];
module.exports = {
settings: {
'import/extensions': allExtensions,
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': typeScriptExtensions,
},
'import/resolver': {
node: {
extensions: allExtensions,
},
},
},
rules: {
// analysis/correctness
// TypeScript compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
},
};