forked from ExodusMovement/exodus-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
74 lines (70 loc) · 1.98 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
73
74
const fs = require('node:fs')
const shared = {
'import/no-cycle': ['error', { ignoreExternal: true }],
'unicorn/no-array-callback-reference': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/text-encoding-identifier-case': 'off',
'no-restricted-imports': [
'error',
{
name: '@exodus/fetch',
message:
'Do not use directly. Please inject and consume "fetch" and "fetchival" through the IOC',
},
],
}
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))
const isModule = pkg.type === 'module'
const sourceExts = ['js', 'json', 'ts', 'tsx', 'android.js', 'ios.js']
const esmConfigs = isModule
? ['plugin:@exodus/require-extensions/recommended', 'plugin:@exodus/hydra/esm']
: []
module.exports = {
extends: [
'@exodus/eslint-config/javascript-babel',
'plugin:@exodus/ban-flow/recommended',
'plugin:@exodus/basic-utils/recommended',
'plugin:@exodus/restricted-imports/recommended',
'plugin:@exodus/hydra/recommended',
'plugin:@exodus/package/recommended',
...esmConfigs,
],
rules: shared,
globals: {
fetch: 'off',
},
settings: {
// import/named cannot statically resolve React Native imports, see https://github.com/facebook/react-native/issues/28549
'import/ignore': ['react-native'],
'import/resolver': {
node: {
extensions: sourceExts.map((n) => `.${n}`),
},
},
},
overrides: [
{
extends: ['plugin:@exodus/hydra/features'],
files: ['{features,modules}/**/*.{ts,js}'],
},
{
files: ['*.{ts,tsx}'],
extends: ['@exodus/eslint-config/typescript-react'],
rules: shared,
},
{
files: ['*.{tsx,jsx}', '*Context.{ts,js}'],
rules: {
'unicorn/filename-case': 'off',
},
},
{
files: ['**/__tests__/**/*.{ts,js}', '*.{spec,test}.{ts,js}'],
rules: {
'no-restricted-syntax': 'off',
'no-restricted-imports': 'off',
},
},
],
}