@isentinel/eslint-config 4.7.0 → 4.7.2
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.
- package/dist/index.d.mts +4 -158
- package/dist/index.mjs +2 -40
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Options, Options as PrettierOptions } from "prettier";
|
|
2
2
|
import { StylisticCustomizeOptions } from "@stylistic/eslint-plugin";
|
|
3
|
-
import
|
|
3
|
+
import "@eslint/compat";
|
|
4
4
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
5
5
|
import { ParserOptions } from "@typescript-eslint/parser";
|
|
6
6
|
import { Linter } from "eslint";
|
|
@@ -16702,160 +16702,6 @@ type ConfigNames = 'isentinel/eslint/comments' | 'isentinel/eslint/comments/src'
|
|
|
16702
16702
|
//#endregion
|
|
16703
16703
|
//#region src/utils.d.ts
|
|
16704
16704
|
type ExtractRuleOptions<T> = T extends Linter.RuleEntry<infer U> ? U : never;
|
|
16705
|
-
type ModuleImport<T> = Promise<T | {
|
|
16706
|
-
default: T;
|
|
16707
|
-
}>;
|
|
16708
|
-
type Parser = NonNullable<FlatConfig["languageOptions"]>["parser"];
|
|
16709
|
-
declare const require: NodeJS.Require;
|
|
16710
|
-
declare const parserPlain: {
|
|
16711
|
-
meta: {
|
|
16712
|
-
name: string;
|
|
16713
|
-
};
|
|
16714
|
-
parseForESLint: (code: string) => {
|
|
16715
|
-
ast: {
|
|
16716
|
-
body: never[];
|
|
16717
|
-
comments: never[];
|
|
16718
|
-
loc: {
|
|
16719
|
-
end: number;
|
|
16720
|
-
start: number;
|
|
16721
|
-
};
|
|
16722
|
-
range: number[];
|
|
16723
|
-
tokens: never[];
|
|
16724
|
-
type: string;
|
|
16725
|
-
};
|
|
16726
|
-
scopeManager: null;
|
|
16727
|
-
services: {
|
|
16728
|
-
isPlain: boolean;
|
|
16729
|
-
};
|
|
16730
|
-
visitorKeys: {
|
|
16731
|
-
Program: never[];
|
|
16732
|
-
};
|
|
16733
|
-
};
|
|
16734
|
-
};
|
|
16735
|
-
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
16736
|
-
/**
|
|
16737
|
-
* Combine array and non-array configs into a single array.
|
|
16738
|
-
*
|
|
16739
|
-
* @param configs - The configs to combine.
|
|
16740
|
-
* @returns The combined array.
|
|
16741
|
-
*/
|
|
16742
|
-
declare function combine(...configs: Array<Awaitable<Array<TypedFlatConfigItem> | TypedFlatConfigItem>>): Promise<Array<TypedFlatConfigItem>>;
|
|
16743
|
-
declare function createTsParser(options: {
|
|
16744
|
-
componentExtensions?: Array<string>;
|
|
16745
|
-
configName: string;
|
|
16746
|
-
files: Array<string>;
|
|
16747
|
-
ignores?: Array<string>;
|
|
16748
|
-
outOfProjectFiles?: Array<string>;
|
|
16749
|
-
parser: Parser;
|
|
16750
|
-
parserOptions?: ParserOptions;
|
|
16751
|
-
parserOptionsNonTypeAware?: ParserOptions;
|
|
16752
|
-
parserOptionsTypeAware?: ParserOptions;
|
|
16753
|
-
tsconfigPath?: string;
|
|
16754
|
-
typeAware: boolean;
|
|
16755
|
-
}): TypedFlatConfigItem;
|
|
16756
|
-
declare function ensurePackages(packages: Array<string | undefined>): Promise<void>;
|
|
16757
|
-
declare function getOverrides(options: OptionsConfig, key: keyof OptionsConfig): {
|
|
16758
|
-
overrides: TypedFlatConfigItem["rules"];
|
|
16759
|
-
overridesTypeAware: TypedFlatConfigItem["rules"];
|
|
16760
|
-
};
|
|
16761
|
-
declare function getTsConfig(tsconfigPath?: string): string | undefined;
|
|
16762
|
-
declare function interopDefault<T>(dynamicImport: ModuleImport<T>): Promise<T>;
|
|
16763
|
-
declare function isInEditorEnvironment(): boolean;
|
|
16764
|
-
declare function isInGitHooksOrLintStaged(): boolean;
|
|
16765
|
-
/**
|
|
16766
|
-
* Merge custom glob patterns.
|
|
16767
|
-
*
|
|
16768
|
-
* - Patterns starting with "!" are used to remove matching patterns
|
|
16769
|
-
* - Other patterns are added to the result.
|
|
16770
|
-
*
|
|
16771
|
-
* @example
|
|
16772
|
-
*
|
|
16773
|
-
* ```ts
|
|
16774
|
-
* const result = mergeGlobs(GLOB_ROOT, ["places/**", "!apps/**"]);
|
|
16775
|
-
* // Returns: ["*", "packages/**", "libs/**", "places/**"]
|
|
16776
|
-
* ```
|
|
16777
|
-
*
|
|
16778
|
-
* @param globs - The default root glob patterns.
|
|
16779
|
-
* @param additionalPatterns - Custom root patterns to merge (optional).
|
|
16780
|
-
* @returns The merged array of glob patterns.
|
|
16781
|
-
*/
|
|
16782
|
-
declare function mergeGlobs(globs: Array<string>, additionalPatterns?: Array<string>): Array<string>;
|
|
16783
|
-
declare function mergePrettierOptions(options: PrettierOptions, overrides?: PrettierRuleOptions): Record<string, any>;
|
|
16784
|
-
/**
|
|
16785
|
-
* Rename plugin names a flat configs array.
|
|
16786
|
-
*
|
|
16787
|
-
* @example
|
|
16788
|
-
*
|
|
16789
|
-
* ```ts
|
|
16790
|
-
* import { renamePluginInConfigs } from "@antfu/eslint-config";
|
|
16791
|
-
* import someConfigs from "./some-configs";
|
|
16792
|
-
*
|
|
16793
|
-
* export default renamePluginInConfigs(someConfigs, {
|
|
16794
|
-
* "@typescript-eslint": "ts",
|
|
16795
|
-
* "import-x": "import",
|
|
16796
|
-
* });
|
|
16797
|
-
* ```
|
|
16798
|
-
*
|
|
16799
|
-
* @param configs - The configs array to rename.
|
|
16800
|
-
* @param map - A map of prefixes to rename.
|
|
16801
|
-
* @returns The renamed configs array.
|
|
16802
|
-
*/
|
|
16803
|
-
declare function renamePluginInConfigs(configs: Array<TypedFlatConfigItem>, map: Record<string, string>): Array<TypedFlatConfigItem>;
|
|
16804
|
-
/**
|
|
16805
|
-
* Rename plugin prefixes in a rule object. Accepts a map of prefixes to rename.
|
|
16806
|
-
*
|
|
16807
|
-
* @example
|
|
16808
|
-
*
|
|
16809
|
-
* ```ts
|
|
16810
|
-
* import { renameRules } from "@antfu/eslint-config";
|
|
16811
|
-
*
|
|
16812
|
-
* export default [
|
|
16813
|
-
* {
|
|
16814
|
-
* rules: renameRules(
|
|
16815
|
-
* {
|
|
16816
|
-
* "@typescript-eslint/indent": "error",
|
|
16817
|
-
* },
|
|
16818
|
-
* { "@typescript-eslint": "ts" },
|
|
16819
|
-
* ),
|
|
16820
|
-
* },
|
|
16821
|
-
* ];
|
|
16822
|
-
* ```
|
|
16823
|
-
*
|
|
16824
|
-
* @param rules - The rules object to rename.
|
|
16825
|
-
* @param map - A map of prefixes to rename.
|
|
16826
|
-
* @returns The renamed rules object.
|
|
16827
|
-
*/
|
|
16828
|
-
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
16829
|
-
/**
|
|
16830
|
-
* Resolve Prettier configuration options for the project.
|
|
16831
|
-
*
|
|
16832
|
-
* @returns The Prettier configuration options, or an empty object if none
|
|
16833
|
-
* found.
|
|
16834
|
-
*/
|
|
16835
|
-
declare function resolvePrettierConfigOptions(): Promise<PrettierOptions>;
|
|
16836
|
-
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
16837
|
-
/**
|
|
16838
|
-
* Resolve options with default values. Handles the pattern where `true` means
|
|
16839
|
-
* "use defaults", `false` disables the feature, and objects are used as-is.
|
|
16840
|
-
*
|
|
16841
|
-
* @template T - The type of the defaults object.
|
|
16842
|
-
* @param value - The option value (true | false | undefined | object).
|
|
16843
|
-
* @param defaults - Default values to use when value is true or undefined.
|
|
16844
|
-
* @returns The resolved options.
|
|
16845
|
-
*/
|
|
16846
|
-
declare function resolveWithDefaults<T>(value: boolean | T | undefined, defaults: T): false | T;
|
|
16847
|
-
/**
|
|
16848
|
-
* Check if a feature should be enabled based on options. Handles the pattern
|
|
16849
|
-
* where features can be disabled globally or individually.
|
|
16850
|
-
*
|
|
16851
|
-
* @template T - The type of the options object.
|
|
16852
|
-
* @template K - The key type within the options object.
|
|
16853
|
-
* @param options - The options object (true | false | undefined | object).
|
|
16854
|
-
* @param key - The key to check within the options object.
|
|
16855
|
-
* @param defaultValue - Default value when key is not specified.
|
|
16856
|
-
* @returns Whether the feature should be enabled.
|
|
16857
|
-
*/
|
|
16858
|
-
declare function shouldEnableFeature<T extends Record<string, any>>(options: boolean | T | undefined, key: keyof T, defaultValue?: boolean): boolean;
|
|
16859
16705
|
//#endregion
|
|
16860
16706
|
//#region src/types.d.ts
|
|
16861
16707
|
type Awaitable<T> = Promise<T> | T;
|
|
@@ -17492,9 +17338,9 @@ declare const GLOB_TOML = "**/*.toml";
|
|
|
17492
17338
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
17493
17339
|
declare const GLOB_XML = "**/*.xml";
|
|
17494
17340
|
declare const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
17495
|
-
declare const GLOB_TESTS: string
|
|
17496
|
-
declare const GLOB_BUILD_TOOLS: string
|
|
17341
|
+
declare const GLOB_TESTS: Array<string>;
|
|
17342
|
+
declare const GLOB_BUILD_TOOLS: Array<string>;
|
|
17497
17343
|
declare const GLOB_ALL_SRC: string[];
|
|
17498
17344
|
declare const GLOB_EXCLUDE: string[];
|
|
17499
17345
|
//#endregion
|
|
17500
|
-
export { Awaitable, type ConfigNames,
|
|
17346
|
+
export { Awaitable, type ConfigNames, type FlatConfigComposer, GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, GitignoreOptions, JsdocOptions, NamedFlatConfigItem, NamedOptionsConfig, OptionsComponentExtensions, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsOverridesTypeAware, OptionsPnpm, OptionsProjectType, OptionsRoblox, OptionsStylistic, OptionsTestFramework, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVitest, PerfectionistConfig, type PrettierOptions, PrettierRuleOptions, ReactConfig, Rules, SpellCheckConfig, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, comments, isentinel as default, isentinel, defaultPluginRenaming, disables, eslintPlugin, flawless, gitignore, ignores, imports, javascript, jsdoc, jsonc, markdown, node, packageJson, perfectionist, pnpm, prettier, promise, react, roblox, shopify, sonarjs, sortGithubAction, sortPnpmWorkspace, sortRojoProject, sortTsconfig, spelling, stylistic, test, toml, typescript, unicorn, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -149,6 +149,7 @@ const GLOB_EXCLUDE = [
|
|
|
149
149
|
"**/.vercel",
|
|
150
150
|
"**/.vite-inspect",
|
|
151
151
|
"**/.vitepress/cache",
|
|
152
|
+
"**/.worktree",
|
|
152
153
|
"**/.yarn",
|
|
153
154
|
"**/coverage",
|
|
154
155
|
"**/out",
|
|
@@ -189,15 +190,6 @@ const parserPlain = {
|
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
192
|
};
|
|
192
|
-
/**
|
|
193
|
-
* Combine array and non-array configs into a single array.
|
|
194
|
-
*
|
|
195
|
-
* @param configs - The configs to combine.
|
|
196
|
-
* @returns The combined array.
|
|
197
|
-
*/
|
|
198
|
-
async function combine(...configs) {
|
|
199
|
-
return (await Promise.all(configs.map(async (config) => config))).flat();
|
|
200
|
-
}
|
|
201
193
|
function createTsParser(options) {
|
|
202
194
|
const { componentExtensions = [], configName, files, ignores: ignores$1, outOfProjectFiles, parser, parserOptions = {}, parserOptionsNonTypeAware = {}, parserOptionsTypeAware = {}, tsconfigPath, typeAware } = options;
|
|
203
195
|
return {
|
|
@@ -309,36 +301,6 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
309
301
|
};
|
|
310
302
|
}
|
|
311
303
|
/**
|
|
312
|
-
* Rename plugin names a flat configs array.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
*
|
|
316
|
-
* ```ts
|
|
317
|
-
* import { renamePluginInConfigs } from "@antfu/eslint-config";
|
|
318
|
-
* import someConfigs from "./some-configs";
|
|
319
|
-
*
|
|
320
|
-
* export default renamePluginInConfigs(someConfigs, {
|
|
321
|
-
* "@typescript-eslint": "ts",
|
|
322
|
-
* "import-x": "import",
|
|
323
|
-
* });
|
|
324
|
-
* ```
|
|
325
|
-
*
|
|
326
|
-
* @param configs - The configs array to rename.
|
|
327
|
-
* @param map - A map of prefixes to rename.
|
|
328
|
-
* @returns The renamed configs array.
|
|
329
|
-
*/
|
|
330
|
-
function renamePluginInConfigs(configs, map) {
|
|
331
|
-
return configs.map((index$1) => {
|
|
332
|
-
const clone = { ...index$1 };
|
|
333
|
-
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
334
|
-
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
335
|
-
if (key in map) return [map[key], value];
|
|
336
|
-
return [key, value];
|
|
337
|
-
}));
|
|
338
|
-
return clone;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
304
|
* Rename plugin prefixes in a rule object. Accepts a map of prefixes to rename.
|
|
343
305
|
*
|
|
344
306
|
* @example
|
|
@@ -18024,4 +17986,4 @@ async function yaml(options = {}) {
|
|
|
18024
17986
|
}
|
|
18025
17987
|
|
|
18026
17988
|
//#endregion
|
|
18027
|
-
export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults,
|
|
17989
|
+
export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, comments, isentinel as default, isentinel, defaultPluginRenaming, disables, eslintPlugin, flawless, gitignore, ignores, imports, javascript, jsdoc, jsonc, markdown, node, packageJson, perfectionist, pnpm, prettier, promise, react, roblox, shopify, sonarjs, sortGithubAction, sortPnpmWorkspace, sortRojoProject, sortTsconfig, spelling, stylistic, test, toml, typescript, unicorn, yaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isentinel/eslint-config",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
4
4
|
"description": "iSentinel's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"tsx": "4.21.0",
|
|
126
126
|
"type-fest": "5.3.1",
|
|
127
127
|
"typescript": "5.9.3",
|
|
128
|
-
"@isentinel/eslint-config": "4.7.
|
|
128
|
+
"@isentinel/eslint-config": "4.7.2"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
131
|
"@vitest/eslint-plugin": "^1.0.0",
|