eslint-plugin-parentheses-around-await
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.3 • Public • Published

    [WIP] Parentheses around await

    This plugin helps you to avoid a common mistake when using async/await: trying to access properties on an awaited value without wrapping it with parenthesis.

    Example:

      const method = async () => ({
        id: 25
      });
    
      const wrongId = await createModel().id;  // wrongId === undefined
      const correctId = (await createModel()).id; // correctId === 25

    Install

     npm install eslint-plugin-parentheses-around-await
     
     # or
     yarn add eslint-plugin-parentheses-around-await

    Usage

    .eslintrc.js:

    module.exports = {
      "plugins": [
        "eslint-plugin-parentheses-around-await"
      ],
      "rules": {
        "parentheses-around-await": 1 // 2 - error, 1 - warn, 0 - off.
      }
    };

    Install

    npm i eslint-plugin-parentheses-around-await

    DownloadsWeekly Downloads

    29

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    7.86 kB

    Total Files

    15

    Last publish

    Collaborators

    • yakovenkodenis