forked from xmppjs/xmpp.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
136 lines (130 loc) · 4.09 KB
/
Copy patheslint.config.js
File metadata and controls
136 lines (130 loc) · 4.09 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// eslint-disable-next-line n/no-extraneous-import
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import eslintNodePlugin from "eslint-plugin-n";
import pluginPromise from "eslint-plugin-promise";
import pluginJest from "eslint-plugin-jest";
import importPlugin from "eslint-plugin-import";
export default [
{
ignores: ["**/dist/*.js", "eslint.config.mjs"],
},
js.configs.recommended,
eslintPluginUnicorn.configs["recommended"],
eslintNodePlugin.configs["flat/recommended-script"],
pluginPromise.configs["flat/recommended"],
importPlugin.flatConfigs.errors,
// importPlugin.flatConfigs.recommended,
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.builtin,
...globals["shared-node-browser"],
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
sourceType: "module",
},
rules: {
strict: ["error", "global"],
"no-empty": ["error", { allowEmptyCatch: true }],
// "no-multi-assign": "off",
"func-names": ["error", "as-needed"],
"operator-linebreak": [
"error",
"after",
{ overrides: { "?": "before", ":": "before" } },
],
"capitalized-comments": "off",
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"prefer-object-spread": ["error"],
"prefer-destructuring": [
"error",
{
array: false,
object: true,
},
],
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
"no-redeclare": ["error", { builtinGlobals: false }],
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-console": ["error"],
// node
// https://github.com/eslint-community/eslint-plugin-n/
"n/no-unpublished-require": "off", // doesn't play nice with monorepo
"n/hashbang": "off",
// promise
// https://github.com/xjamundx/eslint-plugin-promise
"promise/prefer-await-to-then": "off",
"promise/prefer-await-to-callbacks": "off",
// unicorn
// https://github.com/sindresorhus/eslint-plugin-unicorn
"unicorn/filename-case": "off",
"unicorn/catch-error-name": ["error", { name: "err" }],
"unicorn/prevent-abbreviations": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-null": "off",
"unicorn/prefer-event-target": "off",
// "unicorn/prefer-top-level-await": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-export-from": "off",
// import
// https://github.com/import-js/eslint-plugin-import/
"import/enforce-node-protocol-usage": ["error", "always"],
"import/order": ["error", { "newlines-between": "always" }],
},
},
{
files: ["**/*.cjs"],
languageOptions: {
sourceType: "commonjs",
},
},
{
files: ["**/*.spec.js", "**/*.test.js", "**/test.js", "**/test/**.js"],
plugins: { jest: pluginJest },
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
rules: {
...pluginJest.configs["flat/style"].rules,
...pluginJest.configs["flat/recommended"].rules,
"jest/no-done-callback": "off",
"jest/prefer-to-be": "off",
"jest/no-conditional-expect": "off",
// https://github.com/jest-community/eslint-plugin-jest/pull/1688
"jest/valid-expect": "off",
// "jest/valid-expect": [
// "error",
// {
// alwaysAwait: true,
// // For jest-extended expect().pass
// minArgs: "off",
// },
// ],
"promise/no-callback-in-promise": "off",
// "n/no-extraneous-require": ["error", { allowModules: ["@xmpp/test"] }],
"n/no-extraneous-import": [
"error",
{
allowModules: [
"@xmpp/test",
"@xmpp/time",
"@xmpp/xml",
"@xmpp/connection",
"@xmpp/websocket",
"selfsigned",
"@xmpp/events",
],
},
],
},
},
];