@zhangyu1818/oxlint-config 2.1.0 → 2.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.
package/dist/index.d.ts CHANGED
@@ -1,177 +1,182 @@
1
+ //#region src/shared/ignore-patterns.d.ts
1
2
  declare const defaultIgnorePatterns: string[];
2
-
3
+ //#endregion
4
+ //#region src/types.d.ts
3
5
  type Severity = 'off' | 'warn' | 'error';
4
6
  type JsonPrimitive = boolean | null | number | string;
5
7
  type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
6
8
  interface JsonObject {
7
- [key: string]: JsonValue;
9
+ [key: string]: JsonValue;
8
10
  }
9
11
  type RuleConfig = Severity | [Severity, ...JsonValue[]];
10
12
  type Rules = Record<string, RuleConfig>;
11
13
  type OxlintGlobalValue = 'off' | 'readable' | 'readonly' | 'writable' | 'writeable' | boolean;
12
14
  type OxlintGlobals = Record<string, OxlintGlobalValue>;
13
15
  interface OxlintJsPluginAlias {
14
- name: string;
15
- specifier: string;
16
+ name: string;
17
+ specifier: string;
16
18
  }
17
19
  type OxlintJsPlugin = OxlintJsPluginAlias | string;
18
20
  type OxlintPlugin = 'eslint' | 'import' | 'jest' | 'jsdoc' | 'jsx-a11y' | 'nextjs' | 'node' | 'oxc' | 'promise' | 'react' | 'react-perf' | 'typescript' | 'unicorn' | 'vitest' | 'vue';
19
21
  interface OxlintOverride {
20
- env?: Record<string, boolean>;
21
- excludeFiles?: string[];
22
- files: string[];
23
- globals?: OxlintGlobals;
24
- jsPlugins?: OxlintJsPlugin[];
25
- plugins?: OxlintPlugin[];
26
- rules?: Rules;
22
+ env?: Record<string, boolean>;
23
+ excludeFiles?: string[];
24
+ files: string[];
25
+ globals?: OxlintGlobals;
26
+ jsPlugins?: OxlintJsPlugin[];
27
+ plugins?: OxlintPlugin[];
28
+ rules?: Rules;
27
29
  }
28
30
  interface OxlintConfig {
29
- $schema?: string;
30
- categories?: Record<string, Severity>;
31
- env?: Record<string, boolean>;
32
- extends?: string[];
33
- globals?: OxlintGlobals;
34
- ignorePatterns?: string[];
35
- jsPlugins?: OxlintJsPlugin[];
36
- options?: {
37
- typeAware?: boolean;
38
- typeCheck?: boolean;
39
- };
40
- overrides?: OxlintOverride[];
41
- plugins?: OxlintPlugin[];
42
- rules?: Rules;
43
- settings?: Record<string, JsonValue>;
31
+ $schema?: string;
32
+ categories?: Record<string, Severity>;
33
+ env?: Record<string, boolean>;
34
+ extends?: string[];
35
+ globals?: OxlintGlobals;
36
+ ignorePatterns?: string[];
37
+ jsPlugins?: OxlintJsPlugin[];
38
+ options?: {
39
+ typeAware?: boolean;
40
+ typeCheck?: boolean;
41
+ };
42
+ overrides?: OxlintOverride[];
43
+ plugins?: OxlintPlugin[];
44
+ rules?: Rules;
45
+ settings?: Record<string, JsonValue>;
44
46
  }
45
47
  interface OxlintPresetConfig<TOptions = undefined> {
46
- enabled?: boolean;
47
- options?: TOptions;
48
- rules?: Rules;
48
+ enabled?: boolean;
49
+ options?: TOptions;
50
+ rules?: Rules;
49
51
  }
50
52
  interface IgnorePresetConfig {
51
- enabled?: boolean;
52
- patterns?: string[];
53
+ enabled?: boolean;
54
+ patterns?: string[];
53
55
  }
54
56
  interface ReactOptions {
55
- next?: boolean;
56
- vite?: boolean;
57
+ next?: boolean;
58
+ vite?: boolean;
57
59
  }
58
60
  interface ReactPresetOptions {
59
- a11y?: boolean;
60
- framework?: ReactOptions;
61
+ a11y?: boolean;
62
+ framework?: ReactOptions;
61
63
  }
62
64
  interface TypeScriptOptions {
63
- typeAware?: boolean;
65
+ typeAware?: boolean;
64
66
  }
65
67
  interface OxlintPresets {
66
- ignores?: boolean | IgnorePresetConfig;
67
- imports?: boolean | OxlintPresetConfig;
68
- javascript?: boolean | OxlintPresetConfig;
69
- next?: boolean | OxlintPresetConfig;
70
- node?: boolean | OxlintPresetConfig;
71
- react?: boolean | OxlintPresetConfig<ReactPresetOptions>;
72
- reactAgentRules?: boolean | OxlintPresetConfig;
73
- test?: boolean | OxlintPresetConfig;
74
- typescript?: boolean | OxlintPresetConfig<TypeScriptOptions>;
75
- unicorn?: boolean | OxlintPresetConfig;
68
+ ignores?: boolean | IgnorePresetConfig;
69
+ imports?: boolean | OxlintPresetConfig;
70
+ javascript?: boolean | OxlintPresetConfig;
71
+ next?: boolean | OxlintPresetConfig;
72
+ node?: boolean | OxlintPresetConfig;
73
+ react?: boolean | OxlintPresetConfig<ReactPresetOptions>;
74
+ reactAgentRules?: boolean | OxlintPresetConfig;
75
+ test?: boolean | OxlintPresetConfig;
76
+ typescript?: boolean | OxlintPresetConfig<TypeScriptOptions>;
77
+ unicorn?: boolean | OxlintPresetConfig;
76
78
  }
77
79
  interface DefineOxlintConfigOptions {
78
- categories?: Record<string, Severity>;
79
- env?: Record<string, boolean>;
80
- extends?: string[];
81
- globals?: OxlintGlobals;
82
- ignorePatterns?: string[];
83
- jsPlugins?: OxlintJsPlugin[];
84
- overrides?: OxlintOverride[];
85
- presets?: OxlintPresets;
86
- rules?: Rules;
87
- settings?: Record<string, JsonValue>;
80
+ categories?: Record<string, Severity>;
81
+ env?: Record<string, boolean>;
82
+ extends?: string[];
83
+ globals?: OxlintGlobals;
84
+ ignorePatterns?: string[];
85
+ jsPlugins?: OxlintJsPlugin[];
86
+ overrides?: OxlintOverride[];
87
+ presets?: OxlintPresets;
88
+ rules?: Rules;
89
+ settings?: Record<string, JsonValue>;
88
90
  }
89
91
  interface SortImportCustomGroup {
90
- elementNamePattern?: string[];
91
- groupName: string;
92
- modifiers?: string[];
93
- selector?: string;
92
+ elementNamePattern?: string[];
93
+ groupName: string;
94
+ modifiers?: string[];
95
+ selector?: string;
94
96
  }
95
97
  type SortImportGroup = {
96
- newlinesBetween: boolean;
98
+ newlinesBetween: boolean;
97
99
  } | string | string[];
98
100
  interface SortImportsOptions {
99
- customGroups?: SortImportCustomGroup[];
100
- groups?: SortImportGroup[];
101
- ignoreCase?: boolean;
102
- internalPattern?: string[];
103
- newlinesBetween?: boolean;
104
- order?: 'asc' | 'desc';
105
- partitionByComment?: boolean;
106
- partitionByNewline?: boolean;
107
- sortSideEffects?: boolean;
101
+ customGroups?: SortImportCustomGroup[];
102
+ groups?: SortImportGroup[];
103
+ ignoreCase?: boolean;
104
+ internalPattern?: string[];
105
+ newlinesBetween?: boolean;
106
+ order?: 'asc' | 'desc';
107
+ partitionByComment?: boolean;
108
+ partitionByNewline?: boolean;
109
+ sortSideEffects?: boolean;
108
110
  }
109
111
  interface SortPackageJsonOptions {
110
- sortScripts?: boolean;
112
+ sortScripts?: boolean;
111
113
  }
112
114
  interface TailwindSortOptions {
113
- attributes?: string[];
114
- config?: string;
115
- functions?: string[];
116
- preserveDuplicates?: boolean;
117
- preserveWhitespace?: boolean;
118
- stylesheet?: string;
115
+ attributes?: string[];
116
+ config?: string;
117
+ functions?: string[];
118
+ preserveDuplicates?: boolean;
119
+ preserveWhitespace?: boolean;
120
+ stylesheet?: string;
119
121
  }
120
122
  interface OxfmtOverrideOptions {
121
- endOfLine?: 'cr' | 'crlf' | 'lf';
122
- printWidth?: number;
123
- semi?: boolean;
124
- singleQuote?: boolean;
125
- sortImports?: boolean | SortImportsOptions;
126
- sortPackageJson?: boolean | SortPackageJsonOptions;
127
- sortTailwindcss?: boolean | TailwindSortOptions;
128
- tabWidth?: number;
129
- trailingComma?: 'all' | 'es5' | 'none';
130
- useTabs?: boolean;
123
+ endOfLine?: 'cr' | 'crlf' | 'lf';
124
+ printWidth?: number;
125
+ semi?: boolean;
126
+ singleQuote?: boolean;
127
+ sortImports?: boolean | SortImportsOptions;
128
+ sortPackageJson?: boolean | SortPackageJsonOptions;
129
+ sortTailwindcss?: boolean | TailwindSortOptions;
130
+ tabWidth?: number;
131
+ trailingComma?: 'all' | 'es5' | 'none';
132
+ useTabs?: boolean;
131
133
  }
132
134
  interface OxfmtOverride {
133
- excludeFiles?: string[];
134
- files: string[];
135
- options: OxfmtOverrideOptions;
135
+ excludeFiles?: string[];
136
+ files: string[];
137
+ options: OxfmtOverrideOptions;
136
138
  }
137
139
  interface OxfmtConfig extends OxfmtOverrideOptions {
138
- $schema?: string;
139
- ignorePatterns?: string[];
140
- overrides?: OxfmtOverride[];
140
+ $schema?: string;
141
+ ignorePatterns?: string[];
142
+ overrides?: OxfmtOverride[];
141
143
  }
142
144
  interface OxfmtPresetConfig<TOptions = undefined> {
143
- enabled?: boolean;
144
- options?: TOptions;
145
+ enabled?: boolean;
146
+ options?: TOptions;
145
147
  }
146
148
  interface OxfmtPresets {
147
- imports?: boolean | OxfmtPresetConfig<SortImportsOptions>;
148
- packageJson?: boolean | OxfmtPresetConfig<SortPackageJsonOptions>;
149
- tailwindcss?: boolean | OxfmtPresetConfig<TailwindSortOptions>;
149
+ imports?: boolean | OxfmtPresetConfig<SortImportsOptions>;
150
+ packageJson?: boolean | OxfmtPresetConfig<SortPackageJsonOptions>;
151
+ tailwindcss?: boolean | OxfmtPresetConfig<TailwindSortOptions>;
150
152
  }
151
153
  interface DefineOxfmtConfigOptions extends OxfmtOverrideOptions {
152
- ignorePatterns?: string[];
153
- overrides?: OxfmtOverride[];
154
- presets?: OxfmtPresets;
154
+ ignorePatterns?: string[];
155
+ overrides?: OxfmtOverride[];
156
+ presets?: OxfmtPresets;
155
157
  }
156
-
158
+ //#endregion
159
+ //#region src/oxlint/index.d.ts
157
160
  declare const defaultOxlintPresets: {
158
- ignores: true;
159
- imports: true;
160
- javascript: true;
161
- next: boolean;
162
- node: false;
163
- react: boolean;
164
- reactAgentRules: boolean;
165
- test: boolean;
166
- typescript: boolean;
167
- unicorn: true;
161
+ ignores: true;
162
+ imports: true;
163
+ javascript: true;
164
+ next: boolean;
165
+ node: false;
166
+ react: boolean;
167
+ reactAgentRules: boolean;
168
+ test: boolean;
169
+ typescript: boolean;
170
+ unicorn: true;
168
171
  };
169
172
  declare function defineOxlintConfig(options?: DefineOxlintConfigOptions): OxlintConfig;
170
173
  declare const defineConfig: typeof defineOxlintConfig;
171
-
174
+ //#endregion
175
+ //#region src/oxfmt/presets/imports.d.ts
172
176
  declare const defaultSortImports: SortImportsOptions;
173
-
177
+ //#endregion
178
+ //#region src/oxfmt/index.d.ts
174
179
  declare const defaultOxfmtPresets: Required<OxfmtPresets>;
175
180
  declare function defineOxfmtConfig(options?: DefineOxfmtConfigOptions): OxfmtConfig;
176
-
177
- export { type DefineOxfmtConfigOptions, type DefineOxlintConfigOptions, type OxfmtConfig, type OxfmtOverride, type OxfmtPresetConfig, type OxfmtPresets, type OxlintConfig, type OxlintGlobalValue, type OxlintGlobals, type OxlintJsPlugin, type OxlintJsPluginAlias, type OxlintOverride, type OxlintPlugin, type OxlintPresetConfig, type OxlintPresets, type ReactOptions, type ReactPresetOptions, type RuleConfig, type Rules, type Severity, type SortImportsOptions, type SortPackageJsonOptions, type TailwindSortOptions, type TypeScriptOptions, defaultIgnorePatterns, defaultOxfmtPresets, defaultOxlintPresets, defaultSortImports, defineConfig, defineOxfmtConfig, defineOxlintConfig };
181
+ //#endregion
182
+ export { type DefineOxfmtConfigOptions, type DefineOxlintConfigOptions, type OxfmtConfig, type OxfmtOverride, type OxfmtPresetConfig, type OxfmtPresets, type OxlintConfig, type OxlintGlobalValue, type OxlintGlobals, type OxlintJsPlugin, type OxlintJsPluginAlias, type OxlintOverride, type OxlintPlugin, type OxlintPresetConfig, type OxlintPresets, type ReactOptions, type ReactPresetOptions, type RuleConfig, type Rules, type Severity, type SortImportsOptions, type SortPackageJsonOptions, type TailwindSortOptions, type TypeScriptOptions, defaultIgnorePatterns, defaultOxfmtPresets, defaultOxlintPresets, defaultSortImports, defineConfig, defineOxfmtConfig, defineOxlintConfig };