2026-04-03
- eslint OK - import OK - jsdoc OK - node OK - oxc OK - promise OK
This commit is contained in:
parent
93dd909919
commit
357c8bf05e
22 changed files with 2431 additions and 1600 deletions
64
rules/promise.ts
Normal file
64
rules/promise.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const promiseRules: DummyRuleMap = {
|
||||
"promise/always-return": [
|
||||
"deny",
|
||||
{
|
||||
ignoreAssignmentVariable: ["globalThis"],
|
||||
ignoreLastCallback: false,
|
||||
},
|
||||
],
|
||||
"promise/avoid-new": "deny",
|
||||
"promise/catch-or-return": [
|
||||
"deny",
|
||||
{
|
||||
allowFinally: false,
|
||||
allowThen: false,
|
||||
terminationMethod: ["catch"],
|
||||
},
|
||||
],
|
||||
"promise/no-callback-in-promise": [
|
||||
"deny",
|
||||
{
|
||||
callbacks: ["callback", "cb", "done", "next"],
|
||||
exceptions: [],
|
||||
timeoutsErr: false,
|
||||
},
|
||||
],
|
||||
"promise/no-multiple-resolved": "deny",
|
||||
"promise/no-nesting": "deny",
|
||||
"promise/no-new-statics": "deny",
|
||||
"promise/no-promise-in-callback": "deny",
|
||||
"promise/no-return-in-finally": "deny",
|
||||
"promise/no-return-wrap": [
|
||||
"deny",
|
||||
{
|
||||
allowReject: false,
|
||||
},
|
||||
],
|
||||
"promise/param-names": [
|
||||
"deny",
|
||||
{
|
||||
rejectPattern: "^_?reject$",
|
||||
resolvePattern: "^_?resolve$",
|
||||
},
|
||||
],
|
||||
// Émet de faux positifs avec Effect.
|
||||
"promise/prefer-await-to-callbacks": "allow",
|
||||
"promise/prefer-await-to-then": [
|
||||
"deny",
|
||||
{
|
||||
strict: true,
|
||||
},
|
||||
],
|
||||
"promise/prefer-catch": "deny",
|
||||
"promise/spec-only": [
|
||||
"deny",
|
||||
{
|
||||
allowedMethods: [],
|
||||
},
|
||||
],
|
||||
"promise/valid-params": "deny",
|
||||
};
|
||||
|
||||
export default promiseRules;
|
||||
Loading…
Add table
Add a link
Reference in a new issue