@aiou/eslint-config 3.1.2 → 3.3.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.mjs CHANGED
@@ -16,6 +16,7 @@ import pluginReact from '@eslint-react/eslint-plugin';
16
16
  import pluginReactHooks from 'eslint-plugin-react-hooks';
17
17
  import pluginReactRefresh from 'eslint-plugin-react-refresh';
18
18
  import { configs } from 'eslint-plugin-regexp';
19
+ import storybookPlugin from 'eslint-plugin-storybook';
19
20
  import pluginStylistic from '@stylistic/eslint-plugin';
20
21
  import { createRequire } from 'node:module';
21
22
  import pluginToml from 'eslint-plugin-toml';
@@ -158,7 +159,8 @@ const imports = () => {
158
159
  // ignore require third packages in .eslintrc.* e.g. eslint-define-config
159
160
  `**/.eslintrc.${GLOB_SCRIPT_EXT}`,
160
161
  `**/**/eslint.config.${GLOB_SCRIPT_EXT}`,
161
- "**/{vite,esbuild,rollup,webpack,rspack}.ts"
162
+ "**/{vite,esbuild,rollup,webpack,rspack}.ts",
163
+ "**/vitest.setup.*"
162
164
  ],
163
165
  rules: {
164
166
  "import/no-extraneous-dependencies": "off"
@@ -975,6 +977,13 @@ const regexp = () => {
975
977
  return config;
976
978
  };
977
979
 
980
+ const storybook = () => {
981
+ const config = [
982
+ ...storybookPlugin.configs["flat/recommended"]
983
+ ];
984
+ return config;
985
+ };
986
+
978
987
  const stylistic = () => {
979
988
  const config = pluginStylistic.configs.customize({
980
989
  indent: 2,
@@ -1103,13 +1112,17 @@ const stylistic = () => {
1103
1112
  const require = createRequire(import.meta.url);
1104
1113
  const tailwindcss = () => {
1105
1114
  const pluginTailwindcss = require("eslint-plugin-tailwindcss");
1115
+ const recommended = pluginTailwindcss.configs.recommended;
1116
+ const configs = Array.isArray(recommended) ? recommended : [recommended];
1117
+ const rules = {
1118
+ ...configs.find((c) => c.rules)?.rules,
1119
+ "tailwindcss/no-custom-classname": "off"
1120
+ };
1106
1121
  const config = [
1107
- ...pluginTailwindcss.configs["flat/recommended"],
1122
+ ...configs,
1108
1123
  {
1109
- rules: {
1110
- ...pluginTailwindcss.configs.recommended.rules,
1111
- "tailwindcss/no-custom-classname": "off"
1112
- }
1124
+ plugins: { tailwindcss: pluginTailwindcss.default ?? pluginTailwindcss },
1125
+ rules
1113
1126
  }
1114
1127
  ];
1115
1128
  return config;
@@ -1283,6 +1296,8 @@ const unicorn = () => {
1283
1296
  "unicorn/prefer-string-starts-ends-with": "error",
1284
1297
  "unicorn/prefer-type-error": "error",
1285
1298
  "unicorn/throw-new-error": "error",
1299
+ "unicorn/prevent-abbreviations": "off",
1300
+ "unicorn/no-null": "off",
1286
1301
  "unicorn/filename-case": ["error", {
1287
1302
  case: "kebabCase",
1288
1303
  ignore: [/^[A-Z]+\.md$/, /^[A-Z]+\.yml$/, /^\.?[A-Z]/, /^Dockerfile$/]
@@ -1337,14 +1352,16 @@ const presetDefault = [
1337
1352
  ...react(),
1338
1353
  ...stylistic(),
1339
1354
  ...presetLangsExtensions,
1340
- ...progress()
1355
+ ...progress(),
1356
+ ...storybook()
1341
1357
  ];
1342
1358
  const all = [
1343
1359
  ...presetDefault,
1344
1360
  ...tailwindcss(),
1345
1361
  ...next(),
1346
1362
  ...ssrReact(),
1347
- ...regexp()
1363
+ ...regexp(),
1364
+ ...storybook()
1348
1365
  ];
1349
1366
  const aiou = ({ ssr = true, regexp: regexp$1 = true, tailwindcss: enableTailwindcss = true } = {}, ...userConfigs) => {
1350
1367
  const configs = [...presetDefault];
@@ -0,0 +1,2 @@
1
+ import type { Config } from '../type';
2
+ export declare const storybook: () => Config[];
package/dts/globs.d.ts CHANGED
@@ -17,3 +17,5 @@ export declare const GLOB_MARKDOWN = "**/*.md";
17
17
  export declare const GLOB_VUE = "**/*.vue";
18
18
  export declare const GLOB_YAML = "**/*.y?(a)ml";
19
19
  export declare const GLOB_WORKFLOW_YAML = "**/.github/**/*.y?(a)ml";
20
+ export declare const GLOB_STORYBOOK_STORIES = "**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)";
21
+ export declare const GLOB_STORYBOOK_MAIN = ".storybook/main.@(js|cjs|mjs|ts)";
package/dts/typegen.d.ts CHANGED
@@ -5701,43 +5701,118 @@ export interface Rules {
5701
5701
  */
5702
5702
  'regexp/use-ignore-case'?: Linter.RuleEntry<[]>;
5703
5703
  /**
5704
- * Enforce a consistent and logical order of the Tailwind CSS classnames
5705
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md
5704
+ * Interactions should be awaited
5705
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/await-interactions.md
5706
+ */
5707
+ 'storybook/await-interactions'?: Linter.RuleEntry<[]>;
5708
+ /**
5709
+ * Pass a context when invoking play function of another story
5710
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/context-in-play-function.md
5711
+ */
5712
+ 'storybook/context-in-play-function'?: Linter.RuleEntry<[]>;
5713
+ /**
5714
+ * The component property should be set
5715
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/csf-component.md
5716
+ */
5717
+ 'storybook/csf-component'?: Linter.RuleEntry<[]>;
5718
+ /**
5719
+ * Story files should have a default export
5720
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/default-exports.md
5721
+ */
5722
+ 'storybook/default-exports'?: Linter.RuleEntry<[]>;
5723
+ /**
5724
+ * Deprecated hierarchy separator in title property
5725
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/hierarchy-separator.md
5726
+ */
5727
+ 'storybook/hierarchy-separator'?: Linter.RuleEntry<[]>;
5728
+ /**
5729
+ * Meta should only have inline properties
5730
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/meta-inline-properties.md
5731
+ */
5732
+ 'storybook/meta-inline-properties'?: Linter.RuleEntry<StorybookMetaInlineProperties>;
5733
+ /**
5734
+ * Meta should use `satisfies Meta`
5735
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/meta-satisfies-type.md
5736
+ */
5737
+ 'storybook/meta-satisfies-type'?: Linter.RuleEntry<[]>;
5738
+ /**
5739
+ * A story should not have a redundant name property
5740
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-redundant-story-name.md
5741
+ */
5742
+ 'storybook/no-redundant-story-name'?: Linter.RuleEntry<[]>;
5743
+ /**
5744
+ * Do not import renderer packages directly in stories
5745
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-renderer-packages.md
5746
+ */
5747
+ 'storybook/no-renderer-packages'?: Linter.RuleEntry<[]>;
5748
+ /**
5749
+ * storiesOf is deprecated and should not be used
5750
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-stories-of.md
5751
+ */
5752
+ 'storybook/no-stories-of'?: Linter.RuleEntry<[]>;
5753
+ /**
5754
+ * Do not define a title in meta
5755
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-title-property-in-meta.md
5756
+ */
5757
+ 'storybook/no-title-property-in-meta'?: Linter.RuleEntry<[]>;
5758
+ /**
5759
+ * This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name.
5760
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/no-uninstalled-addons.md
5761
+ */
5762
+ 'storybook/no-uninstalled-addons'?: Linter.RuleEntry<StorybookNoUninstalledAddons>;
5763
+ /**
5764
+ * Stories should use PascalCase
5765
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/prefer-pascal-case.md
5766
+ */
5767
+ 'storybook/prefer-pascal-case'?: Linter.RuleEntry<[]>;
5768
+ /**
5769
+ * A story file must contain at least one story export
5770
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/story-exports.md
5771
+ */
5772
+ 'storybook/story-exports'?: Linter.RuleEntry<[]>;
5773
+ /**
5774
+ * Use expect from `@storybook/test`, `storybook/test` or `@storybook/jest`
5775
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/use-storybook-expect.md
5776
+ */
5777
+ 'storybook/use-storybook-expect'?: Linter.RuleEntry<[]>;
5778
+ /**
5779
+ * Do not use testing-library directly on stories
5780
+ * @see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/docs/rules/use-storybook-testing-library.md
5781
+ */
5782
+ 'storybook/use-storybook-testing-library'?: Linter.RuleEntry<[]>;
5783
+ /**
5784
+ * Enforces a consistent order for the Tailwind CSS classnames, based on the compiler.
5785
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/classnames-order.md
5706
5786
  */
5707
5787
  'tailwindcss/classnames-order'?: Linter.RuleEntry<TailwindcssClassnamesOrder>;
5708
5788
  /**
5709
- * Warns about dash prefixed classnames using arbitrary values
5710
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md
5789
+ * Warns about `-` prefixed classnames using arbitrary values.
5790
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/enforces-negative-arbitrary-values.md
5711
5791
  */
5712
5792
  'tailwindcss/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TailwindcssEnforcesNegativeArbitraryValues>;
5713
5793
  /**
5714
- * Enforces the usage of shorthand Tailwind CSS classnames
5715
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md
5794
+ * Avoid using multiple Tailwind CSS classnames when not required.
5795
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/enforces-shorthand.md
5716
5796
  */
5717
5797
  'tailwindcss/enforces-shorthand'?: Linter.RuleEntry<TailwindcssEnforcesShorthand>;
5718
5798
  /**
5719
- * Detect obsolete classnames when upgrading to Tailwind CSS v3
5720
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md
5721
- */
5722
- 'tailwindcss/migration-from-tailwind-2'?: Linter.RuleEntry<TailwindcssMigrationFromTailwind2>;
5723
- /**
5724
- * Forbid using arbitrary values in classnames
5725
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md
5799
+ * Forbid using arbitrary values in classnames.
5800
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/no-arbitrary-value.md
5726
5801
  */
5727
5802
  'tailwindcss/no-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoArbitraryValue>;
5728
5803
  /**
5729
- * Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5")
5730
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md
5804
+ * Avoid contradicting Tailwind CSS classnames.
5805
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/no-contradicting-classname.md
5731
5806
  */
5732
5807
  'tailwindcss/no-contradicting-classname'?: Linter.RuleEntry<TailwindcssNoContradictingClassname>;
5733
5808
  /**
5734
- * Detect classnames which do not belong to Tailwind CSS
5735
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md
5809
+ * Detects classnames which do not belong to Tailwind CSS.
5810
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/no-custom-classname.md
5736
5811
  */
5737
5812
  'tailwindcss/no-custom-classname'?: Linter.RuleEntry<TailwindcssNoCustomClassname>;
5738
5813
  /**
5739
- * Forbid using arbitrary values in classnames when an equivalent preset exists
5740
- * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md
5814
+ * Avoid unjustified arbitrary classnames.
5815
+ * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/no-unnecessary-arbitrary-value.md
5741
5816
  */
5742
5817
  'tailwindcss/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoUnnecessaryArbitraryValue>;
5743
5818
  /**
@@ -13439,98 +13514,28 @@ type RegexpUnicodeProperty = [] | [
13439
13514
  });
13440
13515
  }
13441
13516
  ];
13442
- type TailwindcssClassnamesOrder = [] | [
13443
- {
13444
- callees?: string[];
13445
- ignoredKeys?: string[];
13446
- config?: (string | {
13447
- [k: string]: unknown | undefined;
13448
- });
13449
- removeDuplicates?: boolean;
13450
- tags?: string[];
13451
- [k: string]: unknown | undefined;
13452
- }
13453
- ];
13454
- type TailwindcssEnforcesNegativeArbitraryValues = [] | [
13455
- {
13456
- callees?: string[];
13457
- ignoredKeys?: string[];
13458
- config?: (string | {
13459
- [k: string]: unknown | undefined;
13460
- });
13461
- tags?: string[];
13462
- [k: string]: unknown | undefined;
13463
- }
13464
- ];
13465
- type TailwindcssEnforcesShorthand = [] | [
13517
+ type StorybookMetaInlineProperties = [] | [
13466
13518
  {
13467
- callees?: string[];
13468
- ignoredKeys?: string[];
13469
- config?: (string | {
13470
- [k: string]: unknown | undefined;
13471
- });
13472
- tags?: string[];
13473
- [k: string]: unknown | undefined;
13519
+ csfVersion?: number;
13474
13520
  }
13475
13521
  ];
13476
- type TailwindcssMigrationFromTailwind2 = [] | [
13522
+ type StorybookNoUninstalledAddons = [] | [
13477
13523
  {
13478
- callees?: string[];
13479
- ignoredKeys?: string[];
13480
- config?: (string | {
13481
- [k: string]: unknown | undefined;
13482
- });
13483
- tags?: string[];
13484
- [k: string]: unknown | undefined;
13485
- }
13486
- ];
13487
- type TailwindcssNoArbitraryValue = [] | [
13488
- {
13489
- callees?: string[];
13490
- ignoredKeys?: string[];
13491
- config?: (string | {
13492
- [k: string]: unknown | undefined;
13493
- });
13494
- tags?: string[];
13495
- [k: string]: unknown | undefined;
13496
- }
13497
- ];
13498
- type TailwindcssNoContradictingClassname = [] | [
13499
- {
13500
- callees?: string[];
13501
- ignoredKeys?: string[];
13502
- config?: (string | {
13503
- [k: string]: unknown | undefined;
13504
- });
13505
- tags?: string[];
13506
- [k: string]: unknown | undefined;
13524
+ packageJsonLocation?: string;
13525
+ ignore?: string[];
13507
13526
  }
13508
13527
  ];
13528
+ type TailwindcssClassnamesOrder = [] | [{}];
13529
+ type TailwindcssEnforcesNegativeArbitraryValues = [] | [{}];
13530
+ type TailwindcssEnforcesShorthand = [] | [{}];
13531
+ type TailwindcssNoArbitraryValue = [] | [{}];
13532
+ type TailwindcssNoContradictingClassname = [] | [{}];
13509
13533
  type TailwindcssNoCustomClassname = [] | [
13510
13534
  {
13511
- callees?: string[];
13512
- ignoredKeys?: string[];
13513
- config?: (string | {
13514
- [k: string]: unknown | undefined;
13515
- });
13516
- cssFiles?: string[];
13517
- cssFilesRefreshRate?: number;
13518
- tags?: string[];
13519
13535
  whitelist?: string[];
13520
- [k: string]: unknown | undefined;
13521
- }
13522
- ];
13523
- type TailwindcssNoUnnecessaryArbitraryValue = [] | [
13524
- {
13525
- callees?: string[];
13526
- ignoredKeys?: string[];
13527
- config?: (string | {
13528
- [k: string]: unknown | undefined;
13529
- });
13530
- tags?: string[];
13531
- [k: string]: unknown | undefined;
13532
13536
  }
13533
13537
  ];
13538
+ type TailwindcssNoUnnecessaryArbitraryValue = [] | [{}];
13534
13539
  type TomlArrayBracketNewline = [] | [
13535
13540
  (("always" | "never" | "consistent") | {
13536
13541
  multiline?: boolean;
@@ -14218,5 +14223,5 @@ type YmlSpacedComment = [] | [("always" | "never")] | [
14218
14223
  markers?: string[];
14219
14224
  }
14220
14225
  ];
14221
- export type ConfigNames = 'markdown/recommended/plugin' | 'markdown/recommended/processor' | 'markdown/recommended/code-blocks' | 'tailwindcss:base' | 'tailwindcss:rules';
14226
+ export type ConfigNames = 'markdown/recommended/plugin' | 'markdown/recommended/processor' | 'markdown/recommended/code-blocks' | 'storybook:recommended:setup' | 'storybook:recommended:stories-rules' | 'storybook:recommended:main-rules' | 'tailwindcss/recommended' | 'storybook:recommended:setup' | 'storybook:recommended:stories-rules' | 'storybook:recommended:main-rules';
14222
14227
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiou/eslint-config",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "description": "eslint config for JW",
6
6
  "keywords": [],
@@ -35,7 +35,13 @@
35
35
  "access": "public"
36
36
  },
37
37
  "peerDependencies": {
38
- "eslint": ">=10"
38
+ "eslint": ">=10",
39
+ "tailwindcss": "^4.0.0"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "tailwindcss": {
43
+ "optional": true
44
+ }
39
45
  },
40
46
  "dependencies": {
41
47
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
@@ -55,7 +61,8 @@
55
61
  "eslint-plugin-react-hooks": "^7.1.1",
56
62
  "eslint-plugin-react-refresh": "^0.5.2",
57
63
  "eslint-plugin-regexp": "^3.1.0",
58
- "eslint-plugin-tailwindcss": "^3.18.3",
64
+ "eslint-plugin-storybook": "^10.4.0",
65
+ "eslint-plugin-tailwindcss": "4.0.0-alpha.6",
59
66
  "eslint-plugin-toml": "^1.3.1",
60
67
  "eslint-plugin-unicorn": "^64.0.0",
61
68
  "eslint-plugin-unused-imports": "^4.4.1",
@@ -64,7 +71,7 @@
64
71
  "jsonc-eslint-parser": "^3.1.0",
65
72
  "local-pkg": "^1.1.2",
66
73
  "yaml-eslint-parser": "^2.0.0",
67
- "@aiou/eslint-ignore": "0.6.1",
74
+ "@aiou/eslint-ignore": "0.6.3",
68
75
  "@aiou/eslint-plugin-progress": "0.4.0"
69
76
  },
70
77
  "devDependencies": {
@@ -83,6 +90,7 @@
83
90
  "rollup-plugin-esbuild": "^5.0.0",
84
91
  "rollup-plugin-filesize": "9.1.2",
85
92
  "rollup-plugin-node-externals": "5.1.2",
93
+ "tailwindcss": "^4.3.1",
86
94
  "tsx": "^4.20.0"
87
95
  },
88
96
  "scripts": {