@rotki/eslint-config 6.0.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 +45 -53
  3. package/package.json +40 -40
package/dist/index.mjs CHANGED
@@ -99,17 +99,21 @@ const GLOB_EXCLUDE = [
99
99
  "**/.output",
100
100
  "**/.vite-inspect",
101
101
  "**/.yarn",
102
- "**/vite.config.*.timestamp-*",
103
102
  "**/.nyc_output",
104
103
  "**/.e2e",
105
104
  "**/*.patch",
106
105
  "**/*.log",
107
106
  "**/CHANGELOG*.md",
108
- "**/*.min.*",
109
107
  "**/LICENSE*",
108
+ "**/*.min.*",
110
109
  "**/__snapshots__",
110
+ "**/vite.config.*.timestamp-*",
111
111
  "**/auto-import?(s).d.ts",
112
- "**/components.d.ts"
112
+ "**/components.d.ts",
113
+ "**/.context",
114
+ "**/.claude",
115
+ "**/.agents",
116
+ "**/.*/skills"
113
117
  ];
114
118
  //#endregion
115
119
  //#region src/configs/disables.ts
@@ -186,6 +190,7 @@ async function e18e(options = {}) {
186
190
  ...modernization ? { ...configs.modernization.rules } : {},
187
191
  ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
188
192
  ...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
193
+ ...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
189
194
  "e18e/prefer-array-to-reversed": "off",
190
195
  "e18e/prefer-array-to-sorted": "off",
191
196
  "e18e/prefer-array-to-spliced": "off",
@@ -299,18 +304,20 @@ function isInGitHooksOrLintStaged() {
299
304
  //#endregion
300
305
  //#region src/configs/stylistic.ts
301
306
  const StylisticConfigDefaults = {
307
+ braceStyle: "stroustrup",
302
308
  indent: 2,
303
309
  jsx: true,
304
310
  quotes: "single",
305
311
  semi: true
306
312
  };
307
313
  async function stylistic(options = {}) {
308
- const { indent, jsx, lessOpinionated = false, overrides = {}, quotes, semi } = {
314
+ const { braceStyle, indent, jsx, lessOpinionated = false, overrides = {}, quotes, semi } = {
309
315
  ...StylisticConfigDefaults,
310
316
  ...options
311
317
  };
312
318
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
313
319
  const config = pluginStylistic.configs.customize({
320
+ braceStyle,
314
321
  indent,
315
322
  jsx,
316
323
  quotes,
@@ -485,11 +492,10 @@ async function ignores(userIgnores = []) {
485
492
  async function imports(options = {}) {
486
493
  const { overrides = {}, stylistic = true } = options;
487
494
  await ensurePackages(["@rotki/eslint-plugin"]);
488
- const pluginRotki = await interopDefault(import("@rotki/eslint-plugin"));
489
495
  return [{
490
496
  name: "rotki/import/rules",
491
497
  plugins: {
492
- "@rotki": pluginRotki,
498
+ "@rotki": await interopDefault(import("@rotki/eslint-plugin")),
493
499
  "antfu": pluginAntfu,
494
500
  "import": pluginImport
495
501
  },
@@ -857,20 +863,6 @@ async function markdown(options = {}) {
857
863
  ...overridesMarkdown
858
864
  }
859
865
  },
860
- {
861
- files,
862
- name: "rotki/markdown/disables/markdown",
863
- rules: {
864
- "@stylistic/indent": "off",
865
- "no-irregular-whitespace": "off",
866
- "perfectionist/sort-exports": "off",
867
- "perfectionist/sort-imports": "off",
868
- "regexp/no-legacy-features": "off",
869
- "regexp/no-missing-g-flag": "off",
870
- "regexp/no-useless-dollar-replacements": "off",
871
- "regexp/no-useless-flag": "off"
872
- }
873
- },
874
866
  {
875
867
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
876
868
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
@@ -938,7 +930,8 @@ async function node() {
938
930
  *
939
931
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
940
932
  */
941
- async function perfectionist() {
933
+ async function perfectionist(options = {}) {
934
+ const { overrides = {} } = options;
942
935
  return [{
943
936
  name: "rotki/perfectionist/setup",
944
937
  plugins: { perfectionist: pluginPerfectionist },
@@ -978,7 +971,8 @@ async function perfectionist() {
978
971
  "perfectionist/sort-named-imports": ["error", {
979
972
  order: "asc",
980
973
  type: "natural"
981
- }]
974
+ }],
975
+ ...overrides
982
976
  }
983
977
  }];
984
978
  }
@@ -1483,7 +1477,29 @@ async function typescript(options = {}) {
1483
1477
  const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`];
1484
1478
  const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1485
1479
  const isTypeAware = !!tsconfigPath;
1486
- 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",
1487
1503
  "@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "never" }],
1488
1504
  "@typescript-eslint/naming-convention": [
1489
1505
  "error",
@@ -1522,31 +1538,6 @@ async function typescript(options = {}) {
1522
1538
  }
1523
1539
  ]
1524
1540
  };
1525
- const typeAwareRules = {
1526
- "@typescript-eslint/await-thenable": "warn",
1527
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
1528
- "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true }],
1529
- "@typescript-eslint/no-for-in-array": "error",
1530
- "@typescript-eslint/no-implied-eval": "error",
1531
- "@typescript-eslint/no-misused-promises": "warn",
1532
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
1533
- "@typescript-eslint/no-unsafe-argument": isInEditor ? "warn" : "off",
1534
- "@typescript-eslint/no-unsafe-assignment": isInEditor ? "warn" : "off",
1535
- "@typescript-eslint/no-unsafe-call": isInEditor ? "warn" : "off",
1536
- "@typescript-eslint/no-unsafe-member-access": isInEditor ? "warn" : "off",
1537
- "@typescript-eslint/no-unsafe-return": isInEditor ? "warn" : "off",
1538
- "@typescript-eslint/only-throw-error": "error",
1539
- "@typescript-eslint/promise-function-async": "error",
1540
- "@typescript-eslint/restrict-plus-operands": "error",
1541
- "@typescript-eslint/restrict-template-expressions": "error",
1542
- "@typescript-eslint/return-await": ["error", "in-try-catch"],
1543
- "@typescript-eslint/switch-exhaustiveness-check": "error",
1544
- "@typescript-eslint/unbound-method": "warn",
1545
- "dot-notation": "off",
1546
- "no-implied-eval": "off",
1547
- "no-throw-literal": "off",
1548
- ...typeAwareCustom
1549
- };
1550
1541
  const customRules = {
1551
1542
  "@typescript-eslint/prefer-as-const": "warn",
1552
1543
  "@typescript-eslint/prefer-literal-enum-member": ["warn", { allowBitwiseExpressions: true }],
@@ -1651,7 +1642,6 @@ async function unicorn(options = {}) {
1651
1642
  name: "rotki/unicorn/rules",
1652
1643
  plugins: { unicorn: pluginUnicorn },
1653
1644
  rules: { ...options.allRecommended ? pluginUnicorn.configs.recommended.rules : {
1654
- "unicorn/better-regex": "error",
1655
1645
  "unicorn/catch-error-name": "error",
1656
1646
  "unicorn/consistent-destructuring": "warn",
1657
1647
  "unicorn/custom-error-definition": "error",
@@ -1715,7 +1705,7 @@ async function unicorn(options = {}) {
1715
1705
  async function vue(options = {}) {
1716
1706
  const { files = [GLOB_VUE], overrides = {}, stylistic = true, typescript } = options;
1717
1707
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1718
- const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1708
+ const { braceStyle = "stroustrup", indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1719
1709
  const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
1720
1710
  interopDefault(import("eslint-plugin-vue")),
1721
1711
  interopDefault(import("vue-eslint-parser")),
@@ -1942,7 +1932,7 @@ async function vue(options = {}) {
1942
1932
  }],
1943
1933
  "vue/brace-style": [
1944
1934
  "error",
1945
- "stroustrup",
1935
+ braceStyle,
1946
1936
  { allowSingleLine: true }
1947
1937
  ],
1948
1938
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -2114,7 +2104,7 @@ const defaultPluginRenaming = {
2114
2104
  * Construct an array of ESLint flat config items.
2115
2105
  */
2116
2106
  function rotki(options = {}, ...userConfigs) {
2117
- 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;
2118
2108
  let isInEditor = options.isInEditor;
2119
2109
  if (isInEditor === null) {
2120
2110
  isInEditor = isInEditorEnv();
@@ -2142,7 +2132,8 @@ function rotki(options = {}, ...userConfigs) {
2142
2132
  }), comments(), node(), imports({
2143
2133
  overrides: getOverrides(options, "imports"),
2144
2134
  stylistic: stylisticOptions
2145
- }), perfectionist());
2135
+ }));
2136
+ if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
2146
2137
  if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2147
2138
  if (enableE18e) configs.push(e18e({
2148
2139
  ...typeof enableE18e === "boolean" ? {} : enableE18e,
@@ -2215,6 +2206,7 @@ function rotki(options = {}, ...userConfigs) {
2215
2206
  if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
2216
2207
  let composer = new FlatConfigComposer();
2217
2208
  composer = composer.append(...configs, ...userConfigs);
2209
+ if (options.markdown ?? true) composer = composer.setDefaultIgnores((prev) => [...prev, GLOB_MARKDOWN]);
2218
2210
  if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
2219
2211
  if (isInEditor) composer = composer.disableRulesFix([
2220
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.0.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.0.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",