refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
40
home/ags/node_modules/eslint-plugin-es-x/lib/rules/no-top-level-await.js
generated
vendored
40
home/ags/node_modules/eslint-plugin-es-x/lib/rules/no-top-level-await.js
generated
vendored
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* @author Yosuke Ota
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description: "disallow top-level `await`.",
|
||||
category: "ES2022",
|
||||
recommended: false,
|
||||
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-top-level-await.html",
|
||||
},
|
||||
fixable: null,
|
||||
messages: {
|
||||
forbidden: "ES2022 top-level 'await' is forbidden.",
|
||||
},
|
||||
schema: [],
|
||||
type: "problem",
|
||||
},
|
||||
create(context) {
|
||||
let functionDepth = 0
|
||||
return {
|
||||
":function"() {
|
||||
functionDepth++
|
||||
},
|
||||
":function:exit"() {
|
||||
functionDepth--
|
||||
},
|
||||
"AwaitExpression, ForOfStatement[await=true]"(node) {
|
||||
if (functionDepth > 0) {
|
||||
// not top-level
|
||||
return
|
||||
}
|
||||
context.report({ node, messageId: "forbidden" })
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue