@jsse/eslint-config 0.5.3 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @jsse/eslint-config
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - add `sortPackageJson` (default true), `sortTsconfig` (default true) and
8
+ `sortImports` (default false; formerly true)
9
+
3
10
  ## 0.5.3
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,4 @@
1
- import { createRequire } from "node:module";
2
-
1
+ import "node:module";
3
2
  //#region \0rolldown/runtime.js
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
@@ -10,28 +9,20 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
9
  var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
10
  var __exportAll = (all, no_symbols) => {
12
11
  let target = {};
13
- for (var name in all) {
14
- __defProp(target, name, {
15
- get: all[name],
16
- enumerable: true
17
- });
18
- }
19
- if (!no_symbols) {
20
- __defProp(target, Symbol.toStringTag, { value: "Module" });
21
- }
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
22
17
  return target;
23
18
  };
24
19
  var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
27
- key = keys[i];
28
- if (!__hasOwnProp.call(to, key) && key !== except) {
29
- __defProp(to, key, {
30
- get: ((k) => from[k]).bind(null, key),
31
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
32
- });
33
- }
34
- }
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
35
26
  }
36
27
  return to;
37
28
  };
@@ -39,6 +30,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
30
  value: mod,
40
31
  enumerable: true
41
32
  }) : target, mod));
42
-
43
33
  //#endregion
44
- export { __exportAll as n, __toESM as r, __commonJSMin as t };
34
+ export { __exportAll as n, __toESM as r, __commonJSMin as t };
package/dist/cli.js CHANGED
@@ -1,7 +1,6 @@
1
- import { n as DEBUG$1, t as VERSION } from "./version-B7sAPTF4.js";
1
+ import { n as DEBUG$1, t as VERSION } from "./version-C8gdC_Ss.js";
2
2
  import process$1 from "node:process";
3
3
  import fs from "node:fs";
4
-
5
4
  //#region node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
6
5
  function toArr(any) {
7
6
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -619,7 +618,6 @@ var CAC = class extends EventTarget {
619
618
  * @param name The program name to display in help and version message
620
619
  */
621
620
  const cac = (name = "") => new CAC(name);
622
-
623
621
  //#endregion
624
622
  //#region src/cli.ts
625
623
  const cli = cac("jsselint");
@@ -684,9 +682,7 @@ cli.command("init", "create eslint config file").option("--force", "force create
684
682
  if (fs.existsSync(configPath)) {
685
683
  const msg = "eslint.config.js already exists";
686
684
  console.warn(msg);
687
- if (!options.force) {
688
- throw new Error(msg);
689
- }
685
+ if (!options.force) throw new Error(msg);
690
686
  }
691
687
  if (!fs.existsSync("package.json")) {
692
688
  const msg = "package.json not found";
@@ -706,7 +702,7 @@ cli.command("init", "create eslint config file").option("--force", "force create
706
702
  cli.command("version", "echo version").action(() => {
707
703
  console.log(VERSION);
708
704
  });
709
- cli.version(typeof VERSION === "string" ? VERSION : "unknown");
705
+ cli.version(VERSION);
710
706
  cli.help();
711
707
  async function main(args) {
712
708
  const argv = args ?? process$1.argv;
@@ -719,11 +715,8 @@ async function main(args) {
719
715
  }
720
716
  await cli.runMatchedCommand();
721
717
  } catch (error) {
722
- if (error instanceof Error) {
723
- console.error("Error: %s\n\n%s", error.message, error.stack);
724
- } else {
725
- console.error(error);
726
- }
718
+ if (error instanceof Error) console.error("Error: %s\n\n%s", error.message, error.stack);
719
+ else console.error(error);
727
720
  process$1.exit(1);
728
721
  }
729
722
  }
@@ -731,6 +724,5 @@ main().catch((e) => {
731
724
  console.error(e);
732
725
  throw e;
733
726
  });
734
-
735
727
  //#endregion
736
- export { };
728
+ export {};
package/dist/index.d.ts CHANGED
@@ -9749,33 +9749,33 @@ type StylisticExpListStyle = [] | [{
9749
9749
  singleLine?: _StylisticExpListStyle_SingleLineConfig;
9750
9750
  multiLine?: _StylisticExpListStyle_MultiLineConfig;
9751
9751
  overrides?: {
9752
- "()"?: _StylisticExpListStyle_BaseConfig;
9753
- "[]"?: _StylisticExpListStyle_BaseConfig;
9754
- "{}"?: _StylisticExpListStyle_BaseConfig;
9755
- "<>"?: _StylisticExpListStyle_BaseConfig;
9756
- ArrayExpression?: _StylisticExpListStyle_BaseConfig;
9757
- ArrayPattern?: _StylisticExpListStyle_BaseConfig;
9758
- ArrowFunctionExpression?: _StylisticExpListStyle_BaseConfig;
9759
- CallExpression?: _StylisticExpListStyle_BaseConfig;
9760
- ExportNamedDeclaration?: _StylisticExpListStyle_BaseConfig;
9761
- FunctionDeclaration?: _StylisticExpListStyle_BaseConfig;
9762
- FunctionExpression?: _StylisticExpListStyle_BaseConfig;
9763
- IfStatement?: _StylisticExpListStyle_BaseConfig;
9764
- ImportAttributes?: _StylisticExpListStyle_BaseConfig;
9765
- ImportDeclaration?: _StylisticExpListStyle_BaseConfig;
9766
- JSONArrayExpression?: _StylisticExpListStyle_BaseConfig;
9767
- JSONObjectExpression?: _StylisticExpListStyle_BaseConfig;
9768
- NewExpression?: _StylisticExpListStyle_BaseConfig;
9769
- ObjectExpression?: _StylisticExpListStyle_BaseConfig;
9770
- ObjectPattern?: _StylisticExpListStyle_BaseConfig;
9771
- TSDeclareFunction?: _StylisticExpListStyle_BaseConfig;
9772
- TSEnumBody?: _StylisticExpListStyle_BaseConfig;
9773
- TSFunctionType?: _StylisticExpListStyle_BaseConfig;
9774
- TSInterfaceBody?: _StylisticExpListStyle_BaseConfig;
9775
- TSTupleType?: _StylisticExpListStyle_BaseConfig;
9776
- TSTypeLiteral?: _StylisticExpListStyle_BaseConfig;
9777
- TSTypeParameterDeclaration?: _StylisticExpListStyle_BaseConfig;
9778
- TSTypeParameterInstantiation?: _StylisticExpListStyle_BaseConfig;
9752
+ "()"?: _StylisticExpListStyle_BaseConfig | "off";
9753
+ "[]"?: _StylisticExpListStyle_BaseConfig | "off";
9754
+ "{}"?: _StylisticExpListStyle_BaseConfig | "off";
9755
+ "<>"?: _StylisticExpListStyle_BaseConfig | "off";
9756
+ ArrayExpression?: _StylisticExpListStyle_BaseConfig | "off";
9757
+ ArrayPattern?: _StylisticExpListStyle_BaseConfig | "off";
9758
+ ArrowFunctionExpression?: _StylisticExpListStyle_BaseConfig | "off";
9759
+ CallExpression?: _StylisticExpListStyle_BaseConfig | "off";
9760
+ ExportNamedDeclaration?: _StylisticExpListStyle_BaseConfig | "off";
9761
+ FunctionDeclaration?: _StylisticExpListStyle_BaseConfig | "off";
9762
+ FunctionExpression?: _StylisticExpListStyle_BaseConfig | "off";
9763
+ IfStatement?: _StylisticExpListStyle_BaseConfig | "off";
9764
+ ImportAttributes?: _StylisticExpListStyle_BaseConfig | "off";
9765
+ ImportDeclaration?: _StylisticExpListStyle_BaseConfig | "off";
9766
+ JSONArrayExpression?: _StylisticExpListStyle_BaseConfig | "off";
9767
+ JSONObjectExpression?: _StylisticExpListStyle_BaseConfig | "off";
9768
+ NewExpression?: _StylisticExpListStyle_BaseConfig | "off";
9769
+ ObjectExpression?: _StylisticExpListStyle_BaseConfig | "off";
9770
+ ObjectPattern?: _StylisticExpListStyle_BaseConfig | "off";
9771
+ TSDeclareFunction?: _StylisticExpListStyle_BaseConfig | "off";
9772
+ TSEnumBody?: _StylisticExpListStyle_BaseConfig | "off";
9773
+ TSFunctionType?: _StylisticExpListStyle_BaseConfig | "off";
9774
+ TSInterfaceBody?: _StylisticExpListStyle_BaseConfig | "off";
9775
+ TSTupleType?: _StylisticExpListStyle_BaseConfig | "off";
9776
+ TSTypeLiteral?: _StylisticExpListStyle_BaseConfig | "off";
9777
+ TSTypeParameterDeclaration?: _StylisticExpListStyle_BaseConfig | "off";
9778
+ TSTypeParameterInstantiation?: _StylisticExpListStyle_BaseConfig | "off";
9779
9779
  };
9780
9780
  }];
9781
9781
  interface _StylisticExpListStyle_SingleLineConfig {
@@ -10646,6 +10646,7 @@ type StylisticPaddingLineBetweenStatements = {
10646
10646
  }[];
10647
10647
  interface _StylisticPaddingLineBetweenStatements_SelectorOption {
10648
10648
  selector: string;
10649
+ lineMode?: "any" | "singleline" | "multiline";
10649
10650
  } // ----- @stylistic/quote-props -----
10650
10651
  type StylisticQuoteProps = [] | ["always" | "as-needed" | "consistent" | "consistent-as-needed"] | [] | ["always" | "as-needed" | "consistent" | "consistent-as-needed"] | ["always" | "as-needed" | "consistent" | "consistent-as-needed", {
10651
10652
  keywords?: boolean;
@@ -12487,6 +12488,18 @@ type TypescriptEslintPreferOptionalChain = [] | [{
12487
12488
  requireNullish?: boolean;
12488
12489
  }]; // ----- @typescript-eslint/prefer-promise-reject-errors -----
12489
12490
  type TypescriptEslintPreferPromiseRejectErrors = [] | [{
12491
+ allow?: (string | {
12492
+ from: "file";
12493
+ name: string | [string, ...string[]];
12494
+ path?: string;
12495
+ } | {
12496
+ from: "lib";
12497
+ name: string | [string, ...string[]];
12498
+ } | {
12499
+ from: "package";
12500
+ name: string | [string, ...string[]];
12501
+ package: string;
12502
+ })[];
12490
12503
  allowEmptyReject?: boolean;
12491
12504
  allowThrowingAny?: boolean;
12492
12505
  allowThrowingUnknown?: boolean;
@@ -14383,37 +14396,7 @@ type YamlSpacedComment = [] | ["always" | "never"] | ["always" | "never", {
14383
14396
  }];
14384
14397
  //#endregion
14385
14398
  //#region src/generated/rule-options.d.ts
14386
- type RuleOptionsIntersection = BuiltinsRuleOptions | AntfuRuleOptions | CommandRuleOptions | DeMorganRuleOptions | EslintCommentsRuleOptions | IgnoresRuleOptions | ImportsRuleOptions | JavascriptRuleOptions$1 | JsdocRuleOptions | JsoncRuleOptions | MarkdownRuleOptions | NRuleOptions | NoOnlyTestsRuleOptions | PerfectionistRuleOptions | PnpmRuleOptions | PrettierRuleOptions | ReactRuleOptions | ReactHooksRuleOptions | SortPackageJsonRuleOptions | SortTsconfigRuleOptions | StylisticRuleOptions | TomlRuleOptions | TsdocRuleOptions | TypescriptRuleOptions | UnicornRuleOptions | VitestRuleOptions | YmlRuleOptions;
14387
14399
  type RuleOptionsUnion = BuiltinsRuleOptions & AntfuRuleOptions & CommandRuleOptions & DeMorganRuleOptions & EslintCommentsRuleOptions & IgnoresRuleOptions & ImportsRuleOptions & JavascriptRuleOptions$1 & JsdocRuleOptions & JsoncRuleOptions & MarkdownRuleOptions & NRuleOptions & NoOnlyTestsRuleOptions & PerfectionistRuleOptions & PnpmRuleOptions & PrettierRuleOptions & ReactRuleOptions & ReactHooksRuleOptions & SortPackageJsonRuleOptions & SortTsconfigRuleOptions & StylisticRuleOptions & TomlRuleOptions & TsdocRuleOptions & TypescriptRuleOptions & UnicornRuleOptions & VitestRuleOptions & YmlRuleOptions;
14388
- type RuleOptionsMap = {
14389
- BuiltinsRuleOptions: BuiltinsRuleOptions;
14390
- AntfuRuleOptions: AntfuRuleOptions;
14391
- CommandRuleOptions: CommandRuleOptions;
14392
- DeMorganRuleOptions: DeMorganRuleOptions;
14393
- EslintCommentsRuleOptions: EslintCommentsRuleOptions;
14394
- IgnoresRuleOptions: IgnoresRuleOptions;
14395
- ImportsRuleOptions: ImportsRuleOptions;
14396
- JavascriptRuleOptions: JavascriptRuleOptions$1;
14397
- JsdocRuleOptions: JsdocRuleOptions;
14398
- JsoncRuleOptions: JsoncRuleOptions;
14399
- MarkdownRuleOptions: MarkdownRuleOptions;
14400
- NRuleOptions: NRuleOptions;
14401
- NoOnlyTestsRuleOptions: NoOnlyTestsRuleOptions;
14402
- PerfectionistRuleOptions: PerfectionistRuleOptions;
14403
- PnpmRuleOptions: PnpmRuleOptions;
14404
- PrettierRuleOptions: PrettierRuleOptions;
14405
- ReactRuleOptions: ReactRuleOptions;
14406
- ReactHooksRuleOptions: ReactHooksRuleOptions;
14407
- SortPackageJsonRuleOptions: SortPackageJsonRuleOptions;
14408
- SortTsconfigRuleOptions: SortTsconfigRuleOptions;
14409
- StylisticRuleOptions: StylisticRuleOptions;
14410
- TomlRuleOptions: TomlRuleOptions;
14411
- TsdocRuleOptions: TsdocRuleOptions;
14412
- TypescriptRuleOptions: TypescriptRuleOptions;
14413
- UnicornRuleOptions: UnicornRuleOptions;
14414
- VitestRuleOptions: VitestRuleOptions;
14415
- YmlRuleOptions: YmlRuleOptions;
14416
- };
14417
14400
  //#endregion
14418
14401
  //#region src/types.d.ts
14419
14402
  type RulesRecord = Linter.RulesRecord & RuleOptionsUnion;
@@ -14613,6 +14596,21 @@ type OptionsConfig = {
14613
14596
  * @default true
14614
14597
  */
14615
14598
  gitignore?: boolean | FlatGitignoreOptions;
14599
+ /**
14600
+ * Enable sorting of package.json files.
14601
+ * @default true
14602
+ */
14603
+ sortPackageJson?: boolean;
14604
+ /**
14605
+ * Enable sorting of tsconfig.json files.
14606
+ * @default true
14607
+ */
14608
+ sortTsconfig?: boolean;
14609
+ /**
14610
+ * Enable import/export sorting via perfectionist.
14611
+ * @default true
14612
+ */
14613
+ sortImports?: boolean;
14616
14614
  tsPrefix?: string;
14617
14615
  /**
14618
14616
  * Glob patterns for ADDITIONAL tsconfig files to lint (aka sort)
@@ -14686,7 +14684,6 @@ type OptionsConfig = {
14686
14684
  type RenamePefix<T extends Record<string, unknown>, FromPref extends string, ToPref extends string> = { [K in keyof T as K extends `${FromPref}${infer Rest}` ? `${ToPref}${Rest}` : K]: T[K] };
14687
14685
  //#endregion
14688
14686
  //#region src/const.d.ts
14689
- declare const DEBUG: boolean;
14690
14687
  declare const SLOW_RULES: RuleName[];
14691
14688
  //#endregion
14692
14689
  //#region src/define-config.d.ts
@@ -14701,7 +14698,7 @@ declare function defineConfig(options?: OptionsConfig & Config, ...userConfigs:
14701
14698
  type DefineConfig = typeof defineConfig;
14702
14699
  //#endregion
14703
14700
  //#region src/generated/version.d.ts
14704
- declare const VERSION = "0.5.3";
14701
+ declare const VERSION = "0.6.1";
14705
14702
  declare namespace globs_d_exports {
14706
14703
  export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_TS_SRC_EXT, GLOB_YAML };
14707
14704
  }
@@ -15073,35 +15070,20 @@ declare function importPluginStylistic(): Promise<{
15073
15070
  //#endregion
15074
15071
  //#region src/presets.d.ts
15075
15072
  declare const jsseReact: DefineConfig;
15076
- /** Ignore common files and include javascript support */
15077
- declare const presetJavascript: () => Promise<Config[]>;
15078
- /** Includes markdown, yaml + `presetJsonc` support */
15079
- declare const presetLangsExtensions: () => Promise<Config[]>;
15080
- /** Includes `presetJavaScript` and typescript support */
15081
- declare const presetBasic: () => Promise<Config[]>;
15082
- /**
15083
- * Includes
15084
- * - `presetBasic` (JS+TS) support
15085
- * - `presetLangsExtensions` (markdown, yaml, jsonc) support
15086
- * - Vue support
15087
- * - UnoCSS support (`uno.config.ts` is required)
15088
- * - Prettier support
15089
- */
15090
- declare const presetAll: () => Promise<Config[]>;
15091
15073
  //#endregion
15092
15074
  //#region src/utils.d.ts
15093
- /**
15094
- * Combine array and non-array configs into a single array.
15095
- * @param configs configs to combine
15096
- * @returns combined configs as an array
15097
- */
15098
- declare function combine(...configs: Awaitable<Config | Config[]>[]): Promise<Config[]>;
15099
15075
  /**
15100
15076
  * Combine array and non-array configs into a single array.
15101
15077
  * @param configs configs to combine and flatten
15102
15078
  * @returns combined configs as a flattened array
15103
15079
  */
15104
15080
  declare function combineAsync<T>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
15081
+ /**
15082
+ * Combine array and non-array configs into a single array.
15083
+ * @param configs configs to combine
15084
+ * @returns combined configs as an array
15085
+ */
15086
+ declare function combine(...configs: Awaitable<Config | Config[]>[]): Promise<Config[]>;
15105
15087
  declare function renameRules<TRule = unknown>(rules: Record<string, TRule>, from: string, to: string): Record<string, TRule>;
15106
15088
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
15107
15089
  default: infer U;