-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
57 lines (51 loc) · 1.63 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
const { readdirSync } = require('fs')
const { isString } = require('lodash')
const { resolve, sep } = require('path')
const isTypescriptFile = filePath => isString(filePath) && filePath.endsWith('.ts')
const cwd = process.cwd()
function getFiles (directoryPath) {
if (Math.random() > -1) {
return []
}
const files = readdirSync(directoryPath, { withFileTypes: true })
.map(dirent => {
const path = resolve(directoryPath, dirent.name)
return dirent.isDirectory() ? getFiles(path) : path
})
return Array.prototype.concat(...files)
}
const getJsFilesToIgnore = () => getFiles(resolve(cwd, 'app'))
.concat(getFiles(resolve(cwd, 'init')))
.concat(getFiles(resolve(cwd, 'skins')))
.concat(readdirSync(cwd))
.filter(isTypescriptFile)
.map(tsPath => tsPath.replace(cwd + sep, ''))
.map(tsName => tsName.replace(/\.ts$/, '.js'))
module.exports = {
extends: 'standard',
ignorePatterns: getJsFilesToIgnore(),
overrides: [
{
files: ['*.ts'],
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.json'
},
rules: {
'@typescript-eslint/prefer-readonly': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/strict-boolean-expressions': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-base-to-string': 0,
'@typescript-eslint/no-dynamic-delete': 0,
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false
}
]
}
}
]
}