@rotki/eslint-config 6.1.0 → 6.2.0

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.
Files changed (3) hide show
  1. package/dist/index.d.mts +668 -230
  2. package/dist/index.mjs +37 -50
  3. package/package.json +40 -40
package/dist/index.mjs CHANGED
@@ -304,18 +304,20 @@ function isInGitHooksOrLintStaged() {
304
304
  //#endregion
305
305
  //#region src/configs/stylistic.ts
306
306
  const StylisticConfigDefaults = {
307
+ braceStyle: "stroustrup",
307
308
  indent: 2,
308
309
  jsx: true,
309
310
  quotes: "single",
310
311
  semi: true
311
312
  };
312
313
  async function stylistic(options = {}) {
313
- const { indent, jsx, lessOpinionated = false, overrides = {}, quotes, semi } = {
314
+ const { braceStyle, indent, jsx, lessOpinionated = false, overrides = {}, quotes, semi } = {
314
315
  ...StylisticConfigDefaults,
315
316
  ...options
316
317
  };
317
318
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
318
319
  const config = pluginStylistic.configs.customize({
320
+ braceStyle,
319
321
  indent,
320
322
  jsx,
321
323
  quotes,
@@ -490,11 +492,10 @@ async function ignores(userIgnores = []) {
490
492
  async function imports(options = {}) {
491
493
  const { overrides = {}, stylistic = true } = options;
492
494
  await ensurePackages(["@rotki/eslint-plugin"]);
493
- const pluginRotki = await interopDefault(import("@rotki/eslint-plugin"));
494
495
  return [{
495
496
  name: "rotki/import/rules",
496
497
  plugins: {
497
- "@rotki": pluginRotki,
498
+ "@rotki": await interopDefault(import("@rotki/eslint-plugin")),
498
499
  "antfu": pluginAntfu,
499
500
  "import": pluginImport
500
501
  },
@@ -862,20 +863,6 @@ async function markdown(options = {}) {
862
863
  ...overridesMarkdown
863
864
  }
864
865
  },
865
- {
866
- files,
867
- name: "rotki/markdown/disables/markdown",
868
- rules: {
869
- "@stylistic/indent": "off",
870
- "no-irregular-whitespace": "off",
871
- "perfectionist/sort-exports": "off",
872
- "perfectionist/sort-imports": "off",
873
- "regexp/no-legacy-features": "off",
874
- "regexp/no-missing-g-flag": "off",
875
- "regexp/no-useless-dollar-replacements": "off",
876
- "regexp/no-useless-flag": "off"
877
- }
878
- },
879
866
  {
880
867
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
881
868
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
@@ -943,7 +930,8 @@ async function node() {
943
930
  *
944
931
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
945
932
  */
946
- async function perfectionist() {
933
+ async function perfectionist(options = {}) {
934
+ const { overrides = {} } = options;
947
935
  return [{
948
936
  name: "rotki/perfectionist/setup",
949
937
  plugins: { perfectionist: pluginPerfectionist },
@@ -983,7 +971,8 @@ async function perfectionist() {
983
971
  "perfectionist/sort-named-imports": ["error", {
984
972
  order: "asc",
985
973
  type: "natural"
986
- }]
974
+ }],
975
+ ...overrides
987
976
  }
988
977
  }];
989
978
  }
@@ -1488,7 +1477,29 @@ async function typescript(options = {}) {
1488
1477
  const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`];
1489
1478
  const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1490
1479
  const isTypeAware = !!tsconfigPath;
1491
- const typeAwareCustom = {
1480
+ const typeAwareRules = {
1481
+ "@typescript-eslint/await-thenable": "warn",
1482
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
1483
+ "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true }],
1484
+ "@typescript-eslint/no-for-in-array": "error",
1485
+ "@typescript-eslint/no-implied-eval": "error",
1486
+ "@typescript-eslint/no-misused-promises": "warn",
1487
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
1488
+ "@typescript-eslint/no-unsafe-argument": isInEditor ? "warn" : "off",
1489
+ "@typescript-eslint/no-unsafe-assignment": isInEditor ? "warn" : "off",
1490
+ "@typescript-eslint/no-unsafe-call": isInEditor ? "warn" : "off",
1491
+ "@typescript-eslint/no-unsafe-member-access": isInEditor ? "warn" : "off",
1492
+ "@typescript-eslint/no-unsafe-return": isInEditor ? "warn" : "off",
1493
+ "@typescript-eslint/only-throw-error": "error",
1494
+ "@typescript-eslint/promise-function-async": "error",
1495
+ "@typescript-eslint/restrict-plus-operands": "error",
1496
+ "@typescript-eslint/restrict-template-expressions": "error",
1497
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
1498
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
1499
+ "@typescript-eslint/unbound-method": "warn",
1500
+ "dot-notation": "off",
1501
+ "no-implied-eval": "off",
1502
+ "no-throw-literal": "off",
1492
1503
  "@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "never" }],
1493
1504
  "@typescript-eslint/naming-convention": [
1494
1505
  "error",
@@ -1527,31 +1538,6 @@ async function typescript(options = {}) {
1527
1538
  }
1528
1539
  ]
1529
1540
  };
1530
- const typeAwareRules = {
1531
- "@typescript-eslint/await-thenable": "warn",
1532
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
1533
- "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true }],
1534
- "@typescript-eslint/no-for-in-array": "error",
1535
- "@typescript-eslint/no-implied-eval": "error",
1536
- "@typescript-eslint/no-misused-promises": "warn",
1537
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
1538
- "@typescript-eslint/no-unsafe-argument": isInEditor ? "warn" : "off",
1539
- "@typescript-eslint/no-unsafe-assignment": isInEditor ? "warn" : "off",
1540
- "@typescript-eslint/no-unsafe-call": isInEditor ? "warn" : "off",
1541
- "@typescript-eslint/no-unsafe-member-access": isInEditor ? "warn" : "off",
1542
- "@typescript-eslint/no-unsafe-return": isInEditor ? "warn" : "off",
1543
- "@typescript-eslint/only-throw-error": "error",
1544
- "@typescript-eslint/promise-function-async": "error",
1545
- "@typescript-eslint/restrict-plus-operands": "error",
1546
- "@typescript-eslint/restrict-template-expressions": "error",
1547
- "@typescript-eslint/return-await": ["error", "in-try-catch"],
1548
- "@typescript-eslint/switch-exhaustiveness-check": "error",
1549
- "@typescript-eslint/unbound-method": "warn",
1550
- "dot-notation": "off",
1551
- "no-implied-eval": "off",
1552
- "no-throw-literal": "off",
1553
- ...typeAwareCustom
1554
- };
1555
1541
  const customRules = {
1556
1542
  "@typescript-eslint/prefer-as-const": "warn",
1557
1543
  "@typescript-eslint/prefer-literal-enum-member": ["warn", { allowBitwiseExpressions: true }],
@@ -1656,7 +1642,6 @@ async function unicorn(options = {}) {
1656
1642
  name: "rotki/unicorn/rules",
1657
1643
  plugins: { unicorn: pluginUnicorn },
1658
1644
  rules: { ...options.allRecommended ? pluginUnicorn.configs.recommended.rules : {
1659
- "unicorn/better-regex": "error",
1660
1645
  "unicorn/catch-error-name": "error",
1661
1646
  "unicorn/consistent-destructuring": "warn",
1662
1647
  "unicorn/custom-error-definition": "error",
@@ -1720,7 +1705,7 @@ async function unicorn(options = {}) {
1720
1705
  async function vue(options = {}) {
1721
1706
  const { files = [GLOB_VUE], overrides = {}, stylistic = true, typescript } = options;
1722
1707
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1723
- const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1708
+ const { braceStyle = "stroustrup", indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1724
1709
  const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
1725
1710
  interopDefault(import("eslint-plugin-vue")),
1726
1711
  interopDefault(import("vue-eslint-parser")),
@@ -1947,7 +1932,7 @@ async function vue(options = {}) {
1947
1932
  }],
1948
1933
  "vue/brace-style": [
1949
1934
  "error",
1950
- "stroustrup",
1935
+ braceStyle,
1951
1936
  { allowSingleLine: true }
1952
1937
  ],
1953
1938
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -2119,7 +2104,7 @@ const defaultPluginRenaming = {
2119
2104
  * Construct an array of ESLint flat config items.
2120
2105
  */
2121
2106
  function rotki(options = {}, ...userConfigs) {
2122
- const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, jsx = true, pnpm: enablePnpm = !!findUpSync("pnpm-workspace.yaml"), regexp: enableRegexp = false, rotki: enableRotki, storybook: enableStorybook, typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)), vueI18n: enableVueI18n } = options;
2107
+ const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, jsx = true, perfectionist: enablePerfectionist = true, pnpm: enablePnpm = !!findUpSync("pnpm-workspace.yaml"), regexp: enableRegexp = false, rotki: enableRotki, storybook: enableStorybook, typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)), vueI18n: enableVueI18n } = options;
2123
2108
  let isInEditor = options.isInEditor;
2124
2109
  if (isInEditor === null) {
2125
2110
  isInEditor = isInEditorEnv();
@@ -2147,7 +2132,8 @@ function rotki(options = {}, ...userConfigs) {
2147
2132
  }), comments(), node(), imports({
2148
2133
  overrides: getOverrides(options, "imports"),
2149
2134
  stylistic: stylisticOptions
2150
- }), perfectionist());
2135
+ }));
2136
+ if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
2151
2137
  if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2152
2138
  if (enableE18e) configs.push(e18e({
2153
2139
  ...typeof enableE18e === "boolean" ? {} : enableE18e,
@@ -2220,6 +2206,7 @@ function rotki(options = {}, ...userConfigs) {
2220
2206
  if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
2221
2207
  let composer = new FlatConfigComposer();
2222
2208
  composer = composer.append(...configs, ...userConfigs);
2209
+ if (options.markdown ?? true) composer = composer.setDefaultIgnores((prev) => [...prev, GLOB_MARKDOWN]);
2223
2210
  if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
2224
2211
  if (isInEditor) composer = composer.disableRulesFix([
2225
2212
  "unused-imports/no-unused-imports",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rotki/eslint-config",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "bugs": {
@@ -20,11 +20,11 @@
20
20
  ".": "./dist/index.mjs"
21
21
  },
22
22
  "peerDependencies": {
23
- "@intlify/eslint-plugin-vue-i18n": "^4.0.0",
23
+ "@intlify/eslint-plugin-vue-i18n": "^4.2.0",
24
24
  "@prettier/plugin-xml": "^3.4.1",
25
- "@rotki/eslint-plugin": ">=1.3.0",
26
- "eslint": ">=9.20.0",
27
- "eslint-plugin-storybook": ">=0.11.0"
25
+ "@rotki/eslint-plugin": ">=1.4.0",
26
+ "eslint": "^9.20.0 || ^10.0.0",
27
+ "eslint-plugin-storybook": ">=10.2.14"
28
28
  },
29
29
  "peerDependenciesMeta": {
30
30
  "@intlify/eslint-plugin-vue-i18n": {
@@ -42,61 +42,61 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@antfu/install-pkg": "1.1.0",
45
- "@clack/prompts": "1.1.0",
46
- "@e18e/eslint-plugin": "0.3.0",
47
- "@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
48
- "@eslint/markdown": "8.0.1",
45
+ "@clack/prompts": "1.5.1",
46
+ "@e18e/eslint-plugin": "0.5.0",
47
+ "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
48
+ "@eslint/markdown": "8.0.2",
49
49
  "@stylistic/eslint-plugin": "5.10.0",
50
- "@typescript-eslint/eslint-plugin": "8.58.0",
51
- "@typescript-eslint/parser": "8.58.0",
52
- "@vitest/eslint-plugin": "1.6.14",
50
+ "@typescript-eslint/eslint-plugin": "8.61.0",
51
+ "@typescript-eslint/parser": "8.61.0",
52
+ "@vitest/eslint-plugin": "1.6.20",
53
53
  "eslint-config-flat-gitignore": "2.3.0",
54
54
  "eslint-config-prettier": "10.1.8",
55
- "eslint-flat-config-utils": "3.0.2",
55
+ "eslint-flat-config-utils": "3.2.0",
56
56
  "eslint-merge-processors": "2.0.0",
57
- "eslint-plugin-antfu": "3.2.2",
57
+ "eslint-plugin-antfu": "3.2.3",
58
58
  "eslint-plugin-format": "2.0.1",
59
59
  "eslint-plugin-html": "8.1.4",
60
60
  "eslint-plugin-import-lite": "0.6.0",
61
- "eslint-plugin-jsonc": "3.1.2",
62
- "eslint-plugin-n": "17.24.0",
63
- "eslint-plugin-no-only-tests": "3.3.0",
64
- "eslint-plugin-perfectionist": "5.7.0",
65
- "eslint-plugin-pnpm": "1.6.0",
66
- "eslint-plugin-prettier": "5.5.5",
61
+ "eslint-plugin-jsonc": "3.2.0",
62
+ "eslint-plugin-n": "18.1.0",
63
+ "eslint-plugin-no-only-tests": "3.4.0",
64
+ "eslint-plugin-perfectionist": "5.9.0",
65
+ "eslint-plugin-pnpm": "1.6.1",
66
+ "eslint-plugin-prettier": "5.5.6",
67
67
  "eslint-plugin-regexp": "3.1.0",
68
- "eslint-plugin-unicorn": "64.0.0",
68
+ "eslint-plugin-unicorn": "65.0.1",
69
69
  "eslint-plugin-unused-imports": "4.4.1",
70
- "eslint-plugin-vue": "10.8.0",
71
- "eslint-plugin-yml": "3.3.1",
70
+ "eslint-plugin-vue": "10.9.2",
71
+ "eslint-plugin-yml": "3.4.0",
72
72
  "eslint-processor-vue-blocks": "2.0.0",
73
73
  "find-up-simple": "1.0.1",
74
- "globals": "17.4.0",
75
- "local-pkg": "1.1.2",
76
- "prettier": "3.8.1",
77
- "vue-eslint-parser": "10.4.0",
74
+ "globals": "17.6.0",
75
+ "local-pkg": "1.2.1",
76
+ "prettier": "3.8.4",
77
+ "vue-eslint-parser": "10.4.1",
78
78
  "yaml-eslint-parser": "2.0.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@commitlint/cli": "20.5.0",
82
- "@commitlint/config-conventional": "20.5.0",
83
- "@eslint/config-inspector": "1.5.0",
84
- "@rotki/eslint-plugin": "1.3.2",
81
+ "@commitlint/cli": "21.0.2",
82
+ "@commitlint/config-conventional": "21.0.2",
83
+ "@eslint/config-inspector": "3.0.4",
84
+ "@rotki/eslint-plugin": "1.4.0",
85
85
  "@types/node": "24.12.0",
86
86
  "@types/prompts": "2.4.9",
87
- "bumpp": "11.0.1",
88
- "eslint": "9.39.4",
87
+ "bumpp": "11.1.0",
88
+ "eslint": "10.4.1",
89
89
  "eslint-typegen": "2.3.1",
90
90
  "execa": "9.6.1",
91
91
  "husky": "9.1.7",
92
- "lint-staged": "16.4.0",
92
+ "lint-staged": "17.0.7",
93
93
  "rimraf": "6.1.3",
94
- "tinyglobby": "0.2.15",
95
- "tsdown": "0.21.7",
96
- "tsx": "4.21.0",
97
- "typescript": "5.9.3",
98
- "vitest": "4.1.2",
99
- "@rotki/eslint-config": "6.1.0"
94
+ "tinyglobby": "0.2.17",
95
+ "tsdown": "0.22.2",
96
+ "tsx": "4.22.4",
97
+ "typescript": "6.0.3",
98
+ "vitest": "4.1.8",
99
+ "@rotki/eslint-config": "6.2.0"
100
100
  },
101
101
  "engines": {
102
102
  "node": ">=24 <25",