Upgrade to ESLint 9
This commit is contained in:
@ -6,7 +6,12 @@ import {
|
||||
isTypeFlagSet,
|
||||
isTypeNeverType,
|
||||
} from '@typescript-eslint/type-utils';
|
||||
import { AST_NODE_TYPES, ESLintUtils, type TSESTree } from '@typescript-eslint/utils';
|
||||
import {
|
||||
AST_NODE_TYPES,
|
||||
ESLintUtils,
|
||||
ParserServicesWithTypeInformation,
|
||||
type TSESTree,
|
||||
} from '@typescript-eslint/utils';
|
||||
import { getParserServices } from '@typescript-eslint/utils/eslint-utils';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
@ -52,8 +57,14 @@ export default createRule<Option[], MessageId>({
|
||||
},
|
||||
defaultOptions: [defaultOption],
|
||||
create(context, [options]) {
|
||||
const services = getParserServices(context);
|
||||
if (!services.program) return {};
|
||||
let services: ParserServicesWithTypeInformation | undefined;
|
||||
try {
|
||||
services = getParserServices(context);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
if (!services?.program) return {};
|
||||
|
||||
const checker = services.program.getTypeChecker();
|
||||
const allowed = new Set(options.allow);
|
||||
|
Reference in New Issue
Block a user