/
.eslintrc.cjs
106 lines (102 loc) · 3.05 KB
/
.eslintrc.cjs
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
/**
* @file This file is part of the Keywork project.
* @copyright Nirrius, LLC. All rights reserved.
* @author Teffen Ellis, et al.
* @license AGPL-3.0
*
* @remarks Keywork is free software for non-commercial purposes.
* You can be released from the requirements of the license by purchasing a commercial license.
* Buying such a license is mandatory as soon as you develop commercial activities
* involving the Keywork software without disclosing the source code of your own applications.
*
* @see LICENSE.md in the project root for further licensing information.
*/
/* eslint-disable @typescript-eslint/no-var-requires */
// @ts-ignore Node
const path = require('path')
// @ts-ignore Node
const fs = require('fs')
// @ts-ignore Node
const headerPath = path.resolve(__dirname, 'build', 'header.js')
const rawHeaderContent = fs.readFileSync(headerPath, 'utf8')
const headerLines = rawHeaderContent.replace('/**', '*').replace('*/\n', '').split('\n')
const config = {
root: true,
ignorePatterns: ['./packages/*/dist/**/*', './node_modules/**/*'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'header'],
settings: {
react: {
version: '18.2.0',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.mts', '.tsx'],
},
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
env: {
browser: true,
node: true,
worker: true,
},
rules: {
'no-restricted-globals': [
2,
{
name: 'Request',
message: "Use `import {Request} from 'keywork/platform/http'`",
},
{
name: 'Headers',
message: "Use `import {Headers} from 'keywork/platform/http'`",
},
{
name: 'Response',
message: "Use `import {Response} from 'keywork/platform/http'`",
},
{
name: 'TransformStream',
message: "Use `import {TransformStream} from 'keywork/platform/stream'`",
},
{
name: 'ReadableStream',
message: "Use `import {ReadableStream} from 'keywork/platform/stream'`",
},
{
name: 'WritableStream',
message: "Use `import {WritableStream} from 'keywork/platform/stream'`",
},
],
'header/header': [2, 'block', headerLines, 1],
'react/prop-types': 'off',
'no-undef': 'off',
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': ['warn'],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
varsIgnorePattern: 'logger',
},
],
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-comment': [
'warn',
{
'ts-ignore': 'allow-with-description',
},
],
},
}
module.exports = config