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:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
import * as ESTree from 'estree';
|
||||
import { TSESTree } from '@typescript-eslint/utils';
|
||||
|
||||
export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener {
|
||||
@@ -16,24 +17,24 @@ export function createImportRuleListener(validateImport: (node: TSESTree.Literal
|
||||
|
||||
return {
|
||||
// import ??? from 'module'
|
||||
ImportDeclaration: (node: any) => {
|
||||
_checkImport((<TSESTree.ImportDeclaration>node).source);
|
||||
ImportDeclaration: (node: ESTree.ImportDeclaration) => {
|
||||
_checkImport((node as TSESTree.ImportDeclaration).source);
|
||||
},
|
||||
// import('module').then(...) OR await import('module')
|
||||
['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node: any) => {
|
||||
['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node: TSESTree.Literal) => {
|
||||
_checkImport(node);
|
||||
},
|
||||
// import foo = ...
|
||||
['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node: any) => {
|
||||
['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node: TSESTree.Literal) => {
|
||||
_checkImport(node);
|
||||
},
|
||||
// export ?? from 'module'
|
||||
ExportAllDeclaration: (node: any) => {
|
||||
_checkImport((<TSESTree.ExportAllDeclaration>node).source);
|
||||
ExportAllDeclaration: (node: ESTree.ExportAllDeclaration) => {
|
||||
_checkImport((node as TSESTree.ExportAllDeclaration).source);
|
||||
},
|
||||
// export {foo} from 'module'
|
||||
ExportNamedDeclaration: (node: any) => {
|
||||
_checkImport((<TSESTree.ExportNamedDeclaration>node).source);
|
||||
ExportNamedDeclaration: (node: ESTree.ExportNamedDeclaration) => {
|
||||
_checkImport((node as TSESTree.ExportNamedDeclaration).source);
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user