Bumping eslint versions (#141121)

* hBumping eslint versions

- Bump eslint and typescript/eslint versions to latest
- Fixing `code-no-unused-expression` for `x?.(b);` type statements
- Fixed a few new semicolon errors from upgrade

* Bump eslint parser in build

* Fix eslint errors in d.ts
This commit is contained in:
Matt Bierner
2022-01-26 16:29:14 -08:00
committed by GitHub
parent 33dc880511
commit f30dba5430
9 changed files with 560 additions and 276 deletions

View File

@@ -108,13 +108,16 @@ module.exports = {
if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') {
return true;
}
return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await)Expression$/u.test(node.type) ||
if (node.type === 'ExpressionStatement') {
return isValidExpression(node.expression);
}
return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await|Chain)Expression$/u.test(node.type) ||
(node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0);
}
return {
ExpressionStatement(node) {
if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) {
context.report({ node: node, message: 'Expected an assignment or function call and instead saw an expression.' });
context.report({ node: node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` });
}
}
};