-
Notifications
You must be signed in to change notification settings - Fork 23
/
.eslintrc.js
72 lines (71 loc) · 2.86 KB
/
.eslintrc.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended', // uses typescript-specific linting rules
'plugin:react/recommended', // uses react-specific linting rules
'plugin:prettier/recommended', // enables eslint-plugin-prettier and eslint-config-prettier
],
plugins: ['import', 'react-hooks'],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
env: {
es2017: true,
browser: true,
node: true,
},
globals: {
__CONFIG__: 'readonly',
},
rules: {
// Config prettier/react - disables react-specific linting rules that conflict with prettier
'react/jsx-child-element-spacing': 'off',
'react/jsx-closing-bracket-location': 'off',
'react/jsx-closing-tag-location': 'off',
'react/jsx-curly-newline': 'off',
'react/jsx-curly-spacing': 'off',
'react/jsx-equals-spacing': 'off',
'react/jsx-first-prop-new-line': 'off',
'react/jsx-indent': 'off',
'react/jsx-indent-props': 'off',
'react/jsx-max-props-per-line': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-multi-spaces': 'off',
'react/jsx-tag-spacing': 'off',
'react/jsx-wrap-multilines': 'off',
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. '@typescript-eslint/no-parameter-properties': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/indent': 'off', // this is handled by prettier
'@typescript-eslint/interface-name-prefix': ['off', { prefixWithI: 'never' }], // TypeScript changed their mind and now recommend to not prefix interfaces
'@typescript-eslint/no-empty-interface': ['warn', { allowSingleExtends: true }],
'@typescript-eslint/no-var-requires': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': [1, { skipUndeclared: true }],
'import/default': 'off',
// '@typescript-eslint/no-explicit-any': 'off',
'no-undef': 'off', // TypeScript will fail to compile with undefined vars. The rule is redundant and reports false-positives for files that only exports interfaces.
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
// 'import/resolver': {
// typescript: {
// alwaysTryTypes: true,
// project: './tsconfig.json',
// },
// },
},
};