@coderwyd/eslint-config 1.1.0-beta.1 → 1.1.0-beta.2

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.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
+ import { ParserOptions } from '@typescript-eslint/parser';
4
+ export { default as parserTs } from '@typescript-eslint/parser';
3
5
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
4
6
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
5
7
  export { default as pluginImport } from 'eslint-plugin-i';
@@ -12,14 +14,13 @@ export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
12
14
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
13
15
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
14
16
  export { default as pluginVue } from 'eslint-plugin-vue';
15
- export { default as pluginYml } from 'eslint-plugin-yml';
17
+ export { default as pluginYaml } from 'eslint-plugin-yml';
16
18
  export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
17
19
  export { default as pluginReact } from 'eslint-plugin-react';
18
20
  export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
19
21
  export { default as pluginAstro } from 'eslint-plugin-astro';
20
- export { default as parserTs } from '@typescript-eslint/parser';
21
22
  export { default as parserVue } from 'vue-eslint-parser';
22
- export { default as parserYml } from 'yaml-eslint-parser';
23
+ export { default as parserYaml } from 'yaml-eslint-parser';
23
24
  export { default as parserJsonc } from 'jsonc-eslint-parser';
24
25
  export { default as parserAstro } from 'astro-eslint-parser';
25
26
 
@@ -32,17 +33,32 @@ interface OptionsComponentExts {
32
33
  */
33
34
  componentExts?: string[];
34
35
  }
35
- interface OptionsTypeScriptWithLanguageServer {
36
- tsconfigPath: string;
37
- tsconfigRootDir?: string;
36
+ interface OptionsTypeScriptParserOptions {
37
+ /**
38
+ * Additional parser options for TypeScript.
39
+ */
40
+ parserOptions?: Partial<ParserOptions>;
41
+ }
42
+ interface OptionsTypeScriptWithTypes {
43
+ /**
44
+ * When this options is provided, type aware rules will be enabled.
45
+ * @see https://typescript-eslint.io/linting/typed-linting/
46
+ */
47
+ tsconfigPath?: string;
38
48
  }
39
49
  interface OptionsHasTypeScript {
40
50
  typescript?: boolean;
41
51
  }
52
+ interface OptionsStylistic {
53
+ stylistic?: boolean;
54
+ }
55
+ interface OptionsOverrides {
56
+ overrides?: FlatESLintConfigItem['rules'];
57
+ }
42
58
  interface OptionsIsInEditor {
43
59
  isInEditor?: boolean;
44
60
  }
45
- interface OptionsConfig {
61
+ interface OptionsConfig extends OptionsComponentExts {
46
62
  /**
47
63
  * Enable gitignore support.
48
64
  *
@@ -59,7 +75,7 @@ interface OptionsConfig {
59
75
  *
60
76
  * @default auto-detect based on the dependencies
61
77
  */
62
- typescript?: boolean | OptionsTypeScriptWithLanguageServer;
78
+ typescript?: boolean | OptionsTypeScriptWithTypes;
63
79
  /**
64
80
  * Enable test support.
65
81
  *
@@ -113,6 +129,20 @@ interface OptionsConfig {
113
129
  * @default auto-detect based on the process.env
114
130
  */
115
131
  isInEditor?: boolean;
132
+ /**
133
+ * Provide overrides for rules for each integration.
134
+ */
135
+ overrides?: {
136
+ javascript?: FlatESLintConfigItem['rules'];
137
+ typescript?: FlatESLintConfigItem['rules'];
138
+ test?: FlatESLintConfigItem['rules'];
139
+ vue?: FlatESLintConfigItem['rules'];
140
+ react?: FlatESLintConfigItem['rules'];
141
+ astro?: FlatESLintConfigItem['rules'];
142
+ jsonc?: FlatESLintConfigItem['rules'];
143
+ markdown?: FlatESLintConfigItem['rules'];
144
+ yaml?: FlatESLintConfigItem['rules'];
145
+ };
116
146
  }
117
147
 
118
148
  /**
@@ -120,52 +150,51 @@ interface OptionsConfig {
120
150
  */
121
151
  declare function coderwyd(options?: OptionsConfig & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
122
152
 
123
- declare const comments: FlatESLintConfigItem[];
153
+ declare function comments(): FlatESLintConfigItem[];
124
154
 
125
- declare const ignores: FlatESLintConfigItem[];
155
+ declare function ignores(): FlatESLintConfigItem[];
126
156
 
127
- declare const imports: FlatESLintConfigItem[];
157
+ declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
128
158
 
129
- declare function javascript(options?: OptionsIsInEditor): FlatESLintConfigItem[];
159
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
130
160
 
131
- declare const jsdoc: FlatESLintConfigItem[];
161
+ declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
132
162
 
133
- declare const jsonc: FlatESLintConfigItem[];
163
+ declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
134
164
 
135
- declare function markdown(options?: OptionsComponentExts): FlatESLintConfigItem[];
165
+ declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
136
166
 
137
- declare const node: FlatESLintConfigItem[];
167
+ declare function node(): FlatESLintConfigItem[];
138
168
 
139
169
  /**
140
170
  * Sort package.json
141
171
  *
142
172
  * Requires `jsonc` config
143
173
  */
144
- declare const sortPackageJson: FlatESLintConfigItem[];
174
+ declare function sortPackageJson(): FlatESLintConfigItem[];
145
175
  /**
146
176
  * Sort tsconfig.json
147
177
  *
148
178
  * Requires `jsonc` config
149
179
  */
150
- declare const sortTsconfig: FlatESLintConfigItem[];
180
+ declare function sortTsconfig(): FlatESLintConfigItem[];
151
181
 
152
- declare const stylistic: FlatESLintConfigItem[];
182
+ declare function stylistic(): FlatESLintConfigItem[];
153
183
 
154
- declare function typescript(options?: OptionsComponentExts): FlatESLintConfigItem[];
155
- declare function typescriptWithLanguageServer(options: OptionsTypeScriptWithLanguageServer & OptionsComponentExts): FlatESLintConfigItem[];
184
+ declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
156
185
 
157
- declare const unicorn: FlatESLintConfigItem[];
186
+ declare function unicorn(): FlatESLintConfigItem[];
158
187
 
159
188
  declare function getVueVersion(): number;
160
- declare function vue(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
189
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
161
190
 
162
- declare const yml: FlatESLintConfigItem[];
191
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
163
192
 
164
- declare function test(options?: OptionsIsInEditor): FlatESLintConfigItem[];
193
+ declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
165
194
 
166
- declare function react(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
195
+ declare function react(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
167
196
 
168
- declare function astro(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
197
+ declare function astro(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
169
198
 
170
199
  /**
171
200
  * Combine array and non-array configs into a single array.
@@ -175,4 +204,27 @@ declare function renameRules(rules: Record<string, any>, from: string, to: strin
175
204
  [k: string]: any;
176
205
  };
177
206
 
178
- export { OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsTypeScriptWithLanguageServer, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, typescriptWithLanguageServer, unicorn, vue, yml };
207
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
208
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
209
+ declare const GLOB_JS = "**/*.?([cm])js";
210
+ declare const GLOB_JSX = "**/*.?([cm])jsx";
211
+ declare const GLOB_TS = "**/*.?([cm])ts";
212
+ declare const GLOB_TSX = "**/*.?([cm])tsx";
213
+ declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
214
+ declare const GLOB_CSS = "**/*.css";
215
+ declare const GLOB_LESS = "**/*.less";
216
+ declare const GLOB_SCSS = "**/*.scss";
217
+ declare const GLOB_JSON = "**/*.json";
218
+ declare const GLOB_JSON5 = "**/*.json5";
219
+ declare const GLOB_JSONC = "**/*.jsonc";
220
+ declare const GLOB_MARKDOWN = "**/*.md";
221
+ declare const GLOB_VUE = "**/*.vue";
222
+ declare const GLOB_YAML = "**/*.y?(a)ml";
223
+ declare const GLOB_HTML = "**/*.htm?(l)";
224
+ declare const GLOB_ASTRO = "**/*.astro";
225
+ declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
226
+ declare const GLOB_TESTS: string[];
227
+ declare const GLOB_ALL_SRC: string[];
228
+ declare const GLOB_EXCLUDE: string[];
229
+
230
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
+ import { ParserOptions } from '@typescript-eslint/parser';
4
+ export { default as parserTs } from '@typescript-eslint/parser';
3
5
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
4
6
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
5
7
  export { default as pluginImport } from 'eslint-plugin-i';
@@ -12,14 +14,13 @@ export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
12
14
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
13
15
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
14
16
  export { default as pluginVue } from 'eslint-plugin-vue';
15
- export { default as pluginYml } from 'eslint-plugin-yml';
17
+ export { default as pluginYaml } from 'eslint-plugin-yml';
16
18
  export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
17
19
  export { default as pluginReact } from 'eslint-plugin-react';
18
20
  export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
19
21
  export { default as pluginAstro } from 'eslint-plugin-astro';
20
- export { default as parserTs } from '@typescript-eslint/parser';
21
22
  export { default as parserVue } from 'vue-eslint-parser';
22
- export { default as parserYml } from 'yaml-eslint-parser';
23
+ export { default as parserYaml } from 'yaml-eslint-parser';
23
24
  export { default as parserJsonc } from 'jsonc-eslint-parser';
24
25
  export { default as parserAstro } from 'astro-eslint-parser';
25
26
 
@@ -32,17 +33,32 @@ interface OptionsComponentExts {
32
33
  */
33
34
  componentExts?: string[];
34
35
  }
35
- interface OptionsTypeScriptWithLanguageServer {
36
- tsconfigPath: string;
37
- tsconfigRootDir?: string;
36
+ interface OptionsTypeScriptParserOptions {
37
+ /**
38
+ * Additional parser options for TypeScript.
39
+ */
40
+ parserOptions?: Partial<ParserOptions>;
41
+ }
42
+ interface OptionsTypeScriptWithTypes {
43
+ /**
44
+ * When this options is provided, type aware rules will be enabled.
45
+ * @see https://typescript-eslint.io/linting/typed-linting/
46
+ */
47
+ tsconfigPath?: string;
38
48
  }
39
49
  interface OptionsHasTypeScript {
40
50
  typescript?: boolean;
41
51
  }
52
+ interface OptionsStylistic {
53
+ stylistic?: boolean;
54
+ }
55
+ interface OptionsOverrides {
56
+ overrides?: FlatESLintConfigItem['rules'];
57
+ }
42
58
  interface OptionsIsInEditor {
43
59
  isInEditor?: boolean;
44
60
  }
45
- interface OptionsConfig {
61
+ interface OptionsConfig extends OptionsComponentExts {
46
62
  /**
47
63
  * Enable gitignore support.
48
64
  *
@@ -59,7 +75,7 @@ interface OptionsConfig {
59
75
  *
60
76
  * @default auto-detect based on the dependencies
61
77
  */
62
- typescript?: boolean | OptionsTypeScriptWithLanguageServer;
78
+ typescript?: boolean | OptionsTypeScriptWithTypes;
63
79
  /**
64
80
  * Enable test support.
65
81
  *
@@ -113,6 +129,20 @@ interface OptionsConfig {
113
129
  * @default auto-detect based on the process.env
114
130
  */
115
131
  isInEditor?: boolean;
132
+ /**
133
+ * Provide overrides for rules for each integration.
134
+ */
135
+ overrides?: {
136
+ javascript?: FlatESLintConfigItem['rules'];
137
+ typescript?: FlatESLintConfigItem['rules'];
138
+ test?: FlatESLintConfigItem['rules'];
139
+ vue?: FlatESLintConfigItem['rules'];
140
+ react?: FlatESLintConfigItem['rules'];
141
+ astro?: FlatESLintConfigItem['rules'];
142
+ jsonc?: FlatESLintConfigItem['rules'];
143
+ markdown?: FlatESLintConfigItem['rules'];
144
+ yaml?: FlatESLintConfigItem['rules'];
145
+ };
116
146
  }
117
147
 
118
148
  /**
@@ -120,52 +150,51 @@ interface OptionsConfig {
120
150
  */
121
151
  declare function coderwyd(options?: OptionsConfig & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
122
152
 
123
- declare const comments: FlatESLintConfigItem[];
153
+ declare function comments(): FlatESLintConfigItem[];
124
154
 
125
- declare const ignores: FlatESLintConfigItem[];
155
+ declare function ignores(): FlatESLintConfigItem[];
126
156
 
127
- declare const imports: FlatESLintConfigItem[];
157
+ declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
128
158
 
129
- declare function javascript(options?: OptionsIsInEditor): FlatESLintConfigItem[];
159
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
130
160
 
131
- declare const jsdoc: FlatESLintConfigItem[];
161
+ declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
132
162
 
133
- declare const jsonc: FlatESLintConfigItem[];
163
+ declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
134
164
 
135
- declare function markdown(options?: OptionsComponentExts): FlatESLintConfigItem[];
165
+ declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
136
166
 
137
- declare const node: FlatESLintConfigItem[];
167
+ declare function node(): FlatESLintConfigItem[];
138
168
 
139
169
  /**
140
170
  * Sort package.json
141
171
  *
142
172
  * Requires `jsonc` config
143
173
  */
144
- declare const sortPackageJson: FlatESLintConfigItem[];
174
+ declare function sortPackageJson(): FlatESLintConfigItem[];
145
175
  /**
146
176
  * Sort tsconfig.json
147
177
  *
148
178
  * Requires `jsonc` config
149
179
  */
150
- declare const sortTsconfig: FlatESLintConfigItem[];
180
+ declare function sortTsconfig(): FlatESLintConfigItem[];
151
181
 
152
- declare const stylistic: FlatESLintConfigItem[];
182
+ declare function stylistic(): FlatESLintConfigItem[];
153
183
 
154
- declare function typescript(options?: OptionsComponentExts): FlatESLintConfigItem[];
155
- declare function typescriptWithLanguageServer(options: OptionsTypeScriptWithLanguageServer & OptionsComponentExts): FlatESLintConfigItem[];
184
+ declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
156
185
 
157
- declare const unicorn: FlatESLintConfigItem[];
186
+ declare function unicorn(): FlatESLintConfigItem[];
158
187
 
159
188
  declare function getVueVersion(): number;
160
- declare function vue(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
189
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
161
190
 
162
- declare const yml: FlatESLintConfigItem[];
191
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
163
192
 
164
- declare function test(options?: OptionsIsInEditor): FlatESLintConfigItem[];
193
+ declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
165
194
 
166
- declare function react(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
195
+ declare function react(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
167
196
 
168
- declare function astro(options?: OptionsHasTypeScript): FlatESLintConfigItem[];
197
+ declare function astro(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
169
198
 
170
199
  /**
171
200
  * Combine array and non-array configs into a single array.
@@ -175,4 +204,27 @@ declare function renameRules(rules: Record<string, any>, from: string, to: strin
175
204
  [k: string]: any;
176
205
  };
177
206
 
178
- export { OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsTypeScriptWithLanguageServer, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, typescriptWithLanguageServer, unicorn, vue, yml };
207
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
208
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
209
+ declare const GLOB_JS = "**/*.?([cm])js";
210
+ declare const GLOB_JSX = "**/*.?([cm])jsx";
211
+ declare const GLOB_TS = "**/*.?([cm])ts";
212
+ declare const GLOB_TSX = "**/*.?([cm])tsx";
213
+ declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
214
+ declare const GLOB_CSS = "**/*.css";
215
+ declare const GLOB_LESS = "**/*.less";
216
+ declare const GLOB_SCSS = "**/*.scss";
217
+ declare const GLOB_JSON = "**/*.json";
218
+ declare const GLOB_JSON5 = "**/*.json5";
219
+ declare const GLOB_JSONC = "**/*.jsonc";
220
+ declare const GLOB_MARKDOWN = "**/*.md";
221
+ declare const GLOB_VUE = "**/*.vue";
222
+ declare const GLOB_YAML = "**/*.y?(a)ml";
223
+ declare const GLOB_HTML = "**/*.htm?(l)";
224
+ declare const GLOB_ASTRO = "**/*.astro";
225
+ declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
226
+ declare const GLOB_TESTS: string[];
227
+ declare const GLOB_ALL_SRC: string[];
228
+ declare const GLOB_EXCLUDE: string[];
229
+
230
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };