@jsse/eslint-config 0.1.2 → 0.1.4

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,15 @@ type OptionsConfig = {
118
121
  off?: string[];
119
122
  fast?: boolean;
120
123
  prettier?: boolean;
124
+ /**
125
+ * The prefix for the name of the config item.
126
+ * @default "jsse"
127
+ */
128
+ rootId?: string;
129
+ /**
130
+ * Optional function to run before the final config is returned.
131
+ */
132
+ preReturn?: (configs: FlatConfigItem[]) => FlatConfigItem[] | Awaitable<FlatConfigItem[]>;
121
133
  /**
122
134
  * Enable gitignore support.
123
135
  *
@@ -195,28 +207,37 @@ type OptionsConfig = {
195
207
  };
196
208
  } & OptionsComponentExts;
197
209
 
198
- declare function comments(): FlatConfigItem[];
210
+ declare const comments: EslintConfigFn;
199
211
 
200
- declare function ignores(): FlatConfigItem[];
212
+ declare const ignores: EslintConfigFn;
201
213
 
202
- declare function imports(options?: OptionsStylistic): FlatConfigItem[];
214
+ declare const imports: EslintConfigFn<OptionsStylistic>;
203
215
 
204
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides & {
216
+ type JavascriptOptions = OptionsIsInEditor & OptionsOverrides & {
205
217
  reportUnusedDisableDirectives?: boolean;
206
- }): FlatConfigItem[];
218
+ };
219
+ declare const javascript: EslintConfigFn<JavascriptOptions>;
220
+
221
+ declare const jsdoc: EslintConfigFn;
207
222
 
208
- declare function jsdoc(): FlatConfigItem[];
223
+ type JsoncOptions = OptionsStylistic & OptionsOverrides;
224
+ declare const jsonc: EslintConfigFn<JsoncOptions>;
209
225
 
210
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatConfigItem[];
226
+ declare const n: EslintConfigFn;
211
227
 
212
- declare function node(): FlatConfigItem[];
228
+ /**
229
+ * Optional perfectionist plugin for props and items sorting.
230
+ *
231
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
232
+ */
233
+ declare const perfectionist: EslintConfigFn;
213
234
 
214
235
  /**
215
236
  * Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
216
237
  * Main difference is we exclude rules we don't care about.... (flow/babel/etc)
217
238
  */
218
239
  declare function eslintConfigPrettierRules(): FlatConfigItem["rules"];
219
- declare function prettier(): FlatConfigItem[];
240
+ declare const prettier: EslintConfigFn;
220
241
 
221
242
  declare function reactRules(): {
222
243
  "react-hooks/exhaustive-deps": string;
@@ -346,33 +367,29 @@ declare function reactHooks(): {
346
367
  "react-hooks/rules-of-hooks": string;
347
368
  };
348
369
  }[];
349
- declare function react(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact): FlatConfigItem[];
370
+ type ReactOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact;
371
+ declare const react: EslintConfigFn<ReactOptions>;
350
372
 
351
373
  /**
352
374
  * Sort package.json
353
375
  *
354
376
  * Requires `jsonc` config
355
377
  */
356
- declare function sortPackageJson(): FlatConfigItem[];
378
+ declare const sortPackageJson: EslintConfigFn;
357
379
  /**
358
380
  * Sort tsconfig.json
359
381
  *
360
382
  * Requires `jsonc` config
361
383
  */
362
- declare function sortTsconfig(): FlatConfigItem[];
363
-
364
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatConfigItem[];
384
+ declare const sortTsconfig: EslintConfigFn;
365
385
 
366
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix): Promise<FlatConfigItem[]>;
386
+ type TestOptions = OptionsIsInEditor & OptionsOverrides;
387
+ declare const test: EslintConfigFn<TestOptions>;
367
388
 
368
- declare function unicorn(): FlatConfigItem[];
389
+ type TypescriptOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix;
390
+ declare const typescript: EslintConfigFn<TypescriptOptions>;
369
391
 
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[];
392
+ declare const unicorn: EslintConfigFn;
376
393
 
377
394
  /**
378
395
  * Construct an array of ESLint flat config items.
@@ -404,6 +421,10 @@ declare const GLOB_EXCLUDE: string[];
404
421
  * Combine array and non-array configs into a single array.
405
422
  */
406
423
  declare function combine(...configs: (FlatConfigItem | FlatConfigItem[])[]): FlatConfigItem[];
424
+ /**
425
+ * Combine array and non-array configs into a single array.
426
+ */
427
+ declare function combineAsync<T>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
407
428
  declare function renameRules<TRule = unknown>(rules: Record<string, TRule>, from: string, to: string): Record<string, TRule>;
408
429
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
409
430
  default: infer U;
@@ -414,4 +435,4 @@ declare function isInEditor(): boolean;
414
435
  declare function jssestd(): Promise<FlatConfigItem[]>;
415
436
  declare function jsseReact(): Promise<FlatConfigItem[]>;
416
437
 
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 };
438
+ 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,15 @@ type OptionsConfig = {
118
121
  off?: string[];
119
122
  fast?: boolean;
120
123
  prettier?: boolean;
124
+ /**
125
+ * The prefix for the name of the config item.
126
+ * @default "jsse"
127
+ */
128
+ rootId?: string;
129
+ /**
130
+ * Optional function to run before the final config is returned.
131
+ */
132
+ preReturn?: (configs: FlatConfigItem[]) => FlatConfigItem[] | Awaitable<FlatConfigItem[]>;
121
133
  /**
122
134
  * Enable gitignore support.
123
135
  *
@@ -195,28 +207,37 @@ type OptionsConfig = {
195
207
  };
196
208
  } & OptionsComponentExts;
197
209
 
198
- declare function comments(): FlatConfigItem[];
210
+ declare const comments: EslintConfigFn;
199
211
 
200
- declare function ignores(): FlatConfigItem[];
212
+ declare const ignores: EslintConfigFn;
201
213
 
202
- declare function imports(options?: OptionsStylistic): FlatConfigItem[];
214
+ declare const imports: EslintConfigFn<OptionsStylistic>;
203
215
 
204
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides & {
216
+ type JavascriptOptions = OptionsIsInEditor & OptionsOverrides & {
205
217
  reportUnusedDisableDirectives?: boolean;
206
- }): FlatConfigItem[];
218
+ };
219
+ declare const javascript: EslintConfigFn<JavascriptOptions>;
220
+
221
+ declare const jsdoc: EslintConfigFn;
207
222
 
208
- declare function jsdoc(): FlatConfigItem[];
223
+ type JsoncOptions = OptionsStylistic & OptionsOverrides;
224
+ declare const jsonc: EslintConfigFn<JsoncOptions>;
209
225
 
210
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatConfigItem[];
226
+ declare const n: EslintConfigFn;
211
227
 
212
- declare function node(): FlatConfigItem[];
228
+ /**
229
+ * Optional perfectionist plugin for props and items sorting.
230
+ *
231
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
232
+ */
233
+ declare const perfectionist: EslintConfigFn;
213
234
 
214
235
  /**
215
236
  * Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
216
237
  * Main difference is we exclude rules we don't care about.... (flow/babel/etc)
217
238
  */
218
239
  declare function eslintConfigPrettierRules(): FlatConfigItem["rules"];
219
- declare function prettier(): FlatConfigItem[];
240
+ declare const prettier: EslintConfigFn;
220
241
 
221
242
  declare function reactRules(): {
222
243
  "react-hooks/exhaustive-deps": string;
@@ -346,33 +367,29 @@ declare function reactHooks(): {
346
367
  "react-hooks/rules-of-hooks": string;
347
368
  };
348
369
  }[];
349
- declare function react(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact): FlatConfigItem[];
370
+ type ReactOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact;
371
+ declare const react: EslintConfigFn<ReactOptions>;
350
372
 
351
373
  /**
352
374
  * Sort package.json
353
375
  *
354
376
  * Requires `jsonc` config
355
377
  */
356
- declare function sortPackageJson(): FlatConfigItem[];
378
+ declare const sortPackageJson: EslintConfigFn;
357
379
  /**
358
380
  * Sort tsconfig.json
359
381
  *
360
382
  * Requires `jsonc` config
361
383
  */
362
- declare function sortTsconfig(): FlatConfigItem[];
363
-
364
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatConfigItem[];
384
+ declare const sortTsconfig: EslintConfigFn;
365
385
 
366
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix): Promise<FlatConfigItem[]>;
386
+ type TestOptions = OptionsIsInEditor & OptionsOverrides;
387
+ declare const test: EslintConfigFn<TestOptions>;
367
388
 
368
- declare function unicorn(): FlatConfigItem[];
389
+ type TypescriptOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact & OptionsPrefix;
390
+ declare const typescript: EslintConfigFn<TypescriptOptions>;
369
391
 
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[];
392
+ declare const unicorn: EslintConfigFn;
376
393
 
377
394
  /**
378
395
  * Construct an array of ESLint flat config items.
@@ -404,6 +421,10 @@ declare const GLOB_EXCLUDE: string[];
404
421
  * Combine array and non-array configs into a single array.
405
422
  */
406
423
  declare function combine(...configs: (FlatConfigItem | FlatConfigItem[])[]): FlatConfigItem[];
424
+ /**
425
+ * Combine array and non-array configs into a single array.
426
+ */
427
+ declare function combineAsync<T>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
407
428
  declare function renameRules<TRule = unknown>(rules: Record<string, TRule>, from: string, to: string): Record<string, TRule>;
408
429
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
409
430
  default: infer U;
@@ -414,4 +435,4 @@ declare function isInEditor(): boolean;
414
435
  declare function jssestd(): Promise<FlatConfigItem[]>;
415
436
  declare function jsseReact(): Promise<FlatConfigItem[]>;
416
437
 
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 };
438
+ 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 };