@so1ve/eslint-config 4.0.1 → 4.1.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/dist/index.d.mts CHANGED
@@ -3469,10 +3469,10 @@ interface RuleOptions {
3469
3469
  */
3470
3470
  'so1ve/no-import-promises-as'?: Linter.RuleEntry<[]>;
3471
3471
  /**
3472
- * Disallow inline type import.
3473
- * @see no-inline-type-import
3472
+ * Disallow inline type modifiers in import/export.
3473
+ * @see no-inline-type-modifier
3474
3474
  */
3475
- 'so1ve/no-inline-type-import'?: Linter.RuleEntry<[]>;
3475
+ 'so1ve/no-inline-type-modifier'?: Linter.RuleEntry<[]>;
3476
3476
  /**
3477
3477
  * Disallow negated comparison.
3478
3478
  * @see no-negated-comparison
@@ -3493,6 +3493,16 @@ interface RuleOptions {
3493
3493
  * @see require-async-with-await
3494
3494
  */
3495
3495
  'so1ve/require-async-with-await'?: Linter.RuleEntry<[]>;
3496
+ /**
3497
+ * Sort export declarations.
3498
+ * @see sort-exports
3499
+ */
3500
+ 'so1ve/sort-exports'?: Linter.RuleEntry<[]>;
3501
+ /**
3502
+ * Sort import declarations.
3503
+ * @see sort-imports
3504
+ */
3505
+ 'so1ve/sort-imports'?: Linter.RuleEntry<So1VeSortImports>;
3496
3506
  /**
3497
3507
  * Sort attributes of root <script>, <template>, and <style> elements in Vue files.
3498
3508
  * @see vue-root-element-sort-attributes
@@ -3604,14 +3614,6 @@ interface RuleOptions {
3604
3614
  * @see https://eslint.org/docs/latest/rules/sort-imports
3605
3615
  */
3606
3616
  'sort-imports'?: Linter.RuleEntry<SortImports>;
3607
- /**
3608
- * @see https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order
3609
- */
3610
- 'sort-imports/exports'?: Linter.RuleEntry<[]>;
3611
- /**
3612
- * @see https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order
3613
- */
3614
- 'sort-imports/imports'?: Linter.RuleEntry<SortImportsImports>;
3615
3617
  /**
3616
3618
  * Require object keys to be sorted
3617
3619
  * @see https://eslint.org/docs/latest/rules/sort-keys
@@ -12085,6 +12087,10 @@ type SemiSpacing = [] | [{
12085
12087
  }];
12086
12088
  // ----- semi-style -----
12087
12089
  type SemiStyle = [] | [("last" | "first")];
12090
+ // ----- so1ve/sort-imports -----
12091
+ type So1VeSortImports = [] | [{
12092
+ groups?: string[][];
12093
+ }];
12088
12094
  // ----- so1ve/vue-root-element-sort-attributes -----
12089
12095
  type So1VeVueRootElementSortAttributes = [] | [{
12090
12096
  script?: string[];
@@ -12140,10 +12146,6 @@ type SortImports = [] | [{
12140
12146
  ignoreMemberSort?: boolean;
12141
12147
  allowSeparatedGroups?: boolean;
12142
12148
  }];
12143
- // ----- sort-imports/imports -----
12144
- type SortImportsImports = [] | [{
12145
- groups?: string[][];
12146
- }];
12147
12149
  // ----- sort-keys -----
12148
12150
  type SortKeys = [] | [("asc" | "desc")] | [("asc" | "desc"), {
12149
12151
  caseSensitive?: boolean;
@@ -16303,7 +16305,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
16303
16305
  onlyEquality?: boolean;
16304
16306
  }];
16305
16307
  // Names of all the configs
16306
- type ConfigNames = 'so1ve/ignores' | 'so1ve/javascript/setup' | 'so1ve/javascript/rules' | 'so1ve/javascript/regexp' | 'so1ve/javascript/cli' | 'so1ve/comments/setup' | 'so1ve/comments/rules' | 'so1ve/node/setup' | 'so1ve/node/rules' | 'so1ve/only-error' | 'so1ve/promise/setup' | 'so1ve/promise/rules' | 'so1ve/sort-imports/setup' | 'so1ve/sort-imports/rules' | 'so1ve/imports/setup' | 'so1ve/imports/rules' | 'so1ve/imports/rules/dts' | 'so1ve/unicorn/setup' | 'so1ve/unicorn/rules' | 'so1ve/command' | 'so1ve/de-morgan' | 'so1ve/pnpm/package-json' | 'so1ve/pnpm/pnpm-workspace-yaml' | 'so1ve/yaml/pnpm-workspace-yaml-sort' | 'so1ve/html/setup' | 'so1ve/html/rules' | 'so1ve/typescript/setup' | 'so1ve/typescript/rules' | 'so1ve/typescript/rules/type-aware' | 'so1ve/typescript/rules/dts' | 'so1ve/typescript/rules/js' | 'so1ve/test/setup' | 'so1ve/test/rules' | 'antfu/astro/setup' | 'antfu/astro/rules' | 'so1ve/vue/setup' | 'so1ve/vue/rules' | 'so1ve/solid/setup' | 'so1ve/solid/rules' | 'so1ve/formatting/setup' | 'so1ve/formatting/rules' | 'so1ve/formatting/rules/sort-package-json' | 'so1ve/formatting/rules/sort-tsconfig' | 'so1ve/formatting/rules/test' | 'so1ve/perfectionist/setup' | 'so1ve/perfectionist/rules' | 'so1ve/jsonc/setup' | 'so1ve/jsonc/rules' | 'so1ve/toml/setup' | 'so1ve/toml/rules' | 'so1ve/yaml/setup' | 'so1ve/yaml/rules' | 'so1ve/mdx/setup' | 'so1ve/mdx/rules';
16308
+ type ConfigNames = 'so1ve/ignores' | 'so1ve/javascript/setup' | 'so1ve/javascript/rules' | 'so1ve/javascript/regexp' | 'so1ve/javascript/cli' | 'so1ve/comments/setup' | 'so1ve/comments/rules' | 'so1ve/node/setup' | 'so1ve/node/rules' | 'so1ve/only-error' | 'so1ve/promise/setup' | 'so1ve/promise/rules' | 'so1ve/sort-imports/rules' | 'so1ve/imports/setup' | 'so1ve/imports/rules' | 'so1ve/imports/rules/dts' | 'so1ve/unicorn/setup' | 'so1ve/unicorn/rules' | 'so1ve/command' | 'so1ve/de-morgan' | 'so1ve/pnpm/package-json' | 'so1ve/pnpm/pnpm-workspace-yaml' | 'so1ve/yaml/pnpm-workspace-yaml-sort' | 'so1ve/html/setup' | 'so1ve/html/rules' | 'so1ve/typescript/setup' | 'so1ve/typescript/rules' | 'so1ve/typescript/rules/type-aware' | 'so1ve/typescript/rules/dts' | 'so1ve/typescript/rules/js' | 'so1ve/test/setup' | 'so1ve/test/rules' | 'antfu/astro/setup' | 'antfu/astro/rules' | 'so1ve/vue/setup' | 'so1ve/vue/rules' | 'so1ve/solid/setup' | 'so1ve/solid/rules' | 'so1ve/formatting/setup' | 'so1ve/formatting/rules' | 'so1ve/formatting/rules/sort-package-json' | 'so1ve/formatting/rules/sort-tsconfig' | 'so1ve/formatting/rules/test' | 'so1ve/perfectionist/setup' | 'so1ve/perfectionist/rules' | 'so1ve/jsonc/setup' | 'so1ve/jsonc/rules' | 'so1ve/toml/setup' | 'so1ve/toml/rules' | 'so1ve/yaml/setup' | 'so1ve/yaml/rules' | 'so1ve/mdx/setup' | 'so1ve/mdx/rules';
16307
16309
  //#endregion
16308
16310
  //#region src/types.d.ts
16309
16311
  type MaybePromise<T> = T | Promise<T>;
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import createCommand from "eslint-plugin-command/config";
2
2
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
3
3
  import pluginSo1ve from "@so1ve/eslint-plugin";
4
- import pluginSortImports from "@so1ve/eslint-plugin-sort-imports";
5
4
  import pluginArrayFunc from "eslint-plugin-array-func";
6
5
  import pluginImportLite from "eslint-plugin-import-lite";
7
6
  import pluginImport from "eslint-plugin-import-x";
@@ -13,10 +12,10 @@ import * as pluginRegexp from "eslint-plugin-regexp";
13
12
  import pluginUnicorn from "eslint-plugin-unicorn";
14
13
  import pluginUnusedImports from "eslint-plugin-unused-imports";
15
14
  import globals from "globals";
16
- import fsPromises from "node:fs/promises";
15
+ import fs from "node:fs/promises";
17
16
  import process$1 from "node:process";
18
17
  import { fileURLToPath } from "node:url";
19
- import fs from "node:fs";
18
+ import fs$1 from "node:fs";
20
19
  import path from "node:path";
21
20
  import tseslint from "typescript-eslint";
22
21
  import { FlatConfigComposer } from "eslint-flat-config-utils";
@@ -1072,7 +1071,6 @@ async function javascript({ overrides } = {}) {
1072
1071
  "array-func": pluginArrayFunc,
1073
1072
  "no-await-in-promise": pluginNoAwaitInPromise,
1074
1073
  "so1ve": pluginSo1ve,
1075
- "sort-imports": pluginSortImports,
1076
1074
  "unused-imports": pluginUnusedImports
1077
1075
  }
1078
1076
  },
@@ -1346,8 +1344,6 @@ async function javascript({ overrides } = {}) {
1346
1344
  "require-await": "off",
1347
1345
  "so1ve/import-dedupe": "error",
1348
1346
  "so1ve/require-async-with-await": "error",
1349
- "sort-imports/exports": "error",
1350
- "sort-imports/imports": ["error"],
1351
1347
  "switch-colon-spacing": "off",
1352
1348
  "symbol-description": "off",
1353
1349
  "unused-imports/no-unused-imports": "error",
@@ -1517,7 +1513,7 @@ async function findUp(name$1, { cwd = process$1.cwd(), type = "file", stopAt } =
1517
1513
  while (directory) {
1518
1514
  const filePath = isAbsoluteName ? name$1 : path.join(directory, name$1);
1519
1515
  try {
1520
- const stats = await fsPromises.stat(filePath);
1516
+ const stats = await fs.stat(filePath);
1521
1517
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
1522
1518
  } catch {}
1523
1519
  if (directory === stopAt || directory === root) break;
@@ -1532,7 +1528,7 @@ function findUpSync(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {
1532
1528
  while (directory) {
1533
1529
  const filePath = isAbsoluteName ? name$1 : path.join(directory, name$1);
1534
1530
  try {
1535
- const stats = fs.statSync(filePath, { throwIfNoEntry: false });
1531
+ const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
1536
1532
  if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
1537
1533
  } catch {}
1538
1534
  if (directory === stopAt || directory === root) break;
@@ -1545,7 +1541,7 @@ function findUpSync(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {
1545
1541
  async function detectCatalogUsage() {
1546
1542
  const workspaceFile = await findUp("pnpm-workspace.yaml");
1547
1543
  if (!workspaceFile) return false;
1548
- const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
1544
+ const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
1549
1545
  return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1550
1546
  }
1551
1547
  async function pnpm(options) {
@@ -1689,13 +1685,10 @@ async function solid({ overrides, typescript: typescript$1 } = {}) {
1689
1685
  //#endregion
1690
1686
  //#region src/configs/sort-imports.ts
1691
1687
  const sortImports = () => [{
1692
- name: "so1ve/sort-imports/setup",
1693
- plugins: { "sort-imports": pluginSortImports }
1694
- }, {
1695
1688
  name: "so1ve/sort-imports/rules",
1696
1689
  rules: {
1697
- "sort-imports/imports": "error",
1698
- "sort-imports/exports": "error"
1690
+ "so1ve/sort-imports": "error",
1691
+ "so1ve/sort-exports": "error"
1699
1692
  }
1700
1693
  }];
1701
1694
 
@@ -1817,7 +1810,7 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1817
1810
  "no-use-before-define": "off",
1818
1811
  "no-useless-constructor": "off",
1819
1812
  "object-curly-spacing": "off",
1820
- "so1ve/no-inline-type-import": "error",
1813
+ "so1ve/no-inline-type-modifier": "error",
1821
1814
  "so1ve/prefer-ts-expect-error": "error",
1822
1815
  "space-before-blocks": "off",
1823
1816
  "space-before-function-paren": "off",
@@ -1830,8 +1823,8 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1830
1823
  "ts/consistent-indexed-object-style": ["error", "record"],
1831
1824
  "ts/consistent-type-definitions": ["error", "interface"],
1832
1825
  "ts/consistent-type-imports": ["error", {
1833
- prefer: "type-imports",
1834
- disallowTypeAnnotations: false
1826
+ disallowTypeAnnotations: false,
1827
+ prefer: "type-imports"
1835
1828
  }],
1836
1829
  "ts/explicit-function-return-type": "off",
1837
1830
  "ts/explicit-member-accessibility": ["error", {
@@ -2040,7 +2033,6 @@ const unicorn = () => [{
2040
2033
  "unicorn/prefer-spread": "error",
2041
2034
  "unicorn/prefer-string-slice": "error",
2042
2035
  "unicorn/prefer-string-starts-ends-with": "error",
2043
- "unicorn/prefer-ternary": "error",
2044
2036
  "unicorn/prefer-type-error": "error",
2045
2037
  "unicorn/relative-url-style": ["error", "always"],
2046
2038
  "unicorn/require-module-specifiers": "error",
@@ -2292,7 +2284,7 @@ function so1ve(options = {}, ...userConfigs) {
2292
2284
  const { astro: enableAstro = isPackageExists("astro"), componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], pnpm: enablePnpm = !!findUpSync("pnpm-workspace.yaml"), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2293
2285
  const configs$1 = [];
2294
2286
  if (enableGitignore) if (typeof enableGitignore === "boolean") {
2295
- if (fs.existsSync(".gitignore")) configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2287
+ if (fs$1.existsSync(".gitignore")) configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2296
2288
  } else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2297
2289
  configs$1.push(ignores(userIgnores), javascript({ overrides: getOverrides(options, "javascript") }), comments(), node(), onlyError(), promise(), sortImports(), imports(), unicorn(), command(), deMorgan());
2298
2290
  if (enablePnpm) configs$1.push(pnpm({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-config",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "type": "module",
6
6
  "description": "Ray's eslint config.",
@@ -76,8 +76,7 @@
76
76
  "typescript-eslint": "^8.50.1",
77
77
  "vue-eslint-parser": "^10.2.0",
78
78
  "yaml-eslint-parser": "^1.3.2",
79
- "@so1ve/eslint-plugin": "4.0.1",
80
- "@so1ve/eslint-plugin-sort-imports": "4.0.1"
79
+ "@so1ve/eslint-plugin": "4.1.1"
81
80
  },
82
81
  "devDependencies": {
83
82
  "eslint-plugin-de-morgan": "^2.0.0",