@zayne-labs/eslint-config 0.11.7 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,139 @@
1
+ import { D as TypedFlatConfigItem, t as Awaitable } from "./index-B9wn5XKH.js";
2
+ import { ESLint } from "eslint";
3
+
4
+ //#region src/utils.d.ts
5
+ declare const isObject: <TObject extends object>(value: unknown) => value is TObject;
6
+ /**
7
+ * @description - Combine array and non-array configs into a single array.
8
+ */
9
+ declare const combine: (...configs: Array<Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>>) => Promise<TypedFlatConfigItem[]>;
10
+ declare const interopDefault: <TModule>(module: Awaitable<TModule>) => Promise<TModule extends {
11
+ default: infer TDefaultExport;
12
+ } ? TDefaultExport : TModule>;
13
+ /**
14
+ * @description - Rename plugin prefixes in a rule object.
15
+ * Accepts a map of prefixes to rename.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { renameRules } from '@zayne-labs/eslint-config'
20
+ *
21
+ * export default [{
22
+ * rules: renameRules(
23
+ * {
24
+ * '@typescript-eslint/indent': 'error'
25
+ * },
26
+ * { '@typescript-eslint': 'ts' }
27
+ * )
28
+ * }]
29
+ * ```
30
+ */
31
+ declare const renameRules: (rules: Record<string, unknown> | undefined, renameMap: Record<string, string>) => TypedFlatConfigItem["rules"] | undefined;
32
+ declare const renamePlugins: (plugins: Record<string, unknown> | undefined, renameMap: Record<string, string>) => Record<string, ESLint.Plugin> | undefined;
33
+ type OverrideConfigsOptions = {
34
+ configArray: TypedFlatConfigItem[];
35
+ overrides: TypedFlatConfigItem | ((config: TypedFlatConfigItem) => TypedFlatConfigItem);
36
+ };
37
+ /**
38
+ * @description - Override configurations in a flat configs array with either a static config object or a function that returns a config object
39
+ * @param options - Configuration options
40
+ * @param options.configs - Array of flat config items to override
41
+ * @param options.overrides - Either a config object to merge or a function that takes a config and returns overrides
42
+ * @returns Array of merged config items with overrides applied
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import { overrideConfigs } from '@zayne-labs/eslint-config'
47
+ *
48
+ * // Override with static config
49
+ * overrideConfigs({
50
+ * configArray: existingConfigs,
51
+ * overrides: {
52
+ * rules: {
53
+ * 'no-console': 'error'
54
+ * }
55
+ * }
56
+ * })
57
+ *
58
+ * // Override with function
59
+ * overrideConfigs({
60
+ * configArray: existingConfigs,
61
+ * overrides: (config) => ({
62
+ * ...config,
63
+ * rules: {
64
+ * ...config.rules,
65
+ * 'no-console': 'error'
66
+ * }
67
+ * })
68
+ * })
69
+ * ```
70
+ */
71
+ declare const overrideConfigs: (options: OverrideConfigsOptions) => TypedFlatConfigItem[];
72
+ type RenamePluginInConfigsOptions = {
73
+ configArray: OverrideConfigsOptions["configArray"];
74
+ overrides?: OverrideConfigsOptions["overrides"];
75
+ renameMap: Record<string, string>;
76
+ };
77
+ /**
78
+ * @description - Rename plugin names and rules in a flat configs array
79
+ *
80
+ * @param options - Configuration options
81
+ * @param options.configArray - Array of flat config items to process
82
+ * @param options.overrides - Optional config overrides to apply
83
+ * @param options.renameMap - Map of old plugin names to new names
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * import { renamePluginInConfigs } from '@zayne-labs/eslint-config'
88
+ * import someConfigs from './some-configs'
89
+ *
90
+ * renamePluginInConfigs({
91
+ * configArray: someConfigs,
92
+ * renameMap: {
93
+ * '@typescript-eslint': 'ts',
94
+ * 'import-x': 'import',
95
+ * }
96
+ * })
97
+ * ```
98
+ */
99
+ declare const renamePluginInConfigs: (options: RenamePluginInConfigsOptions) => TypedFlatConfigItem[];
100
+ declare const isPackageInScope: (name: string) => boolean;
101
+ /**
102
+ * @description
103
+ * - Ensures that packages are installed in the current scope.
104
+ * - If they are not installed, and the user is in a TTY, and the user is not in a CI environment,
105
+ * and the user is in the same scope as this package, then prompt the user to
106
+ * install the packages.
107
+ *
108
+ * @param packages - The packages to ensure are installed.
109
+ */
110
+ declare const ensurePackages: (packages: Array<string | undefined>) => Promise<void>;
111
+ declare const resolveOptions: <TObject>(option: boolean | TObject | undefined) => TObject;
112
+ declare const parserPlain: {
113
+ meta: {
114
+ name: string;
115
+ };
116
+ parseForESLint: (code: string) => {
117
+ ast: {
118
+ body: never[];
119
+ comments: never[];
120
+ loc: {
121
+ end: number;
122
+ start: number;
123
+ };
124
+ range: number[];
125
+ tokens: never[];
126
+ type: string;
127
+ };
128
+ scopeManager: null;
129
+ services: {
130
+ isPlain: boolean;
131
+ };
132
+ visitorKeys: {
133
+ Program: never[];
134
+ };
135
+ };
136
+ };
137
+ //#endregion
138
+ export { combine, ensurePackages, interopDefault, isObject, isPackageInScope, overrideConfigs, parserPlain, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions };
139
+ //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js ADDED
@@ -0,0 +1,3 @@
1
+ import { a as isPackageInScope, c as renamePluginInConfigs, d as resolveOptions, i as isObject, l as renamePlugins, n as ensurePackages, o as overrideConfigs, r as interopDefault, s as parserPlain, t as combine, u as renameRules } from "./utils-DPFNmhr6.js";
2
+
3
+ export { combine, ensurePackages, interopDefault, isObject, isPackageInScope, overrideConfigs, parserPlain, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/eslint-config",
3
3
  "type": "module",
4
- "version": "0.11.7",
4
+ "version": "0.11.8",
5
5
  "description": "Zayne Labs' ESLint config preset",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -17,7 +17,8 @@
17
17
  "sideEffects": false,
18
18
  "exports": {
19
19
  ".": "./dist/index.js",
20
- "./constants/*": "./dist/constants/*.js"
20
+ "./constants/*": "./dist/constants/*.js",
21
+ "./utils": "./dist/utils.js"
21
22
  },
22
23
  "bin": "./bin/index.js",
23
24
  "files": [
@@ -180,7 +181,7 @@
180
181
  "tsx": "4.21.0",
181
182
  "typescript": "5.9.3",
182
183
  "vue-eslint-parser": "10.2.0",
183
- "@zayne-labs/tsconfig": "0.11.7"
184
+ "@zayne-labs/tsconfig": "0.11.8"
184
185
  },
185
186
  "publishConfig": {
186
187
  "access": "public",