Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🙏 SPFx v1.15 - Please suppress unnecessary ESLint no-async-await rule #8260

Closed
1 of 9 tasks
andrewconnell opened this issue Jul 2, 2022 · 3 comments
Closed
1 of 9 tasks
Assignees
Labels
area:spfx Category: SharePoint Framework (not extensions related) status:fixed-next-drop Issue planned to be fixed in an upcoming release.
Milestone

Comments

@andrewconnell
Copy link
Collaborator

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version: n/a
  • SPFx version: v1.15
  • Node.js version: v16

Issue description

With the switch to ESLint, seems we're getting a LOT of new listing rules applied. One is entirely unnecessary: @microsoft/spfx/no-async-await.

This rule, defined in the @microsoft/eslint-plugin-spfx package, throws a build warning if it finds the async keyword in the code, either in a method declaration or in an anon function declaration.

The rule states Usage of "async" has overhead when using in older browsers.

This is 100% unnecessary because of the following reasons:

  • We're writing TypeScript for SPFx projects.
  • The default config for the TSC is to generate ES5.
  • The async & await keywords don't exist in ES5.
  • The TSC transpiles these keywords down to the equivalent ES5 code
  • Therefore async & await never exist in the resulting bundle
  • If the keywords aren't in the bundle, they never get deployed, never get loaded, and thus never touch the browser.

Therefore this rule is moot and is just misguiding developers to not use two very keywords for no good reason, under the guise of a 'best practice'.

To block this rule today, disable it in the ./.eslintrc.js file like so:

require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  extends: ['@microsoft/eslint-config-spfx/lib/profiles/default'],
  parserOptions: { tsconfigRootDir: __dirname },
  rules: {
    "@microsoft/spfx/no-async-await": "off"
  }
};

But, IMHO, this rule should be removed from the @microsoft/eslint-plugin-spfx package.

@ghost
Copy link

ghost commented Jul 2, 2022

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 Awaiting categorization and initial review. label Jul 2, 2022
@VesaJuvonen VesaJuvonen added area:spfx Category: SharePoint Framework (not extensions related) and removed Needs: Triage 🔍 Awaiting categorization and initial review. labels Jul 4, 2022
@AJIXuMuK AJIXuMuK self-assigned this Jul 5, 2022
@AJIXuMuK AJIXuMuK added the status:fixed-next-drop Issue planned to be fixed in an upcoming release. label Jul 7, 2022
@AJIXuMuK AJIXuMuK added this to the 1.15.0-next milestone Jul 7, 2022
@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Aug 2, 2022

1.15.2 is out - this should be fixed

@AJIXuMuK AJIXuMuK closed this as completed Aug 2, 2022
@ghost
Copy link

ghost commented Aug 9, 2022

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

@ghost ghost locked as resolved and limited conversation to collaborators Aug 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:spfx Category: SharePoint Framework (not extensions related) status:fixed-next-drop Issue planned to be fixed in an upcoming release.
Projects
None yet
Development

No branches or pull requests

3 participants