-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
typescript.ts
55 lines (52 loc) · 2.04 KB
/
typescript.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { workspaceRoot } from '@nx/devkit';
import { packageExists } from '../utils/config-utils';
const isPrettierAvailable =
packageExists('prettier') && packageExists('eslint-config-prettier');
/**
* This configuration is intended to be applied to ALL .ts and .tsx files
* within an Nx workspace.
*
* It should therefore NOT contain any rules or plugins which are specific
* to one ecosystem, such as React, Angular, Node etc.
*/
export default {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
tsconfigRootDir: workspaceRoot,
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
...(isPrettierAvailable ? ['prettier'] : []),
],
rules: {
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
/**
* From https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/#updated-configuration-rules
*
* The following rules were added to preserve the linting rules that were
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
* changed how configurations are defined.
*
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v19 of Nx
*/
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
},
};