Check out this TypeScript snippet I've simplified to showcase a problem:
import * as argon2 from "argon2";
export default async function(password:string):Promise<string>
{
return argon2.hash(password, {
type: argon2.argon2id,
memoryCost: 32768,
parallelism: 4,
timeCost: 12
});
};
The objective is to customize parameters for the Argon2 hash method. The code seems functional, but my ESLint setup is causing issues. Here's the pertinent part of my ESLint configuration:
"require-await": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/promise-function-async": [
"error",
{
"allowAny": false
}
],
When the async
keyword is included, it triggers the "require-await" rule
But removing the async
keyword causes an issue with the "promise-function-async" rule
I'm contemplating:
- If there's a more efficient way to configure ESLint
- If there's a better approach to writing the function that avoids these problems (could it be pointing out a possible bug I'm overlooking?)
- If using
// eslint-disable-next-line
is justified in this scenario