mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Reduce any typings in our eslint rules
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
* @author Michael Ficarra
|
||||
*/
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
import { TSESTree } from '@typescript-eslint/utils';
|
||||
import * as eslint from 'eslint';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -58,7 +58,7 @@ module.exports = {
|
||||
allowTernary = config.allowTernary || false,
|
||||
allowTaggedTemplates = config.allowTaggedTemplates || false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param node any node
|
||||
* @returns whether the given node structurally represents a directive
|
||||
@@ -68,7 +68,7 @@ module.exports = {
|
||||
node.expression.type === 'Literal' && typeof node.expression.value === 'string';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param predicate ([a] -> Boolean) the function used to make the determination
|
||||
* @param list the input list
|
||||
@@ -83,7 +83,7 @@ module.exports = {
|
||||
return list.slice();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param node a Program or BlockStatement node
|
||||
* @returns the leading sequence of directive nodes in the given node's body
|
||||
@@ -92,7 +92,7 @@ module.exports = {
|
||||
return takeWhile(looksLikeDirective, node.body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param node any node
|
||||
* @param ancestors the given node's ancestors
|
||||
@@ -141,7 +141,7 @@ module.exports = {
|
||||
|
||||
return {
|
||||
ExpressionStatement(node: TSESTree.ExpressionStatement) {
|
||||
if (!isValidExpression(node.expression) && !isDirective(node, <TSESTree.Node[]>context.sourceCode.getAncestors(node))) {
|
||||
if (!isValidExpression(node.expression) && !isDirective(node, <TSESTree.Node[]>context.sourceCode.getAncestors(node as ESTree.Node))) {
|
||||
context.report({ node: <ESTree.Node>node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user