@chanyuxi/eslint-waltz 1.0.0 → 1.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/README.md CHANGED
@@ -19,7 +19,7 @@ The following configuration modules are available:
19
19
  - JSONC and imports are enabled by default and can be disabled with `json: false` and `imports: false`.
20
20
  - TypeScript, React, Tailwind CSS, and gitignore support are opt-in.
21
21
 
22
- The `stylistic` configuration is always enabled. Perfectionist is enabled by default with JSX prop sorting.
22
+ The `stylistic` configuration is always enabled. Perfectionist is enabled by default with the `recommended-alphabetical` preset.
23
23
 
24
24
  # Usage
25
25
 
@@ -33,7 +33,7 @@ pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin es
33
33
 
34
34
  Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-tailwindcss`, `tailwindcss`, or the React ESLint plugins.
35
35
 
36
- Perfectionist's `sort-jsx-props` rule is enabled by default for JSX props. Use `perfectionist: { preset: 'recommended-alphabetical' }` to enable its full recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
36
+ Perfectionist uses the `recommended-alphabetical` preset by default. Use `perfectionist: { preset: 'recommended-custom' }`, `recommended-line-length`, or `recommended-natural` to select another recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
37
37
 
38
38
  Tailwind CSS support targets `eslint-plugin-tailwindcss` 4.x and Tailwind CSS 4.x. Node.js `>=20.19.0` is required when the Tailwind CSS module is enabled.
39
39
 
package/dist/cli.js CHANGED
@@ -1490,9 +1490,9 @@ async function syncVSCodeSettings(cwd = process.cwd()) {
1490
1490
  }
1491
1491
  const eol = source.includes('\r\n') ? '\r\n' : '\n';
1492
1492
  const formattingOptions = {
1493
+ eol,
1493
1494
  insertSpaces: true,
1494
1495
  tabSize: 2,
1495
- eol,
1496
1496
  };
1497
1497
  for (const setting of managedSettings) {
1498
1498
  source = applyEdits(source, modify(source, setting.path, setting.value, { formattingOptions }));
@@ -1508,13 +1508,6 @@ async function syncVSCodeSettings(cwd = process.cwd()) {
1508
1508
  return { changed, filePath };
1509
1509
  }
1510
1510
 
1511
- function printHelp() {
1512
- console.log(`Usage: eslint-waltz <command>
1513
-
1514
- Commands:
1515
- sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
1516
- `);
1517
- }
1518
1511
  async function main() {
1519
1512
  const [command] = process$1.argv.slice(2);
1520
1513
  if (command === '--help' || command === '-h') {
@@ -1531,6 +1524,13 @@ async function main() {
1531
1524
  ? `Updated ${result.filePath}`
1532
1525
  : `${result.filePath} is already synchronized`);
1533
1526
  }
1527
+ function printHelp() {
1528
+ console.log(`Usage: eslint-waltz <command>
1529
+
1530
+ Commands:
1531
+ sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
1532
+ `);
1533
+ }
1534
1534
  main().catch((error) => {
1535
1535
  console.error(error instanceof Error ? error.message : error);
1536
1536
  process$1.exitCode = 1;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import globals from 'globals';
2
1
  import { Linter } from 'eslint';
3
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
4
3
  import { PluginSettings } from 'eslint-plugin-tailwindcss';
4
+ import globals from 'globals';
5
5
 
6
6
  /* eslint-disable */
7
7
  /* prettier-ignore */
@@ -9868,28 +9868,8 @@ type TailwindcssNoCustomClassname = []|[{
9868
9868
  // ----- tailwindcss/no-unnecessary-arbitrary-value -----
9869
9869
  type TailwindcssNoUnnecessaryArbitraryValue = []|[{}]
9870
9870
 
9871
- type Rules = Record<string, Linter.RuleEntry | undefined> & RuleOptions;
9872
- interface LinterConfig extends Omit<Linter.Config, 'rules'> {
9873
- rules?: Rules;
9874
- }
9875
- type Arraiable<T> = T | Array<T>;
9876
- type UnresolvedLinterConfig = Arraiable<LinterConfig> | Promise<Arraiable<LinterConfig>>;
9877
- interface SharedOptions {
9878
- /**
9879
- * Restrict this module's configuration to the specified files.
9880
- *
9881
- * Each module has its own default file pattern. Providing this option
9882
- * replaces that pattern; it does not add another pattern to the default.
9883
- */
9884
- files?: Linter.Config['files'];
9885
- /**
9886
- * Override rules within this module's file scope.
9887
- *
9888
- * Rule names are not restricted to the plugin used by this module, so core
9889
- * ESLint rules and rules from other configured plugins can also be set here.
9890
- */
9891
- overrides?: LinterConfig['rules'];
9892
- }
9871
+ type ImportsOptions = SharedOptions;
9872
+ type JsoncOptions = SharedOptions;
9893
9873
  interface JsOptions extends SharedOptions {
9894
9874
  /**
9895
9875
  * Add predefined global variables to JavaScript files.
@@ -9899,18 +9879,15 @@ interface JsOptions extends SharedOptions {
9899
9879
  */
9900
9880
  globals?: (keyof typeof globals)[];
9901
9881
  }
9902
- type TsOptions = SharedOptions;
9903
- type StylisticOptions = SharedOptions;
9904
- type JsoncOptions = SharedOptions;
9905
- type ImportsOptions = SharedOptions;
9906
- type ReactOptions = SharedOptions;
9907
- type PerfectionistPreset = 'recommended-alphabetical' | 'recommended-natural' | 'recommended-line-length' | 'recommended-custom';
9882
+ interface LinterConfig extends Omit<Linter.Config, 'rules'> {
9883
+ rules?: Rules;
9884
+ }
9908
9885
  interface PerfectionistOptions extends SharedOptions {
9909
9886
  /**
9910
9887
  * Select one of Perfectionist's full recommended presets.
9911
9888
  *
9912
- * Without a preset, only `perfectionist/sort-jsx-props` is enabled by
9913
- * default. A preset enables all of the plugin's sorting rules.
9889
+ * Without a preset, the `recommended-alphabetical` preset is enabled by
9890
+ * default. A preset selects one of the plugin's recommended presets.
9914
9891
  */
9915
9892
  preset?: PerfectionistPreset;
9916
9893
  /**
@@ -9921,6 +9898,25 @@ interface PerfectionistOptions extends SharedOptions {
9921
9898
  */
9922
9899
  settings?: Linter.Config['settings'];
9923
9900
  }
9901
+ type PerfectionistPreset = 'recommended-alphabetical' | 'recommended-custom' | 'recommended-line-length' | 'recommended-natural';
9902
+ type ReactOptions = SharedOptions;
9903
+ interface SharedOptions {
9904
+ /**
9905
+ * Restrict this module's configuration to the specified files.
9906
+ *
9907
+ * Each module has its own default file pattern. Providing this option
9908
+ * replaces that pattern; it does not add another pattern to the default.
9909
+ */
9910
+ files?: Linter.Config['files'];
9911
+ /**
9912
+ * Override rules within this module's file scope.
9913
+ *
9914
+ * Rule names are not restricted to the plugin used by this module, so core
9915
+ * ESLint rules and rules from other configured plugins can also be set here.
9916
+ */
9917
+ overrides?: LinterConfig['rules'];
9918
+ }
9919
+ type StylisticOptions = SharedOptions;
9924
9920
  interface TailwindcssOptions extends SharedOptions {
9925
9921
  /**
9926
9922
  * Configure the shared settings used by `eslint-plugin-tailwindcss`.
@@ -9932,6 +9928,8 @@ interface TailwindcssOptions extends SharedOptions {
9932
9928
  tailwindcss?: PluginSettings;
9933
9929
  };
9934
9930
  }
9931
+ type TsOptions = SharedOptions;
9932
+ type UnresolvedLinterConfig = Arraiable<LinterConfig> | Promise<Arraiable<LinterConfig>>;
9935
9933
  interface WaltzOptions {
9936
9934
  /**
9937
9935
  * Treat patterns from `.gitignore` as global ESLint ignores.
@@ -9943,6 +9941,19 @@ interface WaltzOptions {
9943
9941
  * @see https://github.com/antfu/eslint-config-flat-gitignore
9944
9942
  */
9945
9943
  gitignore?: boolean | FlatGitignoreOptions;
9944
+ /**
9945
+ * Enable rules for validating imports and exports. Import ordering is
9946
+ * provided by Perfectionist when enabled, and by `imports/order` otherwise.
9947
+ *
9948
+ * This configuration is enabled by default. JavaScript files are included
9949
+ * by default, and the scope also includes TypeScript files when `ts` is
9950
+ * enabled. Set this option to `false` to disable it, or pass an options
9951
+ * object to change the file scope or override rules.
9952
+ *
9953
+ * @default true
9954
+ * @see https://github.com/un-ts/eslint-plugin-import-x
9955
+ */
9956
+ imports?: boolean | ImportsOptions;
9946
9957
  /**
9947
9958
  * Configure the core ESLint rules for JavaScript files.
9948
9959
  *
@@ -9954,70 +9965,30 @@ interface WaltzOptions {
9954
9965
  * @see https://github.com/eslint/eslint.git
9955
9966
  */
9956
9967
  js?: JsOptions;
9957
- /**
9958
- * Enable TypeScript support for TypeScript files.
9959
- *
9960
- * `true` enables the TypeScript parser and the recommended
9961
- * `typescript-eslint` rules. By default, this applies to `.ts`, `.tsx`,
9962
- * `.mts`, and `.cts` files, including their JSX variants. Passing an
9963
- * options object additionally allows the TypeScript file scope and rules to
9964
- * be customized with `files` and `overrides`.
9965
- *
9966
- * When enabled, the default stylistic, import, and React configurations also
9967
- * include TypeScript files when those configurations are enabled.
9968
- *
9969
- * @default false
9970
- * @see https://typescript-eslint.io/linting/configs/#recommended-config
9971
- */
9972
- ts?: boolean | TsOptions;
9973
- /**
9974
- * Configure stylistic rules for script files.
9975
- *
9976
- * This configuration is always enabled and uses `@stylistic/eslint-plugin`.
9977
- * It targets JavaScript files by default, and also targets TypeScript files
9978
- * when `ts` is enabled. Perfectionist is provided as a separate default
9979
- * configuration through the `perfectionist` option.
9980
- *
9981
- * @default {}
9982
- * @see https://eslint.style/
9983
- * @see https://perfectionist.dev/rules/sort-jsx-props
9984
- */
9985
- stylistic?: StylisticOptions;
9986
- /**
9987
- * Configure Perfectionist sorting rules.
9988
- *
9989
- * This configuration is enabled by default with
9990
- * `perfectionist/sort-jsx-props`. Set it to `false` to disable it, or pass
9991
- * a `preset` to enable one of the full recommended configurations.
9992
- *
9993
- * @default true
9994
- * @see https://perfectionist.dev/configs
9995
- * @see https://perfectionist.dev/rules/sort-jsx-props
9996
- */
9997
- perfectionist?: boolean | PerfectionistOptions;
9998
9968
  /**
9999
9969
  * Enable linting for JSON, JSON5, and JSONC files.
10000
9970
  *
10001
9971
  * The default configuration also sorts keys in `package.json` and
10002
- * TypeScript configuration files. Pass an options object to change the file
10003
- * scope or override rules.
9972
+ * TypeScript configuration files. Passing `files` changes the scope of the
9973
+ * general JSON rules; the specialized file sorting remains targeted to
9974
+ * those file names.
10004
9975
  *
10005
9976
  * @default true
10006
9977
  * @see https://github.com/ota-meshi/eslint-plugin-jsonc
10007
9978
  */
10008
9979
  json?: boolean | JsoncOptions;
10009
9980
  /**
10010
- * Enable rules for validating and ordering imports and exports.
9981
+ * Configure Perfectionist sorting rules.
10011
9982
  *
10012
- * This configuration is enabled by default. JavaScript files are included
10013
- * by default, and the scope also includes TypeScript files when `ts` is
10014
- * enabled. Set this option to `false` to disable it, or pass an options
10015
- * object to change the file scope or override rules.
9983
+ * This configuration is enabled by default with the
9984
+ * `recommended-alphabetical` preset. Set it to `false` to disable it, or
9985
+ * pass a `preset` to select one of the recommended configurations.
10016
9986
  *
10017
9987
  * @default true
10018
- * @see https://github.com/un-ts/eslint-plugin-import-x
9988
+ * @see https://perfectionist.dev/configs
9989
+ * @see https://perfectionist.dev/rules/sort-jsx-props
10019
9990
  */
10020
- imports?: boolean | ImportsOptions;
9991
+ perfectionist?: boolean | PerfectionistOptions;
10021
9992
  /**
10022
9993
  * Enable React-specific lint rules.
10023
9994
  *
@@ -10029,6 +10000,19 @@ interface WaltzOptions {
10029
10000
  * @see https://github.com/Rel1cx/eslint-react
10030
10001
  */
10031
10002
  react?: boolean | ReactOptions;
10003
+ /**
10004
+ * Configure stylistic rules for script files.
10005
+ *
10006
+ * This configuration is always enabled and uses `@stylistic/eslint-plugin`.
10007
+ * It targets JavaScript files by default, and also targets TypeScript files
10008
+ * when `ts` is enabled. Perfectionist is provided as a separate default
10009
+ * configuration through the `perfectionist` option.
10010
+ *
10011
+ * @default {}
10012
+ * @see https://eslint.style/
10013
+ * @see https://perfectionist.dev/rules/sort-jsx-props
10014
+ */
10015
+ stylistic?: StylisticOptions;
10032
10016
  /**
10033
10017
  * Enable Tailwind CSS class name linting.
10034
10018
  *
@@ -10043,7 +10027,25 @@ interface WaltzOptions {
10043
10027
  * @see https://github.com/francoismassart/eslint-plugin-tailwindcss
10044
10028
  */
10045
10029
  tailwindcss?: boolean | TailwindcssOptions;
10030
+ /**
10031
+ * Enable TypeScript support for TypeScript files.
10032
+ *
10033
+ * `true` enables the TypeScript parser and the recommended
10034
+ * `typescript-eslint` rules. By default, this applies to `.ts`, `.tsx`,
10035
+ * `.mts`, and `.cts` files, including their JSX variants. Passing an
10036
+ * options object additionally allows the TypeScript file scope and rules to
10037
+ * be customized with `files` and `overrides`.
10038
+ *
10039
+ * When enabled, the default stylistic, import, and React configurations also
10040
+ * include TypeScript files when those configurations are enabled.
10041
+ *
10042
+ * @default false
10043
+ * @see https://typescript-eslint.io/linting/configs/#recommended-config
10044
+ */
10045
+ ts?: boolean | TsOptions;
10046
10046
  }
10047
+ type Arraiable<T> = Array<T> | T;
10048
+ type Rules = Record<string, Linter.RuleEntry | undefined> & RuleOptions;
10047
10049
 
10048
10050
  declare function waltz(options?: WaltzOptions, ...orders: LinterConfig[]): Promise<LinterConfig[]>;
10049
10051
 
package/dist/index.js CHANGED
@@ -1,42 +1,20 @@
1
1
  import eslint from '@eslint/js';
2
2
  import globals from 'globals';
3
3
 
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- function importDefault(moduleName) {
6
- return import(moduleName).then(m => m.default);
7
- }
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- function importDefaultAs(moduleName,
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- cast) {
12
- return import(moduleName).then(m => cast(m.default));
13
- }
14
4
  function importGitignoreSeek() {
15
5
  return importDefault('eslint-config-flat-gitignore');
16
6
  }
17
- function importTypeScriptPlugin() {
18
- return importDefaultAs('typescript-eslint', d => d.plugin);
19
- }
20
- function importTypeScriptParser() {
21
- return importDefaultAs('typescript-eslint', d => d.parser);
22
- }
23
- function importTypeScriptRecommendedRules() {
24
- return import('typescript-eslint').then(({ configs }) => Object.assign({}, ...configs.recommended.map(config => config.rules ?? {})));
25
- }
26
- function importStylisticPlugin() {
27
- return importDefault('@stylistic/eslint-plugin');
28
- }
29
- function importJsoncPlugin() {
30
- return importDefaultAs('eslint-plugin-jsonc', d => d);
7
+ function importImportXPlugin() {
8
+ return importDefault('eslint-plugin-import-x');
31
9
  }
32
10
  function importJsoncParser() {
33
11
  return import('jsonc-eslint-parser');
34
12
  }
35
- function importImportXPlugin() {
36
- return importDefault('eslint-plugin-import-x');
13
+ function importJsoncPlugin() {
14
+ return importDefaultAs('eslint-plugin-jsonc', d => d);
37
15
  }
38
- function importReactPlugin() {
39
- return importDefaultAs('eslint-plugin-react-x', d => d);
16
+ function importPerfectionistPlugin() {
17
+ return importDefault('eslint-plugin-perfectionist');
40
18
  }
41
19
  function importReactDebugPlugin() {
42
20
  return importDefaultAs('eslint-plugin-react-debug', d => d);
@@ -50,14 +28,36 @@ function importReactHookExtraPlugin() {
50
28
  function importReactNamingConventionPlugin() {
51
29
  return importDefaultAs('eslint-plugin-react-naming-convention', d => d);
52
30
  }
31
+ function importReactPlugin() {
32
+ return importDefaultAs('eslint-plugin-react-x', d => d);
33
+ }
53
34
  function importReactWebApiPlugin() {
54
35
  return importDefaultAs('eslint-plugin-react-web-api', d => d);
55
36
  }
37
+ function importStylisticPlugin() {
38
+ return importDefault('@stylistic/eslint-plugin');
39
+ }
56
40
  function importTailwindcssPlugin() {
57
41
  return importDefault('eslint-plugin-tailwindcss');
58
42
  }
59
- function importPerfectionistPlugin() {
60
- return importDefault('eslint-plugin-perfectionist');
43
+ function importTypeScriptParser() {
44
+ return importDefaultAs('typescript-eslint', d => d.parser);
45
+ }
46
+ function importTypeScriptPlugin() {
47
+ return importDefaultAs('typescript-eslint', d => d.plugin);
48
+ }
49
+ function importTypeScriptRecommendedRules() {
50
+ return import('typescript-eslint').then(({ configs }) => Object.assign({}, ...configs.recommended.map(config => config.rules ?? {})));
51
+ }
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ function importDefault(moduleName) {
54
+ return import(moduleName).then(m => m.default);
55
+ }
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ function importDefaultAs(moduleName,
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ cast) {
60
+ return import(moduleName).then(m => cast(m.default));
61
61
  }
62
62
 
63
63
  async function gitignore(enable) {
@@ -72,81 +72,91 @@ const TS_FILES = '**/*.?([cm])ts?(x)';
72
72
  const JSON_FILES = '**/*.{json,json5,jsonc}';
73
73
  const ALL_SCRIPTS_FILES = [JS_FILES, TS_FILES];
74
74
 
75
- async function importsConfig(isEnableTypeScript = false, options = {}) {
75
+ async function importsConfig(isEnableTypeScript = false, options = {}, relative = {}) {
76
76
  const importsPlugin = await importImportXPlugin();
77
77
  const scriptFiles = isEnableTypeScript ? ALL_SCRIPTS_FILES : [JS_FILES];
78
78
  const files = options.files ?? scriptFiles;
79
+ const { 'imports/order': orderOverride, ...overrides } = options.overrides ?? {};
80
+ const orderRules = {
81
+ 'imports/order': orderOverride ?? [
82
+ 'error',
83
+ {
84
+ 'alphabetize': {
85
+ caseInsensitive: true,
86
+ order: 'asc',
87
+ orderImportKind: 'asc',
88
+ },
89
+ 'distinctGroup': false,
90
+ 'groups': [
91
+ 'builtin',
92
+ 'external',
93
+ 'parent',
94
+ 'sibling',
95
+ 'index',
96
+ 'type',
97
+ ['object', 'unknown'],
98
+ ],
99
+ 'named': true,
100
+ 'newlines-between': 'always',
101
+ 'pathGroups': [
102
+ {
103
+ group: 'internal',
104
+ pattern: '@/**',
105
+ position: 'before',
106
+ },
107
+ {
108
+ group: 'unknown',
109
+ pattern: '*.{css,scss,less}',
110
+ patternOptions: { matchBase: true },
111
+ position: 'after',
112
+ },
113
+ {
114
+ group: 'unknown',
115
+ pattern: '*.{svg,png,jpg,gif,webp}',
116
+ patternOptions: { matchBase: true },
117
+ position: 'after',
118
+ },
119
+ ],
120
+ 'pathGroupsExcludedImportTypes': ['builtin'],
121
+ 'warnOnUnassignedImports': true,
122
+ },
123
+ ],
124
+ };
79
125
  return [
80
126
  {
81
- name: 'waltz/imports/setup',
82
127
  files,
128
+ name: 'waltz/imports/setup',
83
129
  plugins: {
84
130
  imports: importsPlugin,
85
131
  },
86
132
  },
87
133
  {
88
- name: 'waltz/imports/rules',
89
134
  files,
135
+ name: 'waltz/imports/rules',
90
136
  rules: {
91
- 'imports/named': 'error',
92
- 'imports/namespace': 'error',
93
137
  'imports/default': 'error',
94
138
  'imports/export': 'error',
139
+ 'imports/named': 'error',
140
+ 'imports/namespace': 'error',
141
+ 'imports/no-duplicates': 'warn',
95
142
  'imports/no-named-as-default': 'warn',
96
143
  'imports/no-named-as-default-member': 'warn',
97
- 'imports/no-duplicates': 'warn',
98
- 'imports/order': [
99
- 'error',
100
- {
101
- 'groups': [
102
- 'builtin',
103
- 'external',
104
- 'parent',
105
- 'sibling',
106
- 'index',
107
- 'type',
108
- ['object', 'unknown'],
109
- ],
110
- 'pathGroups': [
111
- {
112
- pattern: '@/**',
113
- group: 'internal',
114
- position: 'before',
115
- },
116
- {
117
- pattern: '*.{css,scss,less}',
118
- group: 'unknown',
119
- patternOptions: { matchBase: true },
120
- position: 'after',
121
- },
122
- {
123
- pattern: '*.{svg,png,jpg,gif,webp}',
124
- group: 'unknown',
125
- patternOptions: { matchBase: true },
126
- position: 'after',
127
- },
128
- ],
129
- 'pathGroupsExcludedImportTypes': ['builtin'],
130
- 'newlines-between': 'always',
131
- 'alphabetize': {
132
- order: 'asc',
133
- caseInsensitive: true,
134
- orderImportKind: 'asc',
135
- },
136
- 'named': true,
137
- 'warnOnUnassignedImports': true,
138
- 'distinctGroup': false,
139
- },
140
- ],
141
- ...options.overrides,
144
+ ...overrides,
142
145
  },
143
146
  },
147
+ {
148
+ files,
149
+ ...(relative.perfectionistFiles
150
+ ? { ignores: relative.perfectionistFiles }
151
+ : {}),
152
+ name: 'waltz/imports/order',
153
+ rules: orderRules,
154
+ },
144
155
  ];
145
156
  }
146
157
 
147
158
  function jsConfig(config = {}, relative) {
148
159
  return {
149
- name: 'waltz/js/rules',
150
160
  files: config.files ?? [JS_FILES],
151
161
  languageOptions: {
152
162
  globals: {
@@ -162,6 +172,7 @@ function jsConfig(config = {}, relative) {
162
172
  },
163
173
  },
164
174
  },
175
+ name: 'waltz/js/rules',
165
176
  rules: {
166
177
  ...eslint.configs.recommended.rules,
167
178
  ...config.overrides,
@@ -175,27 +186,31 @@ async function jsoncConfig(options = {}) {
175
186
  importJsoncParser(),
176
187
  ]);
177
188
  const files = options.files ?? [JSON_FILES];
178
- const packageJsonFiles = options.files ?? ['**/package.json'];
179
- const tsconfigFiles = options.files ?? [
189
+ const packageJsonFiles = ['**/package.json'];
190
+ const tsconfigFiles = [
180
191
  '**/[jt]sconfig.json',
181
192
  '**/[jt]sconfig.*.json',
182
193
  ];
194
+ const setupFiles = options.files
195
+ ? [...options.files, ...packageJsonFiles, ...tsconfigFiles]
196
+ : files;
183
197
  return [
184
198
  {
199
+ files: setupFiles,
200
+ languageOptions: {
201
+ parser: jsoncParser,
202
+ },
185
203
  name: 'waltz/jsonc/setup',
186
- files,
187
204
  plugins: {
188
205
  jsonc: jsoncPlugin,
189
206
  },
190
- languageOptions: {
191
- parser: jsoncParser,
192
- },
193
207
  },
194
208
  {
195
- name: 'waltz/jsonc/rules',
196
209
  files,
210
+ name: 'waltz/jsonc/rules',
197
211
  rules: {
198
212
  'jsonc/comma-dangle': 'error',
213
+ 'jsonc/indent': ['error', 2],
199
214
  'jsonc/no-bigint-literals': 'error',
200
215
  'jsonc/no-binary-expression': 'error',
201
216
  'jsonc/no-binary-numeric-literals': 'error',
@@ -209,8 +224,8 @@ async function jsoncConfig(options = {}) {
209
224
  'jsonc/no-nan': 'error',
210
225
  'jsonc/no-number-props': 'error',
211
226
  'jsonc/no-numeric-separators': 'error',
212
- 'jsonc/no-octal-numeric-literals': 'error',
213
227
  'jsonc/no-octal': 'error',
228
+ 'jsonc/no-octal-numeric-literals': 'error',
214
229
  'jsonc/no-parenthesized': 'error',
215
230
  'jsonc/no-plus-sign': 'error',
216
231
  'jsonc/no-regexp-literals': 'error',
@@ -224,13 +239,12 @@ async function jsoncConfig(options = {}) {
224
239
  'jsonc/space-unary-ops': 'error',
225
240
  'jsonc/valid-json-number': 'error',
226
241
  'jsonc/vue-custom-block/no-parsing-error': 'error',
227
- 'jsonc/indent': ['error', 2],
228
242
  ...options.overrides,
229
243
  },
230
244
  },
231
245
  {
232
- name: 'waltz/jsonc/sort/package-json',
233
246
  files: packageJsonFiles,
247
+ name: 'waltz/jsonc/sort/package-json',
234
248
  rules: {
235
249
  'jsonc/sort-array-values': [
236
250
  'error',
@@ -329,8 +343,8 @@ async function jsoncConfig(options = {}) {
329
343
  },
330
344
  },
331
345
  {
332
- name: 'waltz/jsonc/sort/tsconfig-json',
333
346
  files: tsconfigFiles,
347
+ name: 'waltz/jsonc/sort/tsconfig-json',
334
348
  rules: {
335
349
  'jsonc/sort-keys': [
336
350
  'error',
@@ -460,22 +474,20 @@ async function perfectionistConfig(options = {}, relative) {
460
474
  const scriptFiles = relative.isEnableTypeScript
461
475
  ? ALL_SCRIPTS_FILES
462
476
  : [JS_FILES];
463
- const recommendedRules = options.preset
464
- ? perfectionist.configs[options.preset].rules ?? {}
465
- : {
466
- 'perfectionist/sort-jsx-props': 'error',
467
- };
477
+ const ruleFiles = options.files ?? scriptFiles;
478
+ const preset = options.preset ?? 'recommended-alphabetical';
479
+ const recommendedRules = perfectionist.configs[preset].rules ?? {};
468
480
  return [
469
481
  {
482
+ files: ruleFiles,
470
483
  name: 'waltz/perfectionist/setup',
471
- files: scriptFiles,
472
484
  plugins: {
473
485
  perfectionist,
474
486
  },
475
487
  },
476
488
  {
489
+ files: ruleFiles,
477
490
  name: 'waltz/perfectionist/rules',
478
- files: options.files ?? scriptFiles,
479
491
  ...(options.settings ? { settings: options.settings } : {}),
480
492
  rules: {
481
493
  ...recommendedRules,
@@ -485,11 +497,133 @@ async function perfectionistConfig(options = {}, relative) {
485
497
  ];
486
498
  }
487
499
 
500
+ async function reactConfig(options = {}, relative) {
501
+ const resolvedConfig = typeof options === 'boolean' ? {} : options;
502
+ const [reactPlugin, reactDebugPlugin, reactDomPlugin, reactHookExtraPlugin, reactNamingConventionPlugin, reactWebApiPlugin,] = await Promise.all([
503
+ importReactPlugin(),
504
+ importReactDebugPlugin(),
505
+ importReactDomPlugin(),
506
+ importReactHookExtraPlugin(),
507
+ importReactNamingConventionPlugin(),
508
+ importReactWebApiPlugin(),
509
+ ]);
510
+ const scriptFiles = relative.isEnableTypeScript
511
+ ? ALL_SCRIPTS_FILES
512
+ : [JS_FILES];
513
+ const ruleFiles = resolvedConfig.files ?? scriptFiles;
514
+ const setupFiles = relative.isEnableTypeScript && resolvedConfig.files
515
+ ? [...resolvedConfig.files, TS_FILES]
516
+ : relative.isEnableTypeScript
517
+ ? scriptFiles
518
+ : ruleFiles;
519
+ const typeScriptRules = relative.isEnableTypeScript
520
+ ? [
521
+ {
522
+ files: [TS_FILES],
523
+ name: 'waltz/react/typescript-rules',
524
+ rules: {
525
+ '@eslint-react/dom/no-unknown-property': 'off',
526
+ ...resolvedConfig.overrides,
527
+ },
528
+ },
529
+ ]
530
+ : [];
531
+ return [
532
+ {
533
+ files: setupFiles,
534
+ name: 'waltz/react/setup',
535
+ plugins: {
536
+ '@eslint-react': reactPlugin,
537
+ '@eslint-react/debug': reactDebugPlugin,
538
+ '@eslint-react/dom': reactDomPlugin,
539
+ '@eslint-react/hooks-extra': reactHookExtraPlugin,
540
+ '@eslint-react/naming-convention': reactNamingConventionPlugin,
541
+ '@eslint-react/web-api': reactWebApiPlugin,
542
+ },
543
+ },
544
+ {
545
+ files: ruleFiles,
546
+ name: 'waltz/react/rules',
547
+ rules: {
548
+ '@eslint-react/dom/no-dangerously-set-innerhtml': 'warn',
549
+ '@eslint-react/dom/no-dangerously-set-innerhtml-with-children': 'error',
550
+ '@eslint-react/dom/no-find-dom-node': 'error',
551
+ '@eslint-react/dom/no-flush-sync': 'error',
552
+ '@eslint-react/dom/no-hydrate': 'error',
553
+ '@eslint-react/dom/no-missing-button-type': 'warn',
554
+ '@eslint-react/dom/no-missing-iframe-sandbox': 'warn',
555
+ '@eslint-react/dom/no-render': 'error',
556
+ '@eslint-react/dom/no-render-return-value': 'error',
557
+ '@eslint-react/dom/no-script-url': 'warn',
558
+ '@eslint-react/dom/no-unknown-property': 'warn',
559
+ '@eslint-react/dom/no-unsafe-iframe-sandbox': 'warn',
560
+ '@eslint-react/dom/no-unsafe-target-blank': 'warn',
561
+ '@eslint-react/dom/no-use-form-state': 'error',
562
+ '@eslint-react/dom/no-void-elements-with-children': 'error',
563
+ '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'warn',
564
+ '@eslint-react/naming-convention/context-name': 'warn',
565
+ '@eslint-react/no-access-state-in-setstate': 'error',
566
+ '@eslint-react/no-array-index-key': 'warn',
567
+ '@eslint-react/no-children-count': 'warn',
568
+ '@eslint-react/no-children-for-each': 'warn',
569
+ '@eslint-react/no-children-map': 'warn',
570
+ '@eslint-react/no-children-only': 'warn',
571
+ '@eslint-react/no-children-to-array': 'warn',
572
+ '@eslint-react/no-clone-element': 'warn',
573
+ '@eslint-react/no-component-will-mount': 'error',
574
+ '@eslint-react/no-component-will-receive-props': 'error',
575
+ '@eslint-react/no-component-will-update': 'error',
576
+ '@eslint-react/no-context-provider': 'warn',
577
+ '@eslint-react/no-create-ref': 'error',
578
+ '@eslint-react/no-direct-mutation-state': 'error',
579
+ '@eslint-react/no-duplicate-key': 'warn',
580
+ '@eslint-react/no-forward-ref': 'warn',
581
+ '@eslint-react/no-missing-key': 'error',
582
+ '@eslint-react/no-misused-capture-owner-stack': 'error',
583
+ '@eslint-react/no-nested-component-definitions': 'error',
584
+ '@eslint-react/no-nested-lazy-component-declarations': 'warn',
585
+ '@eslint-react/no-set-state-in-component-did-mount': 'warn',
586
+ '@eslint-react/no-set-state-in-component-did-update': 'warn',
587
+ '@eslint-react/no-set-state-in-component-will-update': 'warn',
588
+ '@eslint-react/no-unsafe-component-will-mount': 'warn',
589
+ '@eslint-react/no-unsafe-component-will-receive-props': 'warn',
590
+ '@eslint-react/no-unsafe-component-will-update': 'warn',
591
+ '@eslint-react/no-unstable-context-value': 'warn',
592
+ '@eslint-react/no-unstable-default-props': 'warn',
593
+ '@eslint-react/no-unused-class-component-members': 'warn',
594
+ '@eslint-react/no-unused-state': 'warn',
595
+ '@eslint-react/no-use-context': 'warn',
596
+ '@eslint-react/web-api/no-leaked-event-listener': 'warn',
597
+ '@eslint-react/web-api/no-leaked-interval': 'warn',
598
+ '@eslint-react/web-api/no-leaked-resize-observer': 'warn',
599
+ '@eslint-react/web-api/no-leaked-timeout': 'warn',
600
+ ...resolvedConfig.overrides,
601
+ },
602
+ settings: {
603
+ 'react-x': {
604
+ additionalComponents: [],
605
+ additionalHooks: {
606
+ useEffect: ['useIsomorphicLayoutEffect'],
607
+ useLayoutEffect: ['useIsomorphicLayoutEffect'],
608
+ },
609
+ importSource: 'react',
610
+ polymorphicPropName: 'as',
611
+ skipImportCheck: true,
612
+ strict: true,
613
+ version: 'detect',
614
+ },
615
+ },
616
+ },
617
+ ...typeScriptRules,
618
+ ];
619
+ }
620
+
488
621
  async function stylisticConfig(options = {}, relative) {
489
622
  const eslintStylistic = await importStylisticPlugin();
490
623
  const scriptFiles = relative.isEnableTypeScript
491
624
  ? ALL_SCRIPTS_FILES
492
625
  : [JS_FILES];
626
+ const ruleFiles = options.files ?? scriptFiles;
493
627
  // Directly use the generated recommendation rules
494
628
  const configs = eslintStylistic.configs.customize();
495
629
  // This will enable the following rules.
@@ -560,15 +694,15 @@ async function stylisticConfig(options = {}, relative) {
560
694
  // '@stylistic/jsx-wrap-multilines'
561
695
  return [
562
696
  {
697
+ files: ruleFiles,
563
698
  name: 'waltz/stylistic/setup',
564
- files: scriptFiles,
565
699
  plugins: {
566
700
  '@stylistic': eslintStylistic,
567
701
  },
568
702
  },
569
703
  {
704
+ files: ruleFiles,
570
705
  name: 'waltz/stylistic/rules',
571
- files: options.files ?? scriptFiles,
572
706
  rules: {
573
707
  ...configs.rules,
574
708
  ...options.overrides,
@@ -586,24 +720,24 @@ async function tailwindcssConfig(options = {}, relative) {
586
720
  const files = options.files ?? scriptFiles;
587
721
  return [
588
722
  {
589
- name: 'waltz/tailwindcss/setup',
590
723
  files,
724
+ languageOptions: recommended.languageOptions,
725
+ name: 'waltz/tailwindcss/setup',
591
726
  plugins: {
592
727
  tailwindcss,
593
728
  },
594
- languageOptions: recommended.languageOptions,
595
729
  },
596
730
  {
597
- name: 'waltz/tailwindcss/rules',
598
731
  files,
599
- settings: {
600
- ...recommended.settings,
601
- ...options.settings,
602
- },
732
+ name: 'waltz/tailwindcss/rules',
603
733
  rules: {
604
734
  ...recommended.rules,
605
735
  ...options.overrides,
606
736
  },
737
+ settings: {
738
+ ...recommended.settings,
739
+ ...options.settings,
740
+ },
607
741
  },
608
742
  ];
609
743
  }
@@ -615,147 +749,43 @@ async function tsConfig(options = {}) {
615
749
  importTypeScriptRecommendedRules(),
616
750
  ]);
617
751
  const resolvedConfig = typeof options === 'boolean' ? {} : options;
752
+ const ruleFiles = resolvedConfig.files ?? [TS_FILES];
618
753
  return [
619
754
  {
620
- name: 'waltz/ts/setup',
621
- files: [TS_FILES],
622
- plugins: {
623
- '@typescript-eslint': typeScriptPlugin,
624
- },
755
+ files: ruleFiles,
625
756
  languageOptions: {
626
757
  parser: typeScriptParser,
627
758
  },
628
- },
629
- {
630
- name: 'waltz/ts/rules',
631
- files: resolvedConfig.files ?? [TS_FILES],
632
- rules: {
633
- ...recommendedRules,
634
- ...resolvedConfig.overrides,
635
- },
636
- },
637
- ];
638
- }
639
-
640
- async function reactConfig(options = {}, relative) {
641
- const resolvedConfig = typeof options === 'boolean' ? {} : options;
642
- const [reactPlugin, reactDebugPlugin, reactDomPlugin, reactHookExtraPlugin, reactNamingConventionPlugin, reactWebApiPlugin,] = await Promise.all([
643
- importReactPlugin(),
644
- importReactDebugPlugin(),
645
- importReactDomPlugin(),
646
- importReactHookExtraPlugin(),
647
- importReactNamingConventionPlugin(),
648
- importReactWebApiPlugin(),
649
- ]);
650
- const scriptFiles = relative.isEnableTypeScript
651
- ? ALL_SCRIPTS_FILES
652
- : [JS_FILES];
653
- const ruleFiles = resolvedConfig.files ?? scriptFiles;
654
- const typeScriptRules = relative.isEnableTypeScript
655
- ? [
656
- {
657
- name: 'waltz/react/typescript-rules',
658
- files: resolvedConfig.files ?? [TS_FILES],
659
- rules: {
660
- '@eslint-react/dom/no-unknown-property': 'off',
661
- ...resolvedConfig.overrides,
662
- },
663
- },
664
- ]
665
- : [];
666
- return [
667
- {
668
- name: 'waltz/react/setup',
669
- files: scriptFiles,
759
+ name: 'waltz/ts/setup',
670
760
  plugins: {
671
- '@eslint-react': reactPlugin,
672
- '@eslint-react/dom': reactDomPlugin,
673
- '@eslint-react/web-api': reactWebApiPlugin,
674
- '@eslint-react/debug': reactDebugPlugin,
675
- '@eslint-react/hooks-extra': reactHookExtraPlugin,
676
- '@eslint-react/naming-convention': reactNamingConventionPlugin,
761
+ '@typescript-eslint': typeScriptPlugin,
677
762
  },
678
763
  },
679
764
  {
680
- name: 'waltz/react/rules',
681
765
  files: ruleFiles,
766
+ name: 'waltz/ts/rules',
682
767
  rules: {
683
- '@eslint-react/no-access-state-in-setstate': 'error',
684
- '@eslint-react/no-array-index-key': 'warn',
685
- '@eslint-react/no-children-count': 'warn',
686
- '@eslint-react/no-children-for-each': 'warn',
687
- '@eslint-react/no-children-map': 'warn',
688
- '@eslint-react/no-children-only': 'warn',
689
- '@eslint-react/no-children-to-array': 'warn',
690
- '@eslint-react/no-clone-element': 'warn',
691
- '@eslint-react/no-component-will-mount': 'error',
692
- '@eslint-react/no-component-will-receive-props': 'error',
693
- '@eslint-react/no-component-will-update': 'error',
694
- '@eslint-react/no-context-provider': 'warn',
695
- '@eslint-react/no-create-ref': 'error',
696
- '@eslint-react/no-direct-mutation-state': 'error',
697
- '@eslint-react/no-duplicate-key': 'warn',
698
- '@eslint-react/no-forward-ref': 'warn',
699
- '@eslint-react/no-missing-key': 'error',
700
- '@eslint-react/no-misused-capture-owner-stack': 'error',
701
- '@eslint-react/no-nested-component-definitions': 'error',
702
- '@eslint-react/no-nested-lazy-component-declarations': 'warn',
703
- '@eslint-react/no-set-state-in-component-did-mount': 'warn',
704
- '@eslint-react/no-set-state-in-component-did-update': 'warn',
705
- '@eslint-react/no-set-state-in-component-will-update': 'warn',
706
- '@eslint-react/no-unsafe-component-will-mount': 'warn',
707
- '@eslint-react/no-unsafe-component-will-receive-props': 'warn',
708
- '@eslint-react/no-unsafe-component-will-update': 'warn',
709
- '@eslint-react/no-unstable-context-value': 'warn',
710
- '@eslint-react/no-unstable-default-props': 'warn',
711
- '@eslint-react/no-unused-class-component-members': 'warn',
712
- '@eslint-react/no-unused-state': 'warn',
713
- '@eslint-react/no-use-context': 'warn',
714
- '@eslint-react/dom/no-dangerously-set-innerhtml': 'warn',
715
- '@eslint-react/dom/no-dangerously-set-innerhtml-with-children': 'error',
716
- '@eslint-react/dom/no-find-dom-node': 'error',
717
- '@eslint-react/dom/no-flush-sync': 'error',
718
- '@eslint-react/dom/no-hydrate': 'error',
719
- '@eslint-react/dom/no-missing-button-type': 'warn',
720
- '@eslint-react/dom/no-missing-iframe-sandbox': 'warn',
721
- '@eslint-react/dom/no-render': 'error',
722
- '@eslint-react/dom/no-render-return-value': 'error',
723
- '@eslint-react/dom/no-script-url': 'warn',
724
- '@eslint-react/dom/no-unsafe-iframe-sandbox': 'warn',
725
- '@eslint-react/dom/no-unsafe-target-blank': 'warn',
726
- '@eslint-react/dom/no-use-form-state': 'error',
727
- '@eslint-react/dom/no-void-elements-with-children': 'error',
728
- '@eslint-react/web-api/no-leaked-event-listener': 'warn',
729
- '@eslint-react/web-api/no-leaked-interval': 'warn',
730
- '@eslint-react/web-api/no-leaked-resize-observer': 'warn',
731
- '@eslint-react/web-api/no-leaked-timeout': 'warn',
732
- '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'warn',
733
- '@eslint-react/naming-convention/context-name': 'warn',
734
- '@eslint-react/dom/no-unknown-property': 'warn',
768
+ ...recommendedRules,
735
769
  ...resolvedConfig.overrides,
736
770
  },
737
- settings: {
738
- 'react-x': {
739
- version: 'detect',
740
- importSource: 'react',
741
- strict: true,
742
- skipImportCheck: true,
743
- polymorphicPropName: 'as',
744
- additionalComponents: [],
745
- additionalHooks: {
746
- useEffect: ['useIsomorphicLayoutEffect'],
747
- useLayoutEffect: ['useIsomorphicLayoutEffect'],
748
- },
749
- },
750
- },
751
771
  },
752
- ...typeScriptRules,
753
772
  ];
754
773
  }
755
774
 
756
775
  async function waltz(options = {}, ...orders) {
757
776
  const isEnableTypeScript = !!options.ts;
758
777
  const isEnableReact = !!options.react;
778
+ const isEnablePerfectionist = options.perfectionist !== false;
779
+ const scriptFiles = isEnableTypeScript ? ALL_SCRIPTS_FILES : [JS_FILES];
780
+ const configuredPerfectionistFiles = typeof options.perfectionist === 'object'
781
+ ? options.perfectionist.files
782
+ : undefined;
783
+ const hasSimplePerfectionistFiles = configuredPerfectionistFiles?.every(file => typeof file === 'string');
784
+ const perfectionistFiles = isEnablePerfectionist
785
+ ? hasSimplePerfectionistFiles
786
+ ? configuredPerfectionistFiles
787
+ : scriptFiles
788
+ : undefined;
759
789
  const configs = [];
760
790
  if (options.gitignore) {
761
791
  configs.push(gitignore(options.gitignore));
@@ -775,7 +805,9 @@ async function waltz(options = {}, ...orders) {
775
805
  if (options.imports !== false) {
776
806
  configs.push(importsConfig(isEnableTypeScript, options.imports === true || options.imports === undefined
777
807
  ? {}
778
- : options.imports));
808
+ : options.imports, {
809
+ perfectionistFiles,
810
+ }));
779
811
  }
780
812
  if (isEnableReact) {
781
813
  configs.push(reactConfig(options.react, {
package/package.json CHANGED
@@ -1,148 +1,148 @@
1
- {
2
- "name": "@chanyuxi/eslint-waltz",
3
- "type": "module",
4
- "version": "1.0.0",
5
- "packageManager": "pnpm@10.4.1",
6
- "description": "A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and Perfectionist.",
7
- "author": "chanyuxi <2438149743@qq.com> (https://github.com/chanyuxi)",
8
- "license": "ISC",
9
- "homepage": "https://github.com/chanyuxi/eslint-waltz",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/chanyuxi/eslint-waltz.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/chanyuxi/eslint-waltz/issues"
16
- },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
- "keywords": [
21
- "chanyuxi",
22
- "eslint",
23
- "config",
24
- "integration"
25
- ],
26
- "exports": {
27
- ".": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js",
30
- "default": "./dist/index.js"
31
- }
32
- },
33
- "bin": {
34
- "eslint-waltz": "./dist/cli.js"
35
- },
36
- "files": [
37
- "dist"
38
- ],
39
- "engines": {
40
- "node": ">=20.19.0"
41
- },
42
- "scripts": {
43
- "build": "rimraf ./dist && pnpm gen && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
44
- "gen": "tsx scripts/typegen.ts",
45
- "lint": "eslint .",
46
- "lint:fix": "eslint . --fix",
47
- "typeCheck": "pnpm gen && tsc --noEmit",
48
- "test": "node --import tsx test/index.ts",
49
- "check": "pnpm run typeCheck && pnpm run lint && pnpm run test",
50
- "changeset": "changeset",
1
+ {
2
+ "name": "@chanyuxi/eslint-waltz",
3
+ "type": "module",
4
+ "version": "1.1.1",
5
+ "packageManager": "pnpm@10.4.1",
6
+ "description": "A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and Perfectionist.",
7
+ "author": "chanyuxi <2438149743@qq.com> (https://github.com/chanyuxi)",
8
+ "license": "ISC",
9
+ "homepage": "https://github.com/chanyuxi/eslint-waltz",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/chanyuxi/eslint-waltz.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/chanyuxi/eslint-waltz/issues"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "keywords": [
21
+ "chanyuxi",
22
+ "eslint",
23
+ "config",
24
+ "integration"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js",
30
+ "default": "./dist/index.js"
31
+ }
32
+ },
33
+ "bin": {
34
+ "eslint-waltz": "./dist/cli.js"
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "engines": {
40
+ "node": ">=20.19.0"
41
+ },
42
+ "scripts": {
43
+ "build": "rimraf ./dist && pnpm gen && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
44
+ "gen": "tsx scripts/typegen.ts",
45
+ "lint": "eslint .",
46
+ "lint:fix": "eslint . --fix",
47
+ "typeCheck": "pnpm gen && tsc --noEmit",
48
+ "test": "node --import tsx test/index.ts",
49
+ "check": "pnpm run typeCheck && pnpm run lint && pnpm run test",
50
+ "changeset": "changeset",
51
51
  "version": "changeset version && pnpm install --lockfile-only",
52
- "release": "pnpm build && changeset publish",
53
- "prepack": "pnpm build",
54
- "prepare": "husky"
55
- },
56
- "peerDependencies": {
57
- "@eslint/js": "^10.0.1",
58
- "@stylistic/eslint-plugin": "^5.10.0",
59
- "eslint": "^10.10.0",
60
- "eslint-config-flat-gitignore": "^2.4.0",
61
- "eslint-plugin-import-x": "^4.17.1",
62
- "eslint-plugin-jsonc": "^3.4.2",
63
- "eslint-plugin-perfectionist": "^5.11.0",
64
- "eslint-plugin-react-debug": "^5.19.0",
65
- "eslint-plugin-react-dom": "^5.19.0",
66
- "eslint-plugin-react-hooks-extra": "^2.13.0",
67
- "eslint-plugin-react-naming-convention": "^5.19.0",
68
- "eslint-plugin-react-web-api": "^5.19.0",
69
- "eslint-plugin-react-x": "^5.19.0",
70
- "eslint-plugin-tailwindcss": "^4.4.0",
71
- "globals": "^17.12.0",
72
- "jsonc-eslint-parser": "^3.3.0",
73
- "tailwindcss": "^4.0.0",
74
- "typescript-eslint": "^8.70.0"
75
- },
76
- "peerDependenciesMeta": {
77
- "eslint-config-flat-gitignore": {
78
- "optional": true
79
- },
80
- "eslint-plugin-react-debug": {
81
- "optional": true
82
- },
83
- "eslint-plugin-react-dom": {
84
- "optional": true
85
- },
86
- "eslint-plugin-react-hooks-extra": {
87
- "optional": true
88
- },
89
- "eslint-plugin-react-naming-convention": {
90
- "optional": true
91
- },
92
- "eslint-plugin-react-web-api": {
93
- "optional": true
94
- },
95
- "eslint-plugin-react-x": {
96
- "optional": true
97
- },
98
- "eslint-plugin-tailwindcss": {
99
- "optional": true
100
- },
101
- "tailwindcss": {
102
- "optional": true
103
- },
104
- "typescript-eslint": {
105
- "optional": true
106
- }
107
- },
108
- "dependencies": {
109
- "jsonc-parser": "^3.3.1"
110
- },
111
- "devDependencies": {
112
- "@changesets/cli": "^3.0.2",
113
- "@commitlint/cli": "^19.8.1",
114
- "@commitlint/config-conventional": "^19.8.1",
115
- "@commitlint/types": "^19.8.1",
116
- "@eslint/js": "^10.0.1",
117
- "@rollup/plugin-commonjs": "^28.0.6",
118
- "@rollup/plugin-node-resolve": "^16.0.1",
119
- "@rollup/plugin-typescript": "^12.1.4",
120
- "@stylistic/eslint-plugin": "^5.10.0",
121
- "@types/node": "^24.1.0",
122
- "eslint": "^10.10.0",
123
- "eslint-config-flat-gitignore": "^2.4.0",
124
- "eslint-plugin-import-x": "^4.17.1",
125
- "eslint-plugin-jsonc": "^3.4.2",
126
- "eslint-plugin-perfectionist": "^5.11.0",
127
- "eslint-plugin-react-debug": "^5.19.0",
128
- "eslint-plugin-react-dom": "^5.19.0",
129
- "eslint-plugin-react-hooks-extra": "^2.13.0",
130
- "eslint-plugin-react-naming-convention": "^5.19.0",
131
- "eslint-plugin-react-web-api": "^5.19.0",
132
- "eslint-plugin-react-x": "^5.19.0",
133
- "eslint-plugin-tailwindcss": "^4.4.0",
134
- "eslint-typegen": "^2.3.1",
135
- "globals": "^17.12.0",
136
- "husky": "^9.1.7",
137
- "jiti": "^2.7.0",
138
- "jsonc-eslint-parser": "^3.3.0",
139
- "rimraf": "^6.0.1",
140
- "rollup": "^4.46.2",
141
- "rollup-plugin-dts": "^6.2.1",
142
- "tailwindcss": "^4.3.3",
143
- "tslib": "^2.8.1",
144
- "tsx": "^4.20.3",
145
- "typescript": "^5.8.3",
146
- "typescript-eslint": "^8.70.0"
147
- }
148
- }
52
+ "release": "pnpm build && changeset publish",
53
+ "prepack": "pnpm build",
54
+ "prepare": "husky"
55
+ },
56
+ "peerDependencies": {
57
+ "@eslint/js": "^10.0.1",
58
+ "@stylistic/eslint-plugin": "^5.10.0",
59
+ "eslint": "^10.10.0",
60
+ "eslint-config-flat-gitignore": "^2.4.0",
61
+ "eslint-plugin-import-x": "^4.17.1",
62
+ "eslint-plugin-jsonc": "^3.4.2",
63
+ "eslint-plugin-perfectionist": "^5.11.0",
64
+ "eslint-plugin-react-debug": "^5.19.0",
65
+ "eslint-plugin-react-dom": "^5.19.0",
66
+ "eslint-plugin-react-hooks-extra": "^2.13.0",
67
+ "eslint-plugin-react-naming-convention": "^5.19.0",
68
+ "eslint-plugin-react-web-api": "^5.19.0",
69
+ "eslint-plugin-react-x": "^5.19.0",
70
+ "eslint-plugin-tailwindcss": "^4.4.0",
71
+ "globals": "^17.12.0",
72
+ "jsonc-eslint-parser": "^3.3.0",
73
+ "tailwindcss": "^4.0.0",
74
+ "typescript-eslint": "^8.70.0"
75
+ },
76
+ "peerDependenciesMeta": {
77
+ "eslint-config-flat-gitignore": {
78
+ "optional": true
79
+ },
80
+ "eslint-plugin-react-debug": {
81
+ "optional": true
82
+ },
83
+ "eslint-plugin-react-dom": {
84
+ "optional": true
85
+ },
86
+ "eslint-plugin-react-hooks-extra": {
87
+ "optional": true
88
+ },
89
+ "eslint-plugin-react-naming-convention": {
90
+ "optional": true
91
+ },
92
+ "eslint-plugin-react-web-api": {
93
+ "optional": true
94
+ },
95
+ "eslint-plugin-react-x": {
96
+ "optional": true
97
+ },
98
+ "eslint-plugin-tailwindcss": {
99
+ "optional": true
100
+ },
101
+ "tailwindcss": {
102
+ "optional": true
103
+ },
104
+ "typescript-eslint": {
105
+ "optional": true
106
+ }
107
+ },
108
+ "dependencies": {
109
+ "jsonc-parser": "^3.3.1"
110
+ },
111
+ "devDependencies": {
112
+ "@changesets/cli": "^3.0.2",
113
+ "@commitlint/cli": "^19.8.1",
114
+ "@commitlint/config-conventional": "^19.8.1",
115
+ "@commitlint/types": "^19.8.1",
116
+ "@eslint/js": "^10.0.1",
117
+ "@rollup/plugin-commonjs": "^28.0.6",
118
+ "@rollup/plugin-node-resolve": "^16.0.1",
119
+ "@rollup/plugin-typescript": "^12.1.4",
120
+ "@stylistic/eslint-plugin": "^5.10.0",
121
+ "@types/node": "^24.1.0",
122
+ "eslint": "^10.10.0",
123
+ "eslint-config-flat-gitignore": "^2.4.0",
124
+ "eslint-plugin-import-x": "^4.17.1",
125
+ "eslint-plugin-jsonc": "^3.4.2",
126
+ "eslint-plugin-perfectionist": "^5.11.0",
127
+ "eslint-plugin-react-debug": "^5.19.0",
128
+ "eslint-plugin-react-dom": "^5.19.0",
129
+ "eslint-plugin-react-hooks-extra": "^2.13.0",
130
+ "eslint-plugin-react-naming-convention": "^5.19.0",
131
+ "eslint-plugin-react-web-api": "^5.19.0",
132
+ "eslint-plugin-react-x": "^5.19.0",
133
+ "eslint-plugin-tailwindcss": "^4.4.0",
134
+ "eslint-typegen": "^2.3.1",
135
+ "globals": "^17.12.0",
136
+ "husky": "^9.1.7",
137
+ "jiti": "^2.7.0",
138
+ "jsonc-eslint-parser": "^3.3.0",
139
+ "rimraf": "^6.0.1",
140
+ "rollup": "^4.46.2",
141
+ "rollup-plugin-dts": "^6.2.1",
142
+ "tailwindcss": "^4.3.3",
143
+ "tslib": "^2.8.1",
144
+ "tsx": "^4.20.3",
145
+ "typescript": "^5.8.3",
146
+ "typescript-eslint": "^8.70.0"
147
+ }
148
+ }