initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-async-generator.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-async-generator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
':function[async=true][generator=true]'(node) {
|
||||
context.report(node, `Async Generators are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-async-iteration.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-async-iteration.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'ForOfStatement[await=true]'(node) {
|
||||
context.report(node, `Async Iteration is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-bigint.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-bigint.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[bigint]'(node) {
|
||||
context.report(node, `BigInts are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-bind-operator.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-bind-operator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
BindExpression(node) {
|
||||
context.report(node, `The Bind Operator is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-class-static-blocks.js
generated
vendored
Normal file
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-class-static-blocks.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
StaticBlock(node) {
|
||||
context.report(
|
||||
node,
|
||||
`Class Static Blocks are not supported in ${badBrowser}`
|
||||
);
|
||||
},
|
||||
});
|
||||
11
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-computed-public-class-fields.js
generated
vendored
Normal file
11
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-computed-public-class-fields.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
// Ignore type annotations that don't assign
|
||||
'ClassProperty[computed=true]:not([typeAnnotation]:not([value]))'(node) {
|
||||
context.report(node, `Computed Class Fields are not supported in ${badBrowser}`)
|
||||
},
|
||||
'PropertyDefinition[computed=true]:not([typeAnnotation]:not([value]))'(node) {
|
||||
context.report(node, `Computed Class Fields are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-do-expression.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-do-expression.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
DoExpression(node) {
|
||||
context.report(node, `Do Expressions are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-dynamic-imports.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-dynamic-imports.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'ImportExpression, CallExpression[callee.type="Import"]'(node) {
|
||||
context.report(node, `Dynamic import is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
31
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-edge-destructure-bug.js
generated
vendored
Normal file
31
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-edge-destructure-bug.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
const objectPatternHasDefaults = node =>
|
||||
node.type === 'ObjectPattern' && node.properties.some(prop => prop.value.type === 'AssignmentPattern')
|
||||
|
||||
module.exports = function(context) {
|
||||
return {
|
||||
ArrowFunctionExpression(node) {
|
||||
// Unary functions don't trip on this bug
|
||||
if (node.params.length < 2) return
|
||||
|
||||
// This bug only occurs when some arguments use Object destructuring
|
||||
if (!node.params.some(param => param.type === 'ObjectPattern')) return
|
||||
|
||||
const objectPatternArgs = node.params.filter(node => node.type === 'ObjectPattern')
|
||||
|
||||
// This bug is only occurs when an argument uses Object Destructuring with Default assignment
|
||||
if (!objectPatternArgs.some(objectPatternHasDefaults)) return
|
||||
|
||||
// This bug gets fixed if the first argument uses Object destructuring with default assignments!
|
||||
if (node.params[0].type === 'ObjectPattern' && objectPatternHasDefaults(node.params[0])) return
|
||||
|
||||
context.report(
|
||||
node,
|
||||
'There is an Edge 15-17 bug which causes second argument destructuring to fail. See https://git.io/fhd7N for more'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.schema = []
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-exponentiation-operator.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-exponentiation-operator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'AssignmentExpression[operator="**="], BinaryExpression[operator="**"]'(node) {
|
||||
context.report(node, `Exponentiation Operator is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-hashbang-comment.js
generated
vendored
Normal file
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-hashbang-comment.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => {
|
||||
const { sourceCode = context.getSourceCode() } = context;
|
||||
return {
|
||||
'Program:exit' (node) {
|
||||
const [comment] = sourceCode.getAllComments();
|
||||
if (comment && comment.type === 'Shebang') {
|
||||
context.report(node, `Hashbang comments are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-logical-assignment-operator.js
generated
vendored
Normal file
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-logical-assignment-operator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'AssignmentExpression[operator="||="]'(node) {
|
||||
context.report(node, `Logical assignment operators are not supported in ${badBrowser}`)
|
||||
},
|
||||
'AssignmentExpression[operator="&&="]'(node) {
|
||||
context.report(node, `Logical assignment operators are not supported in ${badBrowser}`)
|
||||
},
|
||||
'AssignmentExpression[operator="??="]'(node) {
|
||||
context.report(node, `Logical assignment operators are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-nullish-coalescing.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-nullish-coalescing.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'LogicalExpression[operator="??"]'(node) {
|
||||
context.report(node, `the Nullish Coalescing Operator is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
16
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-numeric-separators.js
generated
vendored
Normal file
16
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-numeric-separators.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
fixable: 'code'
|
||||
},
|
||||
create: (context, badBrowser) => ({
|
||||
'Literal[raw=/_/][value>=0], Literal[raw=/_/][value<=0]'(node) {
|
||||
context.report({
|
||||
node,
|
||||
message: `Numeric Separators are not supported in ${badBrowser}`,
|
||||
fix: fixer => fixer.replaceText(node, String(node.value))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
18
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-object-rest-spread.js
generated
vendored
Normal file
18
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-object-rest-spread.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'ObjectExpression > SpreadElement'(node) {
|
||||
context.report(node, `Object Rest/Spread is not supported in ${badBrowser}`)
|
||||
},
|
||||
'ObjectPattern > RestElement'(node) {
|
||||
context.report(node, `Object Rest/Spread is not supported in ${badBrowser}`)
|
||||
},
|
||||
|
||||
// Catch older versions of eslint and babel-eslint
|
||||
ExperimentalRestProperty(node) {
|
||||
context.report(node, `Object Rest/Spread is not supported in ${badBrowser}`)
|
||||
},
|
||||
ExperimentalSpreadProperty(node) {
|
||||
context.report(node, `Object Rest/Spread is not supported in ${badBrowser}`)
|
||||
},
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-optional-catch.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-optional-catch.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'CatchClause:not([param])'(node) {
|
||||
context.report(node, `Optional Catch Parameters are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-optional-chaining.js
generated
vendored
Normal file
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-optional-chaining.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
OptionalMemberExpression(node) {
|
||||
context.report(node, `Optional Chaining is not supported in ${badBrowser}`)
|
||||
},
|
||||
ChainExpression(node) {
|
||||
context.report(node, `Optional Chaining is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-pipeline-operator.js
generated
vendored
Normal file
7
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-pipeline-operator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'BinaryExpression[operator="|>"]'(node) {
|
||||
context.report(node, `The Pipeline Operator is not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-private-class-fields.js
generated
vendored
Normal file
10
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-private-class-fields.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
ClassPrivateProperty(node) {
|
||||
context.report(node, `Private Class Fields are not supported in ${badBrowser}`)
|
||||
},
|
||||
PrivateIdentifier(node) {
|
||||
context.report(node, `Private Class Fields are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-public-instance-class-fields.js
generated
vendored
Normal file
13
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-public-instance-class-fields.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
// Ignore type annotations that don't assign
|
||||
'ClassProperty[static=false]:not([typeAnnotation]:not([value]))'(node) {
|
||||
if (node.value === null) return
|
||||
context.report(node, `Instance Class Fields are not supported in ${badBrowser}`)
|
||||
},
|
||||
'PropertyDefinition[static=false]:not([typeAnnotation]:not([value]))'(node) {
|
||||
if (node.value === null) return
|
||||
context.report(node, `Instance Class Fields are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
11
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-public-static-class-fields.js
generated
vendored
Normal file
11
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-public-static-class-fields.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
// Ignore type annotations that don't assign
|
||||
'ClassProperty[static=true]:not([typeAnnotation]:not([value]))'(node) {
|
||||
context.report(node, `Static Class Fields are not supported in ${badBrowser}`)
|
||||
},
|
||||
'PropertyDefinition[static=true]:not([typeAnnotation]:not([value]))'(node) {
|
||||
context.report(node, `Static Class Fields are not supported in ${badBrowser}`)
|
||||
}
|
||||
})
|
||||
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-duplicate-named-groups.js
generated
vendored
Normal file
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-duplicate-named-groups.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const hasDuplicateNamedGroups = s => /(\(\?<[_$\w]*?)>.*?\1>/.test(s)
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (hasDuplicateNamedGroups(node.regex.pattern)) {
|
||||
context.report(node, `RegExp duplicate named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [source] = node.arguments;
|
||||
if (
|
||||
source &&
|
||||
(
|
||||
(
|
||||
source.type === 'Literal' &&
|
||||
typeof source.value === 'string' &&
|
||||
hasDuplicateNamedGroups(source.value)
|
||||
) ||
|
||||
(
|
||||
source.type === 'TemplateLiteral' &&
|
||||
source.quasis.some(({value: {raw}}) => hasDuplicateNamedGroups(raw))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp duplicate named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-lookbehind.js
generated
vendored
Normal file
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-lookbehind.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const hasLookbehind = s => s.includes('(?<=') || s.includes('(?<!')
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (hasLookbehind(node.regex.pattern)) {
|
||||
context.report(node, `RegExp lookbehinds are not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [source] = node.arguments;
|
||||
if (
|
||||
source &&
|
||||
(
|
||||
(
|
||||
source.type === 'Literal' &&
|
||||
typeof source.value === 'string' &&
|
||||
hasLookbehind(source.value)
|
||||
) ||
|
||||
(
|
||||
source.type === 'TemplateLiteral' &&
|
||||
source.quasis.some(({value: {raw}}) => hasLookbehind(raw))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp lookbehinds are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-named-group.js
generated
vendored
Normal file
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-named-group.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const hasNamedGroup = s => /\(\?<[_$\w]/.test(s)
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (hasNamedGroup(node.regex.pattern)) {
|
||||
context.report(node, `RegExp named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [source] = node.arguments;
|
||||
if (
|
||||
source &&
|
||||
(
|
||||
(
|
||||
source.type === 'Literal' &&
|
||||
typeof source.value === 'string' &&
|
||||
hasNamedGroup(source.value)
|
||||
) ||
|
||||
(
|
||||
source.type === 'TemplateLiteral' &&
|
||||
source.quasis.some(({value: {raw}}) => hasNamedGroup(raw))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
28
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-s-flag.js
generated
vendored
Normal file
28
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-s-flag.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (node.regex.flags.includes('s')) {
|
||||
context.report(node, `RegExp "s" flag is not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [, flags] = node.arguments;
|
||||
if (
|
||||
flags &&
|
||||
(
|
||||
(
|
||||
flags.type === 'Literal' &&
|
||||
typeof flags.value === 'string' &&
|
||||
flags.value.includes('s')
|
||||
) ||
|
||||
(
|
||||
flags.type === 'TemplateLiteral' &&
|
||||
flags.quasis.some(({value: {raw}}) => raw.includes('s'))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp "s" flag is not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
28
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-v-flag.js
generated
vendored
Normal file
28
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-v-flag.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (node.regex.flags.includes('v')) {
|
||||
context.report(node, `RegExp "v" flag is not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [, flags] = node.arguments;
|
||||
if (
|
||||
flags &&
|
||||
(
|
||||
(
|
||||
flags.type === 'Literal' &&
|
||||
typeof flags.value === 'string' &&
|
||||
flags.value.includes('v')
|
||||
) ||
|
||||
(
|
||||
flags.type === 'TemplateLiteral' &&
|
||||
flags.quasis.some(({value: {raw}}) => raw.includes('v'))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp "v" flag is not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
20
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-top-level-await.js
generated
vendored
Normal file
20
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-top-level-await.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const functionTypes = new Set([
|
||||
'FunctionDeclaration',
|
||||
'FunctionExpression',
|
||||
'ArrowFunctionExpression',
|
||||
]);
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
AwaitExpression(node) {
|
||||
let currentNode = node;
|
||||
while (currentNode.parent) {
|
||||
currentNode = currentNode.parent;
|
||||
if (functionTypes.has(currentNode.type) && currentNode.async) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
context.report(node, `Top-level await is not supported in ${badBrowser}`)
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue