first commit
This commit is contained in:
5
node_modules/eslint-import-context/lib/index.d.ts
generated
vendored
Normal file
5
node_modules/eslint-import-context/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ChildContext, RuleContext } from './types.js';
|
||||
export type * from './types.js';
|
||||
export * from './utils.js';
|
||||
export declare const setRuleContext: <T = void>(nextRuleContext: ChildContext | RuleContext, callback: () => T) => T;
|
||||
export declare const useRuleContext: () => ChildContext | RuleContext<string, readonly unknown[]> | undefined;
|
||||
30
node_modules/eslint-import-context/lib/index.js
generated
vendored
Normal file
30
node_modules/eslint-import-context/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.useRuleContext = exports.setRuleContext = void 0;
|
||||
__exportStar(require("./utils.js"), exports);
|
||||
let ruleContext;
|
||||
const setRuleContext = (nextRuleContext, callback) => {
|
||||
const currentValue = ruleContext;
|
||||
ruleContext = nextRuleContext;
|
||||
const result = callback();
|
||||
ruleContext = currentValue;
|
||||
return result;
|
||||
};
|
||||
exports.setRuleContext = setRuleContext;
|
||||
const useRuleContext = () => ruleContext;
|
||||
exports.useRuleContext = useRuleContext;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/eslint-import-context/lib/index.js.map
generated
vendored
Normal file
1
node_modules/eslint-import-context/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAA0B;AAE1B,IAAI,WAAmD,CAAA;AAEhD,MAAM,cAAc,GAAG,CAC5B,eAA2C,EAC3C,QAAiB,EACjB,EAAE;IACF,MAAM,YAAY,GAAG,WAAW,CAAA;IAChC,WAAW,GAAG,eAAe,CAAA;IAC7B,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAA;IACzB,WAAW,GAAG,YAAY,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,cAAc,kBAS1B;AAEM,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,WAAW,CAAA;AAAlC,QAAA,cAAc,kBAAoB"}
|
||||
119
node_modules/eslint-import-context/lib/types.d.ts
generated
vendored
Normal file
119
node_modules/eslint-import-context/lib/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
import type { TSESLint } from '@typescript-eslint/utils';
|
||||
import type { KebabCase, LiteralUnion } from 'type-fest';
|
||||
import type { NapiResolveOptions } from 'unrs-resolver';
|
||||
import type { PluginName } from './utils.js';
|
||||
export type FileExtension = `.${string}`;
|
||||
export type DocStyle = 'jsdoc' | 'tomdoc';
|
||||
export interface ResultNotFound {
|
||||
found: false;
|
||||
path?: undefined;
|
||||
}
|
||||
export interface ResultFound {
|
||||
found: true;
|
||||
path: string | null;
|
||||
}
|
||||
export type NewResolverResolve = (modulePath: string, sourceFile: string) => ResolvedResult;
|
||||
export interface NewResolver {
|
||||
interfaceVersion: 3;
|
||||
name?: string;
|
||||
resolve: NewResolverResolve;
|
||||
}
|
||||
export type Resolver = LegacyResolver | NewResolver;
|
||||
export type ResolvedResult = ResultFound | ResultNotFound;
|
||||
export interface NodeResolverOptions extends Omit<NapiResolveOptions, 'extensions'> {
|
||||
basedir?: string;
|
||||
includeCoreModules?: boolean;
|
||||
extensions?: string | readonly string[];
|
||||
paths?: string | readonly string[];
|
||||
moduleDirectory?: string | readonly string[];
|
||||
preserveSymlinks?: boolean;
|
||||
package?: unknown;
|
||||
packageFilter?: unknown;
|
||||
pathFilter?: unknown;
|
||||
packageIterator?: unknown;
|
||||
}
|
||||
export interface WebpackResolverOptions {
|
||||
config?: string | {
|
||||
resolve: NapiResolveOptions;
|
||||
};
|
||||
'config-index'?: number;
|
||||
env?: Record<string, unknown>;
|
||||
argv?: Record<string, unknown>;
|
||||
}
|
||||
export interface TsResolverOptions extends NapiResolveOptions {
|
||||
alwaysTryTypes?: boolean;
|
||||
project?: string[] | string;
|
||||
extensions?: string[];
|
||||
}
|
||||
export type LegacyResolverName = LiteralUnion<'node' | 'typescript' | 'webpack', string>;
|
||||
export type LegacyResolverResolveImport<T = unknown> = (modulePath: string, sourceFile: string, config: T) => string | undefined;
|
||||
export type LegacyResolverResolve<T = unknown> = (modulePath: string, sourceFile: string, config: T) => ResolvedResult;
|
||||
export interface LegacyResolverV1<T> {
|
||||
interfaceVersion?: 1;
|
||||
resolveImport: LegacyResolverResolveImport<T>;
|
||||
}
|
||||
export interface LegacyResolverV2<T> {
|
||||
interfaceVersion: 2;
|
||||
resolve: LegacyResolverResolve<T>;
|
||||
}
|
||||
export type LegacyResolver<T = unknown, U = T> = LegacyResolverV1<U> | LegacyResolverV2<T>;
|
||||
export interface LegacyResolverObjectBase {
|
||||
name: LegacyResolverName;
|
||||
enable?: boolean;
|
||||
options?: unknown;
|
||||
resolver: LegacyResolver;
|
||||
}
|
||||
export interface LegacyNodeResolverObject extends LegacyResolverObjectBase {
|
||||
name: 'node';
|
||||
options?: NodeResolverOptions | boolean;
|
||||
}
|
||||
export interface LegacyTsResolverObject extends LegacyResolverObjectBase {
|
||||
name: 'typescript';
|
||||
options?: TsResolverOptions | boolean;
|
||||
}
|
||||
export interface LegacyWebpackResolverObject extends LegacyResolverObjectBase {
|
||||
name: 'webpack';
|
||||
options?: WebpackResolverOptions | boolean;
|
||||
}
|
||||
export type LegacyResolverObject = LegacyNodeResolverObject | LegacyResolverObjectBase | LegacyTsResolverObject | LegacyWebpackResolverObject;
|
||||
export interface LegacyResolverRecord {
|
||||
[resolve: string]: unknown;
|
||||
node?: NodeResolverOptions | boolean;
|
||||
typescript?: TsResolverOptions | boolean;
|
||||
webpack?: WebpackResolverOptions | boolean;
|
||||
}
|
||||
export type LegacyImportResolver = LegacyResolverName | LegacyResolverName[] | LegacyResolverObject | LegacyResolverObject[] | LegacyResolverRecord | LegacyResolverRecord[];
|
||||
export interface ImportSettings {
|
||||
cache?: {
|
||||
lifetime?: number | '∞' | 'Infinity';
|
||||
};
|
||||
coreModules?: string[];
|
||||
docstyle?: DocStyle[];
|
||||
extensions?: readonly FileExtension[];
|
||||
externalModuleFolders?: string[];
|
||||
ignore?: string[];
|
||||
internalRegex?: string;
|
||||
parsers?: Record<string, readonly FileExtension[]>;
|
||||
resolve?: NodeResolverOptions;
|
||||
resolver?: LegacyImportResolver;
|
||||
'resolver-legacy'?: LegacyImportResolver;
|
||||
'resolver-next'?: NewResolver | NewResolver[];
|
||||
}
|
||||
export type WithPluginName<T extends object | string> = T extends string ? `${PluginName}/${KebabCase<T>}` : {
|
||||
[K in keyof T as WithPluginName<`${KebabCase<K & string>}`>]: T[K];
|
||||
};
|
||||
export type PluginSettings = WithPluginName<ImportSettings>;
|
||||
export interface RuleContext<TMessageIds extends string = string, TOptions extends readonly unknown[] = readonly unknown[]> extends Omit<TSESLint.RuleContext<TMessageIds, TOptions>, 'settings'> {
|
||||
settings: PluginSettings;
|
||||
}
|
||||
export interface ChildContext {
|
||||
cacheKey: string;
|
||||
settings: PluginSettings;
|
||||
parserPath?: string | null;
|
||||
parserOptions?: TSESLint.ParserOptions;
|
||||
languageOptions?: TSESLint.FlatConfig.LanguageOptions;
|
||||
path: string;
|
||||
cwd: string;
|
||||
filename: string;
|
||||
physicalFilename: string;
|
||||
}
|
||||
3
node_modules/eslint-import-context/lib/types.js
generated
vendored
Normal file
3
node_modules/eslint-import-context/lib/types.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/eslint-import-context/lib/types.js.map
generated
vendored
Normal file
1
node_modules/eslint-import-context/lib/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
||||
13
node_modules/eslint-import-context/lib/utils.d.ts
generated
vendored
Normal file
13
node_modules/eslint-import-context/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { ChildContext, RuleContext } from './types.js';
|
||||
export declare const pluginName = "import-x";
|
||||
export type PluginName = typeof pluginName;
|
||||
export declare function getTsconfigWithContext(context: ChildContext | RuleContext): {
|
||||
compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
|
||||
watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
|
||||
typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
|
||||
compileOnSave?: boolean | undefined;
|
||||
files?: string[] | undefined;
|
||||
exclude?: string[] | undefined;
|
||||
include?: string[] | undefined;
|
||||
references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
|
||||
} | null | undefined;
|
||||
47
node_modules/eslint-import-context/lib/utils.js
generated
vendored
Normal file
47
node_modules/eslint-import-context/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pluginName = void 0;
|
||||
exports.getTsconfigWithContext = getTsconfigWithContext;
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const get_tsconfig_1 = require("get-tsconfig");
|
||||
const stable_hash_x_1 = require("stable-hash-x");
|
||||
exports.pluginName = 'import-x';
|
||||
const tsconfigCache = new Map();
|
||||
function getTsconfigWithContext(context) {
|
||||
var _a;
|
||||
const parserOptions = ((_a = context.languageOptions) === null || _a === void 0 ? void 0 : _a.parserOptions) || context.parserOptions;
|
||||
let tsconfigRootDir = parserOptions === null || parserOptions === void 0 ? void 0 : parserOptions.tsconfigRootDir;
|
||||
const project = parserOptions === null || parserOptions === void 0 ? void 0 : parserOptions.project;
|
||||
const cacheKey = (0, stable_hash_x_1.stableHash)([tsconfigRootDir, project]);
|
||||
let tsconfig;
|
||||
if (tsconfigCache.has(cacheKey)) {
|
||||
tsconfig = tsconfigCache.get(cacheKey);
|
||||
}
|
||||
else {
|
||||
tsconfigRootDir =
|
||||
tsconfigRootDir ||
|
||||
process.cwd();
|
||||
let tsconfigResult;
|
||||
if (project) {
|
||||
const projects = Array.isArray(project) ? project : [project];
|
||||
for (const project of projects) {
|
||||
tsconfigResult = (0, get_tsconfig_1.getTsconfig)(project === true
|
||||
? context.physicalFilename
|
||||
: node_path_1.default.resolve(tsconfigRootDir, project));
|
||||
if (tsconfigResult) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
tsconfigResult = (0, get_tsconfig_1.getTsconfig)(tsconfigRootDir);
|
||||
}
|
||||
tsconfig = tsconfigResult === null || tsconfigResult === void 0 ? void 0 : tsconfigResult.config;
|
||||
tsconfigCache.set(cacheKey, tsconfig);
|
||||
}
|
||||
return tsconfig;
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/eslint-import-context/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/eslint-import-context/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[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