Closed
Description
What version of this package are you using?
14.3.4
What operating system, Node.js, and npm version?
Node: 14.13.0
npm: 6.14.8
OS: macOS Catalina 10.15.5
What happened?
Given code:
import { fileURLToPath } from 'url'
import fs from 'fs'
const file = await fs.promise.readFile(fileURLToPath(import.meta.url))
console.log(file.toString())
Output is:
standard: Use JavaScript Standard Style (https://standardjs.com)
example.mjs:3:14: Parsing error: Cannot use keyword 'await' outside an async function
What did you expect to happen?
Top-level await
is a stage 3 proposal (see https://tc39.es/proposal-top-level-await/) but is enabled by default in from Node 14.8.0 (see https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V14.md#2020-08-11-version-1480-current-codebytere).
This is going to mean that linting with apps written for Node 14+ will be problematic, as top-level await is bound to be used.
Since Node 14 is becoming Active LTS in a few weeks I think TLA should pass linting
Are you willing to submit a pull request to fix this bug?
yes
Metadata
Metadata
Assignees
Type
Projects
Status
Done