@jsse/eslint-config 0.1.2 → 0.1.3

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.cts CHANGED
@@ -5,27 +5,28 @@ export { parser as parserTs };
5
5
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
6
6
  export { default as pluginStylistic } from '@stylistic/eslint-plugin';
7
7
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
8
+ export { default as pluginAntfu } from 'eslint-plugin-antfu';
8
9
  export { default as pluginEslintComments } from 'eslint-plugin-eslint-comments';
9
10
  import * as eslintPluginI from 'eslint-plugin-i';
10
11
  export { eslintPluginI as pluginImport };
11
12
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
12
13
  import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
13
14
  export { eslintPluginJsonc as pluginJsonc };
15
+ export { default as pluginMarkdown } from 'eslint-plugin-markdown';
14
16
  export { default as pluginN } from 'eslint-plugin-n';
15
17
  export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
18
+ export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
16
19
  export { default as pluginReact } from 'eslint-plugin-react';
17
20
  export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
18
21
  import * as eslintPluginReactRefresh from 'eslint-plugin-react-refresh';
19
22
  export { eslintPluginReactRefresh as pluginReactRefresh };
20
23
  import * as eslintPluginSortKeys from 'eslint-plugin-sort-keys';
21
24
  export { eslintPluginSortKeys as pluginSortKeys };
25
+ export { default as pluginTailwind } from 'eslint-plugin-tailwindcss';
22
26
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
23
27
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
24
- export { default as pluginTailwind } from 'eslint-plugin-tailwindcss';
25
28
  export { default as pluginVitest } from 'eslint-plugin-vitest';
26
29
  export { default as parserJsonc } from 'jsonc-eslint-parser';
27
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
28
- export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
29
30
 
30
31
  type Awaitable<T> = T | Promise<T>;
31
32
  type Rules = MergeIntersection<TypeScriptRules & VitestRules & YmlRules & NRules & ImportRules & EslintRules & JsoncRules & UnicornRules & EslintCommentsRules & {
@@ -61,6 +62,8 @@ type OptionsComponentExts = {
61
62
  */
62
63
  componentExts?: string[];
63
64
  };
65
+ type PromiseFlatConfigItem = Promise<FlatConfigItem[]>;
66
+ type EslintConfigFn<T = undefined> = (options?: T) => PromiseFlatConfigItem;
64
67
  type OptionsFiles = {
65
68
  /**
66
69
  * Override the `files` option to provide custom globs.
@@ -118,6 +121,10 @@ type OptionsConfig = {
118
121
  off?: string[];
119
122
  fast?: boolean;
120
123
  prettier?: boolean;
124
+ /**
125
+ * Optional function to run before the final config is returned.
126
+ */
127
+ preReturn?: (configs: FlatConfigItem[]) => FlatConfigItem[] | Awaitable<FlatConfigItem[]>;
121
128
  /**
122
129
  * Enable gitignore support.
123
130
  *
@@ -195,28 +202,37 @@ type OptionsConfig = {
195
202
  };
196
203
  } & OptionsComponentExts;
197
204
 
198
- declare function comments(): FlatConfigItem[];
205
+ declare const comments: EslintConfigFn;
199
206
 
200
- declare function ignores(): FlatConfigItem[];
207
+ declare const ignores: EslintConfigFn;
201
208
 
202
- declare function imports(options?: OptionsStylistic): FlatConfigItem[];
209
+ declare const imports: EslintConfigFn<OptionsStylistic>;
203
210
 
204
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides & {
211
+ type JavascriptOptions = OptionsIsInEditor & OptionsOverrides & {
205
212
  reportUnusedDisableDirectives?: boolean;
206
- }): FlatConfigItem[];
213
+ };
214
+ declare const javascript: EslintConfigFn<JavascriptOptions>;
207
215
 
208
- declare function jsdoc(): FlatConfigItem[];
216
+ declare const jsdoc: EslintConfigFn;
209
217
 
210
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatConfigItem[];
218
+ type JsoncOptions = OptionsStylistic & OptionsOverrides;
219
+ declare const jsonc: EslintConfigFn<JsoncOptions>;
211
220
 
212
- declare function node(): FlatConfigItem[];
221
+ declare const n: EslintConfigFn;
222
+
223
+ /**
224
+ * Optional perfectionist plugin for props and items sorting.
225
+ *
226
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
227
+ */
228
+ declare const perfectionist: EslintConfigFn;
213
229
 
214
230
  /**
215
231
  * Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
216
232
  * Main difference is we exclude rules we don't care about.... (flow/babel/etc)
217
233
  */
218
234
  declare function eslintConfigPrettierRules(): FlatConfigItem["rules"];
219
- declare function prettier(): FlatConfigItem[];
235
+ declare const prettier: EslintConfigFn;
220
236
 
221
237
  declare function reactRules(): {
222
238
  "react-hooks/exhaustive-deps": string;
@@ -346,33 +362,28 @@ declare function reactHooks(): {
346
362
  "react-hooks/rules-of-hooks": string;
347
363
  };
348
364
  }[];
349
- declare function react(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact): FlatConfigItem[];
365
+ type ReactOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact;
366
+ declare const react: EslintConfigFn<ReactOptions>;
350
367
 
351
368
  /**
352
369
  * Sort package.json
353
370
  *
354
371
  * Requires `jsonc` config
355
372
  */
356
- declare function sortPackageJson(): FlatConfigItem[];
373
+ declare const sortPackageJson: EslintConfigFn;
357
374
  /**
358
375
  * Sort tsconfig.json
359
376
  *
360
377
  * Requires `jsonc` config
361
378
  */
362
- declare function sortTsconfig(): FlatConfigItem[];
379
+ declare const sortTsconfig: EslintConfigFn;
363
380
 
364
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatConfigItem[];
381
+ type TestOptions = OptionsIsInEditor & OptionsOverrides;
382
+ declare const test: EslintConfigFn<TestOptions>;
365
383
 
366
384
  declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix): Promise<FlatConfigItem[]>;
367
385
 
368
- declare function unicorn(): FlatConfigItem[];
369
-
370
- /**
371
- * Optional perfectionist plugin for props and items sorting.
372
- *
373
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
374
- */
375
- declare function perfectionist(): FlatConfigItem[];
386
+ declare const unicorn: EslintConfigFn;
376
387
 
377
388
  /**
378
389
  * Construct an array of ESLint flat config items.
@@ -404,6 +415,10 @@ declare const GLOB_EXCLUDE: string[];
404
415
  * Combine array and non-array configs into a single array.
405
416
  */
406
417
  declare function combine(...configs: (FlatConfigItem | FlatConfigItem[])[]): FlatConfigItem[];
418
+ /**
419
+ * Combine array and non-array configs into a single array.
420
+ */
421
+ declare function combineAsync<T>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
407
422
  declare function renameRules<TRule = unknown>(rules: Record<string, TRule>, from: string, to: string): Record<string, TRule>;
408
423
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
409
424
  default: infer U;
@@ -414,4 +429,4 @@ declare function isInEditor(): boolean;
414
429
  declare function jssestd(): Promise<FlatConfigItem[]>;
415
430
  declare function jsseReact(): Promise<FlatConfigItem[]>;
416
431
 
417
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_YAML, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, type StylisticConfig, combine, comments, jsse as default, eslintConfigPrettierRules, ignores, imports, interopDefault, isCI, isInEditor, javascript, jsdoc, jsonc, jsse, jsseReact, jssestd, node, perfectionist, prettier, react, reactHooks, reactRules, renameRules, sortPackageJson, sortTsconfig, test, typescript, unicorn };
432
+ export { type Awaitable, type EslintConfigFn, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_YAML, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type Rules, type StylisticConfig, combine, combineAsync, comments, jsse as default, eslintConfigPrettierRules, ignores, imports, interopDefault, isCI, isInEditor, javascript, jsdoc, jsonc, jsse, jsseReact, jssestd, n, perfectionist, prettier, react, reactHooks, reactRules, renameRules, sortPackageJson, sortTsconfig, test, typescript, unicorn };
package/dist/index.d.ts CHANGED
@@ -5,27 +5,28 @@ export { parser as parserTs };
5
5
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
6
6
  export { default as pluginStylistic } from '@stylistic/eslint-plugin';
7
7
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
8
+ export { default as pluginAntfu } from 'eslint-plugin-antfu';
8
9
  export { default as pluginEslintComments } from 'eslint-plugin-eslint-comments';
9
10
  import * as eslintPluginI from 'eslint-plugin-i';
10
11
  export { eslintPluginI as pluginImport };
11
12
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
12
13
  import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
13
14
  export { eslintPluginJsonc as pluginJsonc };
15
+ export { default as pluginMarkdown } from 'eslint-plugin-markdown';
14
16
  export { default as pluginN } from 'eslint-plugin-n';
15
17
  export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
18
+ export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
16
19
  export { default as pluginReact } from 'eslint-plugin-react';
17
20
  export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
18
21
  import * as eslintPluginReactRefresh from 'eslint-plugin-react-refresh';
19
22
  export { eslintPluginReactRefresh as pluginReactRefresh };
20
23
  import * as eslintPluginSortKeys from 'eslint-plugin-sort-keys';
21
24
  export { eslintPluginSortKeys as pluginSortKeys };
25
+ export { default as pluginTailwind } from 'eslint-plugin-tailwindcss';
22
26
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
23
27
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
24
- export { default as pluginTailwind } from 'eslint-plugin-tailwindcss';
25
28
  export { default as pluginVitest } from 'eslint-plugin-vitest';
26
29
  export { default as parserJsonc } from 'jsonc-eslint-parser';
27
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
28
- export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
29
30
 
30
31
  type Awaitable<T> = T | Promise<T>;
31
32
  type Rules = MergeIntersection<TypeScriptRules & VitestRules & YmlRules & NRules & ImportRules & EslintRules & JsoncRules & UnicornRules & EslintCommentsRules & {
@@ -61,6 +62,8 @@ type OptionsComponentExts = {
61
62
  */
62
63
  componentExts?: string[];
63
64
  };
65
+ type PromiseFlatConfigItem = Promise<FlatConfigItem[]>;
66
+ type EslintConfigFn<T = undefined> = (options?: T) => PromiseFlatConfigItem;
64
67
  type OptionsFiles = {
65
68
  /**
66
69
  * Override the `files` option to provide custom globs.
@@ -118,6 +121,10 @@ type OptionsConfig = {
118
121
  off?: string[];
119
122
  fast?: boolean;
120
123
  prettier?: boolean;
124
+ /**
125
+ * Optional function to run before the final config is returned.
126
+ */
127
+ preReturn?: (configs: FlatConfigItem[]) => FlatConfigItem[] | Awaitable<FlatConfigItem[]>;
121
128
  /**
122
129
  * Enable gitignore support.
123
130
  *
@@ -195,28 +202,37 @@ type OptionsConfig = {
195
202
  };
196
203
  } & OptionsComponentExts;
197
204
 
198
- declare function comments(): FlatConfigItem[];
205
+ declare const comments: EslintConfigFn;
199
206
 
200
- declare function ignores(): FlatConfigItem[];
207
+ declare const ignores: EslintConfigFn;
201
208
 
202
- declare function imports(options?: OptionsStylistic): FlatConfigItem[];
209
+ declare const imports: EslintConfigFn<OptionsStylistic>;
203
210
 
204
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides & {
211
+ type JavascriptOptions = OptionsIsInEditor & OptionsOverrides & {
205
212
  reportUnusedDisableDirectives?: boolean;
206
- }): FlatConfigItem[];
213
+ };
214
+ declare const javascript: EslintConfigFn<JavascriptOptions>;
207
215
 
208
- declare function jsdoc(): FlatConfigItem[];
216
+ declare const jsdoc: EslintConfigFn;
209
217
 
210
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatConfigItem[];
218
+ type JsoncOptions = OptionsStylistic & OptionsOverrides;
219
+ declare const jsonc: EslintConfigFn<JsoncOptions>;
211
220
 
212
- declare function node(): FlatConfigItem[];
221
+ declare const n: EslintConfigFn;
222
+
223
+ /**
224
+ * Optional perfectionist plugin for props and items sorting.
225
+ *
226
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
227
+ */
228
+ declare const perfectionist: EslintConfigFn;
213
229
 
214
230
  /**
215
231
  * Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
216
232
  * Main difference is we exclude rules we don't care about.... (flow/babel/etc)
217
233
  */
218
234
  declare function eslintConfigPrettierRules(): FlatConfigItem["rules"];
219
- declare function prettier(): FlatConfigItem[];
235
+ declare const prettier: EslintConfigFn;
220
236
 
221
237
  declare function reactRules(): {
222
238
  "react-hooks/exhaustive-deps": string;
@@ -346,33 +362,28 @@ declare function reactHooks(): {
346
362
  "react-hooks/rules-of-hooks": string;
347
363
  };
348
364
  }[];
349
- declare function react(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact): FlatConfigItem[];
365
+ type ReactOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact;
366
+ declare const react: EslintConfigFn<ReactOptions>;
350
367
 
351
368
  /**
352
369
  * Sort package.json
353
370
  *
354
371
  * Requires `jsonc` config
355
372
  */
356
- declare function sortPackageJson(): FlatConfigItem[];
373
+ declare const sortPackageJson: EslintConfigFn;
357
374
  /**
358
375
  * Sort tsconfig.json
359
376
  *
360
377
  * Requires `jsonc` config
361
378
  */
362
- declare function sortTsconfig(): FlatConfigItem[];
379
+ declare const sortTsconfig: EslintConfigFn;
363
380
 
364
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatConfigItem[];
381
+ type TestOptions = OptionsIsInEditor & OptionsOverrides;
382
+ declare const test: EslintConfigFn<TestOptions>;
365
383
 
366
384
  declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix): Promise<FlatConfigItem[]>;
367
385
 
368
- declare function unicorn(): FlatConfigItem[];
369
-
370
- /**
371
- * Optional perfectionist plugin for props and items sorting.
372
- *
373
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
374
- */
375
- declare function perfectionist(): FlatConfigItem[];
386
+ declare const unicorn: EslintConfigFn;
376
387
 
377
388
  /**
378
389
  * Construct an array of ESLint flat config items.
@@ -404,6 +415,10 @@ declare const GLOB_EXCLUDE: string[];
404
415
  * Combine array and non-array configs into a single array.
405
416
  */
406
417
  declare function combine(...configs: (FlatConfigItem | FlatConfigItem[])[]): FlatConfigItem[];
418
+ /**
419
+ * Combine array and non-array configs into a single array.
420
+ */
421
+ declare function combineAsync<T>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
407
422
  declare function renameRules<TRule = unknown>(rules: Record<string, TRule>, from: string, to: string): Record<string, TRule>;
408
423
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
409
424
  default: infer U;
@@ -414,4 +429,4 @@ declare function isInEditor(): boolean;
414
429
  declare function jssestd(): Promise<FlatConfigItem[]>;
415
430
  declare function jsseReact(): Promise<FlatConfigItem[]>;
416
431
 
417
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_YAML, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, type StylisticConfig, combine, comments, jsse as default, eslintConfigPrettierRules, ignores, imports, interopDefault, isCI, isInEditor, javascript, jsdoc, jsonc, jsse, jsseReact, jssestd, node, perfectionist, prettier, react, reactHooks, reactRules, renameRules, sortPackageJson, sortTsconfig, test, typescript, unicorn };
432
+ export { type Awaitable, type EslintConfigFn, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_YAML, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type Rules, type StylisticConfig, combine, combineAsync, comments, jsse as default, eslintConfigPrettierRules, ignores, imports, interopDefault, isCI, isInEditor, javascript, jsdoc, jsonc, jsse, jsseReact, jssestd, n, perfectionist, prettier, react, reactHooks, reactRules, renameRules, sortPackageJson, sortTsconfig, test, typescript, unicorn };