-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
node.ts
115 lines (112 loc) · 2.7 KB
/
node.ts
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
109
110
111
112
113
114
115
import type { TSESLint } from "@typescript-eslint/utils";
import n from "eslint-plugin-n"; // eslint-disable-line id-length
import globals from "globals";
const rules: TSESLint.FlatConfig.Rules = {
"no-restricted-globals": [
"error",
{
name: "Buffer",
message: "Import Buffer from `node:buffer` instead",
},
{
name: "process",
message: "Import process from `node:process` instead",
},
{
name: "setTimeout",
message: "Import setTimeout from `node:timers` instead",
},
{
name: "setInterval",
message: "Import setInterval from `node:timers` instead",
},
{
name: "setImmediate",
message: "Import setImmediate from `node:timers` instead",
},
{
name: "clearTimeout",
message: "Import clearTimeout from `node:timers` instead",
},
{
name: "clearInterval",
message: "Import clearInterval from `node:timers` instead",
},
{
name: "clearImmediate",
message: "Import clearImmediate from `node:timers` instead",
},
],
"import-x/no-unresolved": 0,
"n/callback-return": 2,
"n/exports-style": 0,
"n/file-extension-in-import": 0,
"n/global-require": 0,
"n/handle-callback-err": 2,
"n/no-callback-literal": 2,
"n/no-deprecated-api": 2,
"n/no-exports-assign": 2,
"n/no-extraneous-import": 0,
"n/no-extraneous-require": 0,
"n/no-missing-import": 0,
"n/no-missing-require": 0,
"n/no-mixed-requires": 0,
"n/no-new-require": 2,
"n/no-path-concat": 2,
"n/no-process-env": 0,
"n/no-process-exit": 0,
"n/no-restricted-import": 0,
"n/no-restricted-require": 0,
"n/no-sync": [
2,
{
allowAtRootLevel: true,
},
],
"n/no-unpublished-bin": 2,
"n/no-unpublished-import": 0,
"n/no-unpublished-require": 0,
"n/no-unsupported-features/es-builtins": 0,
"n/no-unsupported-features/es-syntax": 0,
"n/no-unsupported-features/node-builtins": 0,
"n/prefer-global/buffer": [2, "never"],
"n/prefer-global/console": [2, "always"],
"n/prefer-global/process": [2, "never"],
"n/prefer-global/text-decoder": [2, "never"],
"n/prefer-global/text-encoder": [2, "never"],
"n/prefer-global/url": [2, "never"],
"n/prefer-global/url-search-params": [2, "never"],
"n/prefer-promises/dns": 0,
"n/prefer-promises/fs": 0,
"n/process-exit-as-throw": 2,
"n/shebang": [
2,
{
convertPath: {
"src/**/*.js": ["^src/(.+?)\\.js$", "dist/$1.js"],
},
},
],
"unicorn/prefer-node-protocol": 2,
"unicorn/require-post-message-target-origin": 0,
};
const config: TSESLint.FlatConfig.ConfigArray = [
{
languageOptions: {
globals: {
...n.configs["recommended-module"].globals,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
globalReturn: true,
},
},
},
plugins: {
n, // eslint-disable-line id-length
},
rules,
},
];
export default config;