-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy patheslint.config.js
More file actions
108 lines (106 loc) · 3.17 KB
/
Copy patheslint.config.js
File metadata and controls
108 lines (106 loc) · 3.17 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const react = require('eslint-plugin-react')
const reactHooks = require('eslint-plugin-react-hooks')
const prettier = require('eslint-plugin-prettier')
const typescriptEslint = require('@typescript-eslint/eslint-plugin')
const typescriptParser = require('@typescript-eslint/parser')
const globals = require('globals')
// Import custom rules
const importPlugin = require('eslint-plugin-import')
const eslintConfigPrettier = require('eslint-config-prettier')
const ambirePlugin = require('./eslint-rules')
module.exports = [
{
ignores: [
'node_modules/**',
'babel_cache/**',
'artifacts/**',
'dist/**',
'coverage/**',
'contracts/**'
]
},
{
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
projectService: {
defaultProject: './tsconfig.json'
},
ecmaFeatures: {
jsx: true
},
ecmaVersion: 'latest',
sourceType: 'module'
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021
}
},
settings: {
react: {
version: 'detect'
},
// Prevents eslint-plugin-import from parsing node_modules (e.g. react-native Flow syntax).
'import/ignore': ['node_modules']
},
plugins: {
react,
'react-hooks': reactHooks,
prettier,
'@typescript-eslint': typescriptEslint,
import: importPlugin,
ambire: ambirePlugin
},
rules: {
...typescriptEslint.configs.recommended.rules,
...react.configs.flat.recommended.rules,
...reactHooks.configs.recommended.rules,
'prettier/prettier': [
'error',
{
useTabs: false
}
],
'func-names': 0,
'prefer-destructuring': 0,
'@typescript-eslint/semi': 'off',
'react/style-prop-object': 'off',
'react/function-component-definition': 'off',
'arrow-body-style': 'off',
'import/prefer-default-export': 'off',
'@typescript-eslint/comma-dangle': 'off',
'consistent-return': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-extra-semi': 'off',
'no-plusplus': 'off',
'@typescript-eslint/indent': 'off',
'react/no-unstable-nested-components': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
semi: ['error', 'never'],
'import/no-cycle': 'error',
'import/no-unresolved': 'off' // because typescript already covers this
}
},
// Custom rules for controllers only
// Done to avoid false positives
// and reduce performance impact
{
files: ['src/controllers/**/*.ts', 'src/ambire-common/src/controllers/**/*.ts'],
plugins: {
ambire: ambirePlugin
},
rules: {
'ambire/no-emit-update-in-on-update': 'error'
}
},
// disables ESLint formatting rules that conflict with Prettier (must be last)
eslintConfigPrettier
]