initial commit of actions

This commit is contained in:
Dominik Polakovics Polakovics 2026-01-31 18:56:04 +01:00
commit 949ece5785
44660 changed files with 12034344 additions and 0 deletions

View 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}`)
}
})

View 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}`)
}
})

View file

@ -0,0 +1,7 @@
'use strict';
module.exports = (context, badBrowser) => ({
'Literal[bigint]'(node) {
context.report(node, `BigInts are not supported in ${badBrowser}`)
}
})

View file

@ -0,0 +1,7 @@
'use strict';
module.exports = (context, badBrowser) => ({
BindExpression(node) {
context.report(node, `The Bind Operator is not supported in ${badBrowser}`)
}
})

View file

@ -0,0 +1,10 @@
'use strict';
module.exports = (context, badBrowser) => ({
StaticBlock(node) {
context.report(
node,
`Class Static Blocks are not supported in ${badBrowser}`
);
},
});

View 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}`)
}
})

View file

@ -0,0 +1,7 @@
'use strict';
module.exports = (context, badBrowser) => ({
DoExpression(node) {
context.report(node, `Do Expressions are not supported in ${badBrowser}`)
}
})

View 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}`)
}
})

View 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 = []

View 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}`)
}
})

View 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}`)
}
}
}
}

View 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}`)
}
})

View 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}`)
}
})

View 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))
})
}
})
}

View 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}`)
},
})

View 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}`)
}
})

View 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}`)
}
})

View 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}`)
}
})

View 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}`)
}
})

View 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}`)
}
})

View 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}`)
}
})

View 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}`)
}
}
})

View 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}`)
}
}
})

View 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}`)
}
}
})

View 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}`)
}
}
})

View 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}`)
}
}
})

View 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}`)
},
})