@rotki/eslint-config 2.2.0 → 2.4.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.
package/dist/index.cjs CHANGED
@@ -1079,7 +1079,7 @@ async function rotkiPlugin(options = {}) {
1079
1079
  }
1080
1080
  },
1081
1081
  rules: {
1082
- ...pluginRotki.configs.recommended.rules,
1082
+ "@rotki/no-depreacted-classes": "error",
1083
1083
  ...overrides
1084
1084
  }
1085
1085
  }
@@ -2031,6 +2031,49 @@ async function yaml(options = {}) {
2031
2031
  ];
2032
2032
  }
2033
2033
 
2034
+ // src/configs/storybook.ts
2035
+ async function storybook(options = {}) {
2036
+ const {
2037
+ overrides = {}
2038
+ } = options;
2039
+ await ensurePackages(["eslint-plugin-storybook"]);
2040
+ const [pluginStorybook] = await Promise.all([
2041
+ interopDefault(import("eslint-plugin-storybook"))
2042
+ ]);
2043
+ return [
2044
+ {
2045
+ plugins: {
2046
+ storybook: pluginStorybook
2047
+ }
2048
+ },
2049
+ {
2050
+ files: [
2051
+ `*.stories.${GLOB_SRC_EXT}`,
2052
+ `*.story.${GLOB_SRC_EXT}`
2053
+ ],
2054
+ rules: {
2055
+ "import/no-anonymous-default-export": "off",
2056
+ "storybook/await-interactions": "error",
2057
+ "storybook/context-in-play-function": "error",
2058
+ "storybook/default-exports": "error",
2059
+ "storybook/hierarchy-separator": "warn",
2060
+ "storybook/no-redundant-story-name": "warn",
2061
+ "storybook/prefer-pascal-case": "warn",
2062
+ "storybook/story-exports": "error",
2063
+ "storybook/use-storybook-expect": "error",
2064
+ "storybook/use-storybook-testing-library": "error",
2065
+ ...overrides
2066
+ }
2067
+ },
2068
+ {
2069
+ files: [`.storybook/main.${GLOB_SRC_EXT}`],
2070
+ rules: {
2071
+ "storybook/no-uninstalled-addons": "error"
2072
+ }
2073
+ }
2074
+ ];
2075
+ }
2076
+
2034
2077
  // src/factory.ts
2035
2078
  var flatConfigProps = [
2036
2079
  "files",
@@ -2055,6 +2098,7 @@ async function rotki(options = {}, ...userConfigs) {
2055
2098
  gitignore: enableGitignore = true,
2056
2099
  isInEditor = !!((import_node_process4.default.env.VSCODE_PID || import_node_process4.default.env.JETBRAINS_IDE || import_node_process4.default.env.VIM) && !import_node_process4.default.env.CI),
2057
2100
  rotki: enableRotki,
2101
+ storybook: enableStorybook,
2058
2102
  typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
2059
2103
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
2060
2104
  vueI18n: enableVueI18n,
@@ -2142,6 +2186,11 @@ async function rotki(options = {}, ...userConfigs) {
2142
2186
  typescript: !!enableTypeScript
2143
2187
  }));
2144
2188
  }
2189
+ if (enableStorybook) {
2190
+ configs.push(storybook({
2191
+ overrides: getOverrides(options, "storybook")
2192
+ }));
2193
+ }
2145
2194
  if (options.jsonc ?? true) {
2146
2195
  configs.push(
2147
2196
  jsonc({
package/dist/index.d.cts CHANGED
@@ -16,6 +16,55 @@ export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
16
16
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
17
17
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
18
18
 
19
+ interface AwaitInteractionsRule {
20
+ 'await-interactions': RuleConfig<[]>;
21
+ }
22
+ interface ContextInPlayFunctionRule {
23
+ 'context-in-play-function': RuleConfig<[]>;
24
+ }
25
+ interface CsfComponentsRule {
26
+ 'csf-component': RuleConfig<[]>;
27
+ }
28
+ interface DefaultExportsRule {
29
+ 'default-exports': RuleConfig<[]>;
30
+ }
31
+ interface HierarchySeparatorRule {
32
+ 'hierarchy-separator': RuleConfig<[]>;
33
+ }
34
+ interface MetaInlinePropertiesRule {
35
+ 'meta-inline-properties': RuleConfig<[{
36
+ csfVersion?: number;
37
+ }]>;
38
+ }
39
+ interface NoRedundantStoryNameRule {
40
+ 'no-redundant-story-name': RuleConfig<[]>;
41
+ }
42
+ interface NoStoriesOfRule {
43
+ 'no-stories-of': RuleConfig<[]>;
44
+ }
45
+ interface NoTitlePropertyInMetaRule {
46
+ 'no-title-property-in-met': RuleConfig<[]>;
47
+ }
48
+ interface NoUninstalledAddonRule {
49
+ 'no-uninstalled-addons': RuleConfig<[{
50
+ packageJsonLocation?: string;
51
+ ignore?: string[];
52
+ }]>;
53
+ }
54
+ interface PreferPascalCaseRule {
55
+ 'prefer-pascal-case': RuleConfig<[]>;
56
+ }
57
+ interface StoryExportsRule {
58
+ 'prefer-pascal-case': RuleConfig<[]>;
59
+ }
60
+ interface UseStorybookExpectRule {
61
+ 'use-storybook-expect': RuleConfig<[]>;
62
+ }
63
+ interface UseStorybookTestingLibraryRule {
64
+ 'use-storybook-testing-library': RuleConfig<[]>;
65
+ }
66
+ type StorybookRules = AwaitInteractionsRule & ContextInPlayFunctionRule & CsfComponentsRule & DefaultExportsRule & HierarchySeparatorRule & MetaInlinePropertiesRule & NoRedundantStoryNameRule & NoStoriesOfRule & NoTitlePropertyInMetaRule & NoUninstalledAddonRule & PreferPascalCaseRule & StoryExportsRule & UseStorybookExpectRule & UseStorybookTestingLibraryRule;
67
+
19
68
  type ValidVLostConfiguration = [
20
69
  {
21
70
  allowModifiers?: boolean;
@@ -184,7 +233,7 @@ type WrapRuleConfig<T extends {
184
233
  [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
185
234
  };
186
235
  type Awaitable<T> = T | Promise<T>;
187
- type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-eslint/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, '@stylestic'> & Prefix<Rules$1, 'antfu/'> & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$1 & EslintCommentsRules & {
236
+ type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-eslint/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, '@stylistic/'> & Prefix<Rules$1, 'antfu/'> & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$1 & EslintCommentsRules & {
188
237
  'test/no-only-tests': RuleConfig<[]>;
189
238
  } & {
190
239
  'cypress/no-assigning-return-values': RuleConfig<[]>;
@@ -195,7 +244,12 @@ type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-e
195
244
  'cypress/no-pause': RuleConfig<[]>;
196
245
  } & {
197
246
  '@rotki/no-deprecated-classes': RuleConfig<[]>;
198
- } & VuetifyRules & Prefix<VueI18nRules, '@intlify/vue-i18n/'>>>;
247
+ '@rotki/no-deprecated-props': RuleConfig<[]>;
248
+ '@rotki/no-deprecated-components': RuleConfig<[{
249
+ legacy?: boolean;
250
+ }]>;
251
+ '@rotki/no-legacy-library-import': RuleConfig<[]>;
252
+ } & VuetifyRules & Prefix<VueI18nRules, '@intlify/vue-i18n/'> & Prefix<StorybookRules, 'storybook/'>>>;
199
253
  type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
200
254
  plugins?: Record<string, any>;
201
255
  };
@@ -432,6 +486,14 @@ interface OptionsConfig extends OptionsComponentExts {
432
486
  * @default false
433
487
  */
434
488
  vueI18n?: boolean | OptionsVueI18n;
489
+ /**
490
+ * Enable storybook linting support
491
+ *
492
+ * Requires installing
493
+ * - `eslint-plugin-storybook
494
+ *
495
+ */
496
+ storybook?: boolean | OptionsOverrides;
435
497
  /**
436
498
  * Control to disable some rules in editors.
437
499
  * @default auto-detect based on the process.env
package/dist/index.d.ts CHANGED
@@ -16,6 +16,55 @@ export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
16
16
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
17
17
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
18
18
 
19
+ interface AwaitInteractionsRule {
20
+ 'await-interactions': RuleConfig<[]>;
21
+ }
22
+ interface ContextInPlayFunctionRule {
23
+ 'context-in-play-function': RuleConfig<[]>;
24
+ }
25
+ interface CsfComponentsRule {
26
+ 'csf-component': RuleConfig<[]>;
27
+ }
28
+ interface DefaultExportsRule {
29
+ 'default-exports': RuleConfig<[]>;
30
+ }
31
+ interface HierarchySeparatorRule {
32
+ 'hierarchy-separator': RuleConfig<[]>;
33
+ }
34
+ interface MetaInlinePropertiesRule {
35
+ 'meta-inline-properties': RuleConfig<[{
36
+ csfVersion?: number;
37
+ }]>;
38
+ }
39
+ interface NoRedundantStoryNameRule {
40
+ 'no-redundant-story-name': RuleConfig<[]>;
41
+ }
42
+ interface NoStoriesOfRule {
43
+ 'no-stories-of': RuleConfig<[]>;
44
+ }
45
+ interface NoTitlePropertyInMetaRule {
46
+ 'no-title-property-in-met': RuleConfig<[]>;
47
+ }
48
+ interface NoUninstalledAddonRule {
49
+ 'no-uninstalled-addons': RuleConfig<[{
50
+ packageJsonLocation?: string;
51
+ ignore?: string[];
52
+ }]>;
53
+ }
54
+ interface PreferPascalCaseRule {
55
+ 'prefer-pascal-case': RuleConfig<[]>;
56
+ }
57
+ interface StoryExportsRule {
58
+ 'prefer-pascal-case': RuleConfig<[]>;
59
+ }
60
+ interface UseStorybookExpectRule {
61
+ 'use-storybook-expect': RuleConfig<[]>;
62
+ }
63
+ interface UseStorybookTestingLibraryRule {
64
+ 'use-storybook-testing-library': RuleConfig<[]>;
65
+ }
66
+ type StorybookRules = AwaitInteractionsRule & ContextInPlayFunctionRule & CsfComponentsRule & DefaultExportsRule & HierarchySeparatorRule & MetaInlinePropertiesRule & NoRedundantStoryNameRule & NoStoriesOfRule & NoTitlePropertyInMetaRule & NoUninstalledAddonRule & PreferPascalCaseRule & StoryExportsRule & UseStorybookExpectRule & UseStorybookTestingLibraryRule;
67
+
19
68
  type ValidVLostConfiguration = [
20
69
  {
21
70
  allowModifiers?: boolean;
@@ -184,7 +233,7 @@ type WrapRuleConfig<T extends {
184
233
  [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
185
234
  };
186
235
  type Awaitable<T> = T | Promise<T>;
187
- type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-eslint/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, '@stylestic'> & Prefix<Rules$1, 'antfu/'> & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$1 & EslintCommentsRules & {
236
+ type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-eslint/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, '@stylistic/'> & Prefix<Rules$1, 'antfu/'> & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$1 & EslintCommentsRules & {
188
237
  'test/no-only-tests': RuleConfig<[]>;
189
238
  } & {
190
239
  'cypress/no-assigning-return-values': RuleConfig<[]>;
@@ -195,7 +244,12 @@ type Rules = WrapRuleConfig<MergeIntersection<Prefix<RuleOptions, '@typescript-e
195
244
  'cypress/no-pause': RuleConfig<[]>;
196
245
  } & {
197
246
  '@rotki/no-deprecated-classes': RuleConfig<[]>;
198
- } & VuetifyRules & Prefix<VueI18nRules, '@intlify/vue-i18n/'>>>;
247
+ '@rotki/no-deprecated-props': RuleConfig<[]>;
248
+ '@rotki/no-deprecated-components': RuleConfig<[{
249
+ legacy?: boolean;
250
+ }]>;
251
+ '@rotki/no-legacy-library-import': RuleConfig<[]>;
252
+ } & VuetifyRules & Prefix<VueI18nRules, '@intlify/vue-i18n/'> & Prefix<StorybookRules, 'storybook/'>>>;
199
253
  type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
200
254
  plugins?: Record<string, any>;
201
255
  };
@@ -432,6 +486,14 @@ interface OptionsConfig extends OptionsComponentExts {
432
486
  * @default false
433
487
  */
434
488
  vueI18n?: boolean | OptionsVueI18n;
489
+ /**
490
+ * Enable storybook linting support
491
+ *
492
+ * Requires installing
493
+ * - `eslint-plugin-storybook
494
+ *
495
+ */
496
+ storybook?: boolean | OptionsOverrides;
435
497
  /**
436
498
  * Control to disable some rules in editors.
437
499
  * @default auto-detect based on the process.env
package/dist/index.js CHANGED
@@ -986,7 +986,7 @@ async function rotkiPlugin(options = {}) {
986
986
  }
987
987
  },
988
988
  rules: {
989
- ...pluginRotki.configs.recommended.rules,
989
+ "@rotki/no-depreacted-classes": "error",
990
990
  ...overrides
991
991
  }
992
992
  }
@@ -1938,6 +1938,49 @@ async function yaml(options = {}) {
1938
1938
  ];
1939
1939
  }
1940
1940
 
1941
+ // src/configs/storybook.ts
1942
+ async function storybook(options = {}) {
1943
+ const {
1944
+ overrides = {}
1945
+ } = options;
1946
+ await ensurePackages(["eslint-plugin-storybook"]);
1947
+ const [pluginStorybook] = await Promise.all([
1948
+ interopDefault(import("eslint-plugin-storybook"))
1949
+ ]);
1950
+ return [
1951
+ {
1952
+ plugins: {
1953
+ storybook: pluginStorybook
1954
+ }
1955
+ },
1956
+ {
1957
+ files: [
1958
+ `*.stories.${GLOB_SRC_EXT}`,
1959
+ `*.story.${GLOB_SRC_EXT}`
1960
+ ],
1961
+ rules: {
1962
+ "import/no-anonymous-default-export": "off",
1963
+ "storybook/await-interactions": "error",
1964
+ "storybook/context-in-play-function": "error",
1965
+ "storybook/default-exports": "error",
1966
+ "storybook/hierarchy-separator": "warn",
1967
+ "storybook/no-redundant-story-name": "warn",
1968
+ "storybook/prefer-pascal-case": "warn",
1969
+ "storybook/story-exports": "error",
1970
+ "storybook/use-storybook-expect": "error",
1971
+ "storybook/use-storybook-testing-library": "error",
1972
+ ...overrides
1973
+ }
1974
+ },
1975
+ {
1976
+ files: [`.storybook/main.${GLOB_SRC_EXT}`],
1977
+ rules: {
1978
+ "storybook/no-uninstalled-addons": "error"
1979
+ }
1980
+ }
1981
+ ];
1982
+ }
1983
+
1941
1984
  // src/factory.ts
1942
1985
  var flatConfigProps = [
1943
1986
  "files",
@@ -1962,6 +2005,7 @@ async function rotki(options = {}, ...userConfigs) {
1962
2005
  gitignore: enableGitignore = true,
1963
2006
  isInEditor = !!((process4.env.VSCODE_PID || process4.env.JETBRAINS_IDE || process4.env.VIM) && !process4.env.CI),
1964
2007
  rotki: enableRotki,
2008
+ storybook: enableStorybook,
1965
2009
  typescript: enableTypeScript = isPackageExists2("typescript"),
1966
2010
  vue: enableVue = VuePackages.some((i) => isPackageExists2(i)),
1967
2011
  vueI18n: enableVueI18n,
@@ -2049,6 +2093,11 @@ async function rotki(options = {}, ...userConfigs) {
2049
2093
  typescript: !!enableTypeScript
2050
2094
  }));
2051
2095
  }
2096
+ if (enableStorybook) {
2097
+ configs.push(storybook({
2098
+ overrides: getOverrides(options, "storybook")
2099
+ }));
2100
+ }
2052
2101
  if (options.jsonc ?? true) {
2053
2102
  configs.push(
2054
2103
  jsonc({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rotki/eslint-config",
3
- "version": "2.2.0",
4
- "packageManager": "pnpm@8.14.1",
3
+ "version": "2.4.0",
4
+ "packageManager": "pnpm@8.14.3",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
7
7
  "bugs": {
@@ -25,9 +25,10 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@intlify/eslint-plugin-vue-i18n": "^2.0.0",
28
- "@rotki/eslint-plugin": ">=0.0.3",
28
+ "@rotki/eslint-plugin": ">=0.2.0",
29
29
  "eslint": ">=8.56.0",
30
30
  "eslint-plugin-cypress": ">=2.15.0",
31
+ "eslint-plugin-storybook": "^0.6.15",
31
32
  "eslint-plugin-vuetify": "^1 || ^2"
32
33
  },
33
34
  "peerDependenciesMeta": {
@@ -40,6 +41,9 @@
40
41
  "eslint-plugin-cypress": {
41
42
  "optional": true
42
43
  },
44
+ "eslint-plugin-storybook": {
45
+ "optional": true
46
+ },
43
47
  "eslint-plugin-vuetify": {
44
48
  "optional": true
45
49
  }
@@ -49,18 +53,18 @@
49
53
  "@antfu/install-pkg": "0.3.1",
50
54
  "@eslint-types/typescript-eslint": "6.18.1",
51
55
  "@eslint-types/unicorn": "50.0.1",
52
- "@stylistic/eslint-plugin": "1.5.3",
53
- "@typescript-eslint/eslint-plugin": "6.18.1",
54
- "@typescript-eslint/parser": "6.18.1",
56
+ "@stylistic/eslint-plugin": "1.5.4",
57
+ "@typescript-eslint/eslint-plugin": "6.19.0",
58
+ "@typescript-eslint/parser": "6.19.0",
55
59
  "eslint-config-flat-gitignore": "0.1.2",
56
60
  "eslint-config-prettier": "9.1.0",
57
61
  "eslint-merge-processors": "0.1.0",
58
- "eslint-plugin-antfu": "2.1.1",
62
+ "eslint-plugin-antfu": "2.1.2",
59
63
  "eslint-plugin-eslint-comments": "3.2.0",
60
64
  "eslint-plugin-format": "0.1.0",
61
65
  "eslint-plugin-html": "7.1.0",
62
66
  "eslint-plugin-i": "2.29.1",
63
- "eslint-plugin-jsonc": "2.11.2",
67
+ "eslint-plugin-jsonc": "2.12.2",
64
68
  "eslint-plugin-markdown": "3.0.1",
65
69
  "eslint-plugin-n": "16.6.2",
66
70
  "eslint-plugin-no-only-tests": "3.1.0",
@@ -70,24 +74,24 @@
70
74
  "eslint-plugin-unused-imports": "3.0.0",
71
75
  "eslint-plugin-vitest": "0.3.20",
72
76
  "eslint-plugin-vue": "9.20.1",
73
- "eslint-plugin-yml": "1.11.0",
77
+ "eslint-plugin-yml": "1.12.2",
74
78
  "eslint-processor-vue-blocks": "0.1.1",
75
79
  "globals": "13.24.0",
76
80
  "jsonc-eslint-parser": "2.4.0",
77
81
  "local-pkg": "0.5.0",
78
- "prettier": "3.2.2",
82
+ "prettier": "3.2.4",
79
83
  "prompts": "2.4.2",
80
- "vue-eslint-parser": "9.4.0",
84
+ "vue-eslint-parser": "9.4.1",
81
85
  "yaml-eslint-parser": "1.2.2"
82
86
  },
83
87
  "devDependencies": {
84
- "@commitlint/cli": "18.4.4",
85
- "@commitlint/config-conventional": "18.4.4",
88
+ "@commitlint/cli": "18.5.0",
89
+ "@commitlint/config-conventional": "18.5.0",
86
90
  "@rotki/eslint-config": "*",
87
91
  "@types/eslint": "8.56.2",
88
- "@types/node": "20.11.2",
92
+ "@types/node": "20.11.5",
89
93
  "@types/prompts": "2.4.9",
90
- "bumpp": "9.2.1",
94
+ "bumpp": "9.3.0",
91
95
  "eslint": "8.56.0",
92
96
  "eslint-flat-config-viewer": "0.1.11",
93
97
  "husky": "8.0.3",