Skip to content

Commit

Permalink
fix: no-floating-promises (projen#1628)
Browse files Browse the repository at this point in the history
Using `yarn eslint` I noticed a rule break defined here https://github.com/projen/projen/blob/main/.eslintrc.json#L95

https://typescript-eslint.io/rules/no-floating-promises/

```
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.eslint[@typescript-eslint/no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises)
```

---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
mmuller88 authored Feb 21, 2022
1 parent 164c959 commit 2d08e72
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
19 changes: 11 additions & 8 deletions src/web/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,18 @@ class ReactSampleCode extends Component {
"",
"const reportWebVitals = (onPerfEntry?: ReportHandler) => {",
" if (onPerfEntry && onPerfEntry instanceof Function) {",
" import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {",
" getCLS(onPerfEntry);",
" getFID(onPerfEntry);",
" getFCP(onPerfEntry);",
" getLCP(onPerfEntry);",
" getTTFB(onPerfEntry);",
" });",
" import('web-vitals').then(",
" ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {",
" getCLS(onPerfEntry);",
" getFID(onPerfEntry);",
" getFCP(onPerfEntry);",
" getLCP(onPerfEntry);",
" getTTFB(onPerfEntry);",
" },",
" () => {}",
" );",
" }",
"}",
"};",
"",
"export default reportWebVitals;",
];
Expand Down
19 changes: 11 additions & 8 deletions test/web/__snapshots__/react-project.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions test/web/__snapshots__/react-ts-project.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d08e72

Please sign in to comment.