新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { Scope, SourceCode, Rule } from 'eslint';
|
|
import * as ESTree from 'estree';
|
|
|
|
type LegacyContext = {
|
|
getFilename: () => string,
|
|
getPhysicalFilename: () => string,
|
|
getSourceCode: () => SourceCode,
|
|
getScope: never,
|
|
getAncestors: never,
|
|
getDeclaredVariables: never,
|
|
};
|
|
|
|
type NewContext = {
|
|
filename: string,
|
|
sourceCode: SourceCode,
|
|
getPhysicalFilename?: () => string,
|
|
getScope: () => Scope.Scope,
|
|
getAncestors: () => ESTree.Node[],
|
|
getDeclaredVariables: (node: ESTree.Node) => Scope.Variable[],
|
|
};
|
|
|
|
export type Context = LegacyContext | NewContext | Rule.RuleContext;
|
|
|
|
declare function getAncestors(context: Context, node: ESTree.Node): ESTree.Node[];
|
|
declare function getDeclaredVariables(context: Context, node: ESTree.Node): Scope.Variable[];
|
|
declare function getFilename(context: Context): string;
|
|
declare function getPhysicalFilename(context: Context): string;
|
|
declare function getScope(context: Context, node: ESTree.Node): Scope.Scope;
|
|
declare function getSourceCode(context: Context): SourceCode;
|
|
|
|
export {
|
|
getAncestors,
|
|
getDeclaredVariables,
|
|
getFilename,
|
|
getPhysicalFilename,
|
|
getScope,
|
|
getSourceCode,
|
|
};
|