@lincy/eslint-config 4.2.3 → 4.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(src_exports, {
48
48
  GLOB_SRC: () => GLOB_SRC,
49
49
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
50
50
  GLOB_STYLE: () => GLOB_STYLE,
51
+ GLOB_SVELTE: () => GLOB_SVELTE,
51
52
  GLOB_TESTS: () => GLOB_TESTS,
52
53
  GLOB_TOML: () => GLOB_TOML,
53
54
  GLOB_TS: () => GLOB_TS,
@@ -135,6 +136,7 @@ var GLOB_JSON5 = "**/*.json5";
135
136
  var GLOB_JSONC = "**/*.jsonc";
136
137
  var GLOB_MARKDOWN = "**/*.md";
137
138
  var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
139
+ var GLOB_SVELTE = "**/*.svelte";
138
140
  var GLOB_VUE = "**/*.vue";
139
141
  var GLOB_YAML = "**/*.y?(a)ml";
140
142
  var GLOB_TOML = "**/*.toml";
@@ -151,6 +153,7 @@ var GLOB_ALL_SRC = [
151
153
  GLOB_JSON,
152
154
  GLOB_JSON5,
153
155
  GLOB_MARKDOWN,
156
+ GLOB_SVELTE,
154
157
  GLOB_VUE,
155
158
  GLOB_YAML,
156
159
  GLOB_HTML
@@ -213,6 +216,7 @@ async function imports(options = {}) {
213
216
  },
214
217
  rules: {
215
218
  "antfu/import-dedupe": "error",
219
+ "antfu/no-import-dist": "error",
216
220
  "antfu/no-import-node-modules-by-path": "error",
217
221
  "import/first": "error",
218
222
  "import/no-duplicates": "error",
@@ -892,6 +896,7 @@ async function formatters(options = {}, stylistic2 = {}) {
892
896
  [`format/${formater}`]: [
893
897
  "error",
894
898
  formater === "prettier" ? {
899
+ printWidth: 200,
895
900
  ...prettierOptions,
896
901
  embeddedLanguageFormatting: "off",
897
902
  parser: "markdown"
@@ -1386,6 +1391,7 @@ async function typescript(options = {}) {
1386
1391
  GLOB_SRC,
1387
1392
  ...componentExts.map((ext) => `**/*.${ext}`)
1388
1393
  ];
1394
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1389
1395
  const typeAwareRules = {
1390
1396
  "dot-notation": "off",
1391
1397
  "no-implied-eval": "off",
@@ -1475,6 +1481,13 @@ async function typescript(options = {}) {
1475
1481
  "ts/prefer-ts-expect-error": "error",
1476
1482
  "ts/triple-slash-reference": "off",
1477
1483
  "ts/unified-signatures": "off",
1484
+ ...overrides
1485
+ }
1486
+ },
1487
+ {
1488
+ files: filesTypeAware,
1489
+ name: "eslint:typescript:rules-type-aware",
1490
+ rules: {
1478
1491
  ...tsconfigPath ? typeAwareRules : {},
1479
1492
  ...overrides
1480
1493
  }
@@ -1883,7 +1896,7 @@ async function lincy(options = {}, ...userConfigs) {
1883
1896
  const {
1884
1897
  componentExts = [],
1885
1898
  gitignore: enableGitignore = true,
1886
- isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
1899
+ isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
1887
1900
  overrides = {},
1888
1901
  react: enableReact = ReactPackages.some((i) => (0, import_local_pkg4.isPackageExists)(i)),
1889
1902
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
@@ -1962,12 +1975,10 @@ async function lincy(options = {}, ...userConfigs) {
1962
1975
  }));
1963
1976
  }
1964
1977
  if (enableUnoCSS) {
1965
- configs.push(unocss(
1966
- {
1967
- ...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
1968
- overrides: overrides.unocss
1969
- }
1970
- ));
1978
+ configs.push(unocss({
1979
+ ...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
1980
+ overrides: overrides.unocss
1981
+ }));
1971
1982
  }
1972
1983
  if (options.jsonc ?? true) {
1973
1984
  configs.push(
@@ -1994,13 +2005,11 @@ async function lincy(options = {}, ...userConfigs) {
1994
2005
  }));
1995
2006
  }
1996
2007
  if (options.markdown ?? true) {
1997
- configs.push(markdown(
1998
- {
1999
- ...typeof options.markdown !== "boolean" ? options.markdown : {},
2000
- componentExts,
2001
- overrides: overrides.markdown
2002
- }
2003
- ));
2008
+ configs.push(markdown({
2009
+ ...typeof options.markdown !== "boolean" ? options.markdown : {},
2010
+ componentExts,
2011
+ overrides: overrides.markdown
2012
+ }));
2004
2013
  }
2005
2014
  if (options.formatters) {
2006
2015
  configs.push(formatters(
@@ -2044,6 +2053,7 @@ var src_default = lincy;
2044
2053
  GLOB_SRC,
2045
2054
  GLOB_SRC_EXT,
2046
2055
  GLOB_STYLE,
2056
+ GLOB_SVELTE,
2047
2057
  GLOB_TESTS,
2048
2058
  GLOB_TOML,
2049
2059
  GLOB_TS,
package/dist/index.d.cts CHANGED
@@ -10,94 +10,99 @@ import { Rules as Rules$1 } from 'eslint-plugin-antfu';
10
10
  import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
11
11
 
12
12
  /**
13
- * Vendor types from Prettier so we don't rely on the dependency.
13
+ * 来自 Prettier 的供应商类型,因此不依赖依赖项
14
14
  */
15
15
  type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
16
16
  interface VendoredPrettierOptionsRequired {
17
17
  /**
18
- * Specify the number of spaces per indentation-level.
18
+ * 指定换行的行长度.
19
+ * @default 200
20
+ */
21
+ printWidth: number;
22
+ /**
23
+ * 指定每个缩进的空格数.
19
24
  */
20
25
  tabWidth: number;
21
26
  /**
22
- * Indent lines with tabs instead of spaces
27
+ * 使用制表符而不是空格来缩进行
23
28
  */
24
29
  useTabs?: boolean;
25
30
  /**
26
- * Print semicolons at the ends of statements.
31
+ * 在语句末尾添加分号.
27
32
  */
28
33
  semi: boolean;
29
34
  /**
30
- * Use single quotes instead of double quotes.
35
+ * 使用单引号代替双引号.
31
36
  */
32
37
  singleQuote: boolean;
33
38
  /**
34
- * Use single quotes in JSX.
39
+ * JSX 中使用单引号.
35
40
  */
36
41
  jsxSingleQuote: boolean;
37
42
  /**
38
- * Print trailing commas wherever possible.
43
+ * 尽可能添加尾随逗号.
39
44
  */
40
45
  trailingComma: 'none' | 'es5' | 'all';
41
46
  /**
42
- * Print spaces between brackets in object literals.
47
+ * 对象文字中括号之间的空格.
43
48
  */
44
49
  bracketSpacing: boolean;
45
50
  /**
46
- * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
47
- * alone on the next line (does not apply to self closing elements).
51
+ * 将多行 HTMLHTMLJSXVueAngular)元素的 `>` 放在最后一行的末尾,
52
+ * 而不是单独放在下一行(不适用于自闭合元素)。
48
53
  */
49
54
  bracketSameLine: boolean;
50
55
  /**
51
- * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
52
- * @deprecated use bracketSameLine instead
56
+ * 将多行 JSX 元素的 `>` 放在最后一行的末尾,而不是单独放在下一行.
57
+ * @deprecated 使用 bracketSameLine 代替
53
58
  */
54
59
  jsxBracketSameLine: boolean;
55
60
  /**
56
- * Format only a segment of a file.
61
+ * 仅格式化文件的一部分.
57
62
  */
58
63
  rangeStart: number;
59
64
  /**
60
- * Format only a segment of a file.
65
+ * 仅格式化文件的一部分.
61
66
  * @default Number.POSITIVE_INFINITY
62
67
  */
63
68
  rangeEnd: number;
64
69
  /**
65
- * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
66
- * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
70
+ * 默认情况下,Prettier 将按原样包装 Markdown 文本,因为某些服务使用换行敏感渲染器.
71
+ * 在某些情况下,您可能希望依靠编辑器/查看器软包装,因此此选项允许您选择退出.
67
72
  * @default "preserve"
68
73
  */
69
74
  proseWrap: 'always' | 'never' | 'preserve';
70
75
  /**
71
- * Include parentheses around a sole arrow function parameter.
76
+ * 箭头函数参数周围包含括号.
72
77
  * @default "always"
73
78
  */
74
79
  arrowParens: 'avoid' | 'always';
75
80
  /**
76
- * Provide ability to support new languages to prettier.
81
+ * Prettier 提供支持新语言的能力.
77
82
  */
78
83
  plugins: Array<string | any>;
79
84
  /**
80
- * How to handle whitespaces in HTML.
85
+ * 如何处理 HTML 中的空格.
81
86
  * @default "css"
82
87
  */
83
88
  htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
84
89
  /**
85
- * Which end of line characters to apply.
90
+ * 应用哪个换行符.
86
91
  * @default "lf"
87
92
  */
88
93
  endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
89
94
  /**
90
- * Change when properties in objects are quoted.
95
+ * 引用对象中的属性时发生更改.
91
96
  * @default "as-needed"
92
97
  */
93
98
  quoteProps: 'as-needed' | 'consistent' | 'preserve';
94
99
  /**
95
- * Whether or not to indent the code inside <script> and <style> tags in Vue files.
100
+ * 是否缩进Vue文件中<script>和<style>标签内的代码.
96
101
  * @default false
97
102
  */
98
103
  vueIndentScriptAndStyle: boolean;
99
104
  /**
100
- * Enforce single attribute per line in HTML, Vue and JSX.
105
+ * HTMLVue JSX 中强制每行使用单一属性.
101
106
  * @default false
102
107
  */
103
108
  singleAttributePerLine: boolean;
@@ -192,6 +197,11 @@ interface OptionsTypeScriptParserOptions {
192
197
  * TypeScript 的附加解析器选项。
193
198
  */
194
199
  parserOptions?: Partial<ParserOptions>;
200
+ /**
201
+ * 应该识别类型的文件的全局模式.
202
+ * @default ['**\/*.{ts,tsx}']
203
+ */
204
+ filesTypeAware?: string[];
195
205
  }
196
206
  interface OptionsTypeScriptWithTypes {
197
207
  /**
@@ -289,6 +299,16 @@ interface OptionsConfig extends OptionsComponentExts {
289
299
  * @default 根据依赖关系自动检测
290
300
  */
291
301
  react?: boolean | OptionsReact | OptionsFiles;
302
+ /**
303
+ * 启用 svelte 支持.
304
+ *
305
+ * 需要安装:
306
+ * - `eslint-plugin-svelte`
307
+ * - `svelte-eslint-parser`
308
+ *
309
+ * @default false
310
+ */
311
+ svelte?: boolean;
292
312
  /**
293
313
  * 启用 unocss rules.
294
314
  *
@@ -352,6 +372,7 @@ interface OptionsConfig extends OptionsComponentExts {
352
372
  test?: FlatConfigItem['rules'];
353
373
  vue?: FlatConfigItem['rules'];
354
374
  react?: FlatConfigItem['rules'];
375
+ svelte?: FlatConfigItem['rules'];
355
376
  jsonc?: FlatConfigItem['rules'];
356
377
  markdown?: FlatConfigItem['rules'];
357
378
  yaml?: FlatConfigItem['rules'];
@@ -452,6 +473,7 @@ declare const GLOB_JSON5 = "**/*.json5";
452
473
  declare const GLOB_JSONC = "**/*.jsonc";
453
474
  declare const GLOB_MARKDOWN = "**/*.md";
454
475
  declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
476
+ declare const GLOB_SVELTE = "**/*.svelte";
455
477
  declare const GLOB_VUE = "**/*.vue";
456
478
  declare const GLOB_YAML = "**/*.y?(a)ml";
457
479
  declare const GLOB_TOML = "**/*.toml";
@@ -461,4 +483,4 @@ declare const GLOB_TESTS: string[];
461
483
  declare const GLOB_ALL_SRC: string[];
462
484
  declare const GLOB_EXCLUDE: string[];
463
485
 
464
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
486
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -10,94 +10,99 @@ import { Rules as Rules$1 } from 'eslint-plugin-antfu';
10
10
  import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
11
11
 
12
12
  /**
13
- * Vendor types from Prettier so we don't rely on the dependency.
13
+ * 来自 Prettier 的供应商类型,因此不依赖依赖项
14
14
  */
15
15
  type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
16
16
  interface VendoredPrettierOptionsRequired {
17
17
  /**
18
- * Specify the number of spaces per indentation-level.
18
+ * 指定换行的行长度.
19
+ * @default 200
20
+ */
21
+ printWidth: number;
22
+ /**
23
+ * 指定每个缩进的空格数.
19
24
  */
20
25
  tabWidth: number;
21
26
  /**
22
- * Indent lines with tabs instead of spaces
27
+ * 使用制表符而不是空格来缩进行
23
28
  */
24
29
  useTabs?: boolean;
25
30
  /**
26
- * Print semicolons at the ends of statements.
31
+ * 在语句末尾添加分号.
27
32
  */
28
33
  semi: boolean;
29
34
  /**
30
- * Use single quotes instead of double quotes.
35
+ * 使用单引号代替双引号.
31
36
  */
32
37
  singleQuote: boolean;
33
38
  /**
34
- * Use single quotes in JSX.
39
+ * JSX 中使用单引号.
35
40
  */
36
41
  jsxSingleQuote: boolean;
37
42
  /**
38
- * Print trailing commas wherever possible.
43
+ * 尽可能添加尾随逗号.
39
44
  */
40
45
  trailingComma: 'none' | 'es5' | 'all';
41
46
  /**
42
- * Print spaces between brackets in object literals.
47
+ * 对象文字中括号之间的空格.
43
48
  */
44
49
  bracketSpacing: boolean;
45
50
  /**
46
- * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
47
- * alone on the next line (does not apply to self closing elements).
51
+ * 将多行 HTMLHTMLJSXVueAngular)元素的 `>` 放在最后一行的末尾,
52
+ * 而不是单独放在下一行(不适用于自闭合元素)。
48
53
  */
49
54
  bracketSameLine: boolean;
50
55
  /**
51
- * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
52
- * @deprecated use bracketSameLine instead
56
+ * 将多行 JSX 元素的 `>` 放在最后一行的末尾,而不是单独放在下一行.
57
+ * @deprecated 使用 bracketSameLine 代替
53
58
  */
54
59
  jsxBracketSameLine: boolean;
55
60
  /**
56
- * Format only a segment of a file.
61
+ * 仅格式化文件的一部分.
57
62
  */
58
63
  rangeStart: number;
59
64
  /**
60
- * Format only a segment of a file.
65
+ * 仅格式化文件的一部分.
61
66
  * @default Number.POSITIVE_INFINITY
62
67
  */
63
68
  rangeEnd: number;
64
69
  /**
65
- * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
66
- * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
70
+ * 默认情况下,Prettier 将按原样包装 Markdown 文本,因为某些服务使用换行敏感渲染器.
71
+ * 在某些情况下,您可能希望依靠编辑器/查看器软包装,因此此选项允许您选择退出.
67
72
  * @default "preserve"
68
73
  */
69
74
  proseWrap: 'always' | 'never' | 'preserve';
70
75
  /**
71
- * Include parentheses around a sole arrow function parameter.
76
+ * 箭头函数参数周围包含括号.
72
77
  * @default "always"
73
78
  */
74
79
  arrowParens: 'avoid' | 'always';
75
80
  /**
76
- * Provide ability to support new languages to prettier.
81
+ * Prettier 提供支持新语言的能力.
77
82
  */
78
83
  plugins: Array<string | any>;
79
84
  /**
80
- * How to handle whitespaces in HTML.
85
+ * 如何处理 HTML 中的空格.
81
86
  * @default "css"
82
87
  */
83
88
  htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
84
89
  /**
85
- * Which end of line characters to apply.
90
+ * 应用哪个换行符.
86
91
  * @default "lf"
87
92
  */
88
93
  endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
89
94
  /**
90
- * Change when properties in objects are quoted.
95
+ * 引用对象中的属性时发生更改.
91
96
  * @default "as-needed"
92
97
  */
93
98
  quoteProps: 'as-needed' | 'consistent' | 'preserve';
94
99
  /**
95
- * Whether or not to indent the code inside <script> and <style> tags in Vue files.
100
+ * 是否缩进Vue文件中<script>和<style>标签内的代码.
96
101
  * @default false
97
102
  */
98
103
  vueIndentScriptAndStyle: boolean;
99
104
  /**
100
- * Enforce single attribute per line in HTML, Vue and JSX.
105
+ * HTMLVue JSX 中强制每行使用单一属性.
101
106
  * @default false
102
107
  */
103
108
  singleAttributePerLine: boolean;
@@ -192,6 +197,11 @@ interface OptionsTypeScriptParserOptions {
192
197
  * TypeScript 的附加解析器选项。
193
198
  */
194
199
  parserOptions?: Partial<ParserOptions>;
200
+ /**
201
+ * 应该识别类型的文件的全局模式.
202
+ * @default ['**\/*.{ts,tsx}']
203
+ */
204
+ filesTypeAware?: string[];
195
205
  }
196
206
  interface OptionsTypeScriptWithTypes {
197
207
  /**
@@ -289,6 +299,16 @@ interface OptionsConfig extends OptionsComponentExts {
289
299
  * @default 根据依赖关系自动检测
290
300
  */
291
301
  react?: boolean | OptionsReact | OptionsFiles;
302
+ /**
303
+ * 启用 svelte 支持.
304
+ *
305
+ * 需要安装:
306
+ * - `eslint-plugin-svelte`
307
+ * - `svelte-eslint-parser`
308
+ *
309
+ * @default false
310
+ */
311
+ svelte?: boolean;
292
312
  /**
293
313
  * 启用 unocss rules.
294
314
  *
@@ -352,6 +372,7 @@ interface OptionsConfig extends OptionsComponentExts {
352
372
  test?: FlatConfigItem['rules'];
353
373
  vue?: FlatConfigItem['rules'];
354
374
  react?: FlatConfigItem['rules'];
375
+ svelte?: FlatConfigItem['rules'];
355
376
  jsonc?: FlatConfigItem['rules'];
356
377
  markdown?: FlatConfigItem['rules'];
357
378
  yaml?: FlatConfigItem['rules'];
@@ -452,6 +473,7 @@ declare const GLOB_JSON5 = "**/*.json5";
452
473
  declare const GLOB_JSONC = "**/*.jsonc";
453
474
  declare const GLOB_MARKDOWN = "**/*.md";
454
475
  declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
476
+ declare const GLOB_SVELTE = "**/*.svelte";
455
477
  declare const GLOB_VUE = "**/*.vue";
456
478
  declare const GLOB_YAML = "**/*.y?(a)ml";
457
479
  declare const GLOB_TOML = "**/*.toml";
@@ -461,4 +483,4 @@ declare const GLOB_TESTS: string[];
461
483
  declare const GLOB_ALL_SRC: string[];
462
484
  declare const GLOB_EXCLUDE: string[];
463
485
 
464
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
486
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ var GLOB_JSON5 = "**/*.json5";
47
47
  var GLOB_JSONC = "**/*.jsonc";
48
48
  var GLOB_MARKDOWN = "**/*.md";
49
49
  var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
50
+ var GLOB_SVELTE = "**/*.svelte";
50
51
  var GLOB_VUE = "**/*.vue";
51
52
  var GLOB_YAML = "**/*.y?(a)ml";
52
53
  var GLOB_TOML = "**/*.toml";
@@ -63,6 +64,7 @@ var GLOB_ALL_SRC = [
63
64
  GLOB_JSON,
64
65
  GLOB_JSON5,
65
66
  GLOB_MARKDOWN,
67
+ GLOB_SVELTE,
66
68
  GLOB_VUE,
67
69
  GLOB_YAML,
68
70
  GLOB_HTML
@@ -125,6 +127,7 @@ async function imports(options = {}) {
125
127
  },
126
128
  rules: {
127
129
  "antfu/import-dedupe": "error",
130
+ "antfu/no-import-dist": "error",
128
131
  "antfu/no-import-node-modules-by-path": "error",
129
132
  "import/first": "error",
130
133
  "import/no-duplicates": "error",
@@ -804,6 +807,7 @@ async function formatters(options = {}, stylistic2 = {}) {
804
807
  [`format/${formater}`]: [
805
808
  "error",
806
809
  formater === "prettier" ? {
810
+ printWidth: 200,
807
811
  ...prettierOptions,
808
812
  embeddedLanguageFormatting: "off",
809
813
  parser: "markdown"
@@ -1298,6 +1302,7 @@ async function typescript(options = {}) {
1298
1302
  GLOB_SRC,
1299
1303
  ...componentExts.map((ext) => `**/*.${ext}`)
1300
1304
  ];
1305
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1301
1306
  const typeAwareRules = {
1302
1307
  "dot-notation": "off",
1303
1308
  "no-implied-eval": "off",
@@ -1387,6 +1392,13 @@ async function typescript(options = {}) {
1387
1392
  "ts/prefer-ts-expect-error": "error",
1388
1393
  "ts/triple-slash-reference": "off",
1389
1394
  "ts/unified-signatures": "off",
1395
+ ...overrides
1396
+ }
1397
+ },
1398
+ {
1399
+ files: filesTypeAware,
1400
+ name: "eslint:typescript:rules-type-aware",
1401
+ rules: {
1390
1402
  ...tsconfigPath ? typeAwareRules : {},
1391
1403
  ...overrides
1392
1404
  }
@@ -1795,7 +1807,7 @@ async function lincy(options = {}, ...userConfigs) {
1795
1807
  const {
1796
1808
  componentExts = [],
1797
1809
  gitignore: enableGitignore = true,
1798
- isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
1810
+ isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
1799
1811
  overrides = {},
1800
1812
  react: enableReact = ReactPackages.some((i) => isPackageExists3(i)),
1801
1813
  typescript: enableTypeScript = isPackageExists3("typescript"),
@@ -1874,12 +1886,10 @@ async function lincy(options = {}, ...userConfigs) {
1874
1886
  }));
1875
1887
  }
1876
1888
  if (enableUnoCSS) {
1877
- configs.push(unocss(
1878
- {
1879
- ...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
1880
- overrides: overrides.unocss
1881
- }
1882
- ));
1889
+ configs.push(unocss({
1890
+ ...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
1891
+ overrides: overrides.unocss
1892
+ }));
1883
1893
  }
1884
1894
  if (options.jsonc ?? true) {
1885
1895
  configs.push(
@@ -1906,13 +1916,11 @@ async function lincy(options = {}, ...userConfigs) {
1906
1916
  }));
1907
1917
  }
1908
1918
  if (options.markdown ?? true) {
1909
- configs.push(markdown(
1910
- {
1911
- ...typeof options.markdown !== "boolean" ? options.markdown : {},
1912
- componentExts,
1913
- overrides: overrides.markdown
1914
- }
1915
- ));
1919
+ configs.push(markdown({
1920
+ ...typeof options.markdown !== "boolean" ? options.markdown : {},
1921
+ componentExts,
1922
+ overrides: overrides.markdown
1923
+ }));
1916
1924
  }
1917
1925
  if (options.formatters) {
1918
1926
  configs.push(formatters(
@@ -1955,6 +1963,7 @@ export {
1955
1963
  GLOB_SRC,
1956
1964
  GLOB_SRC_EXT,
1957
1965
  GLOB_STYLE,
1966
+ GLOB_SVELTE,
1958
1967
  GLOB_TESTS,
1959
1968
  GLOB_TOML,
1960
1969
  GLOB_TS,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "4.2.3",
4
+ "version": "4.2.4",
5
5
  "packageManager": "pnpm@8.7.6",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -65,26 +65,26 @@
65
65
  "@antfu/eslint-define-config": "1.23.0-2",
66
66
  "@antfu/install-pkg": "^0.3.1",
67
67
  "@stylistic/eslint-plugin": "1.5.1",
68
- "@typescript-eslint/eslint-plugin": "^6.14.0",
69
- "@typescript-eslint/parser": "^6.14.0",
68
+ "@typescript-eslint/eslint-plugin": "^6.16.0",
69
+ "@typescript-eslint/parser": "^6.16.0",
70
70
  "eslint-config-flat-gitignore": "^0.1.2",
71
71
  "eslint-merge-processors": "^0.1.0",
72
72
  "eslint-parser-plain": "^0.1.0",
73
- "eslint-plugin-antfu": "^2.0.0",
73
+ "eslint-plugin-antfu": "^2.1.1",
74
74
  "eslint-plugin-eslint-comments": "^3.2.0",
75
- "eslint-plugin-i": "^2.29.0",
76
- "eslint-plugin-jsdoc": "^46.9.0",
77
- "eslint-plugin-jsonc": "^2.10.0",
75
+ "eslint-plugin-i": "^2.29.1",
76
+ "eslint-plugin-jsdoc": "^46.9.1",
77
+ "eslint-plugin-jsonc": "^2.11.2",
78
78
  "eslint-plugin-markdown": "^3.0.1",
79
- "eslint-plugin-n": "^16.4.0",
79
+ "eslint-plugin-n": "^16.5.0",
80
80
  "eslint-plugin-no-only-tests": "^3.1.0",
81
81
  "eslint-plugin-perfectionist": "^2.5.0",
82
- "eslint-plugin-toml": "^0.7.1",
83
- "eslint-plugin-unicorn": "^49.0.0",
82
+ "eslint-plugin-toml": "^0.8.0",
83
+ "eslint-plugin-unicorn": "^50.0.1",
84
84
  "eslint-plugin-unused-imports": "^3.0.0",
85
- "eslint-plugin-vitest": "^0.3.16",
85
+ "eslint-plugin-vitest": "^0.3.20",
86
86
  "eslint-plugin-vue": "^9.19.2",
87
- "eslint-plugin-yml": "^1.10.0",
87
+ "eslint-plugin-yml": "^1.11.0",
88
88
  "eslint-processor-vue-blocks": "^0.1.1",
89
89
  "globals": "^13.24.0",
90
90
  "jsonc-eslint-parser": "^2.4.0",
@@ -101,12 +101,12 @@
101
101
  "@eslint-types/unicorn": "^49.0.0",
102
102
  "@lincy/eslint-config": "workspace:*",
103
103
  "@stylistic/eslint-plugin-migrate": "^1.5.1",
104
- "@types/eslint": "^8.44.8",
105
- "@types/node": "^20.10.4",
104
+ "@types/eslint": "^8.56.0",
105
+ "@types/node": "^20.10.5",
106
106
  "@types/prompts": "^2.4.9",
107
107
  "@unocss/eslint-plugin": "^0.58.0",
108
108
  "bumpp": "^9.2.1",
109
- "eslint": "^8.55.0",
109
+ "eslint": "^8.56.0",
110
110
  "eslint-flat-config-viewer": "^0.1.3",
111
111
  "eslint-plugin-format": "^0.1.0",
112
112
  "eslint-plugin-react": "^7.33.2",
@@ -118,12 +118,12 @@
118
118
  "rimraf": "^5.0.5",
119
119
  "simple-git-hooks": "^2.9.0",
120
120
  "simple-open-url": "^3.0.1",
121
- "sucrase": "^3.34.0",
121
+ "sucrase": "^3.35.0",
122
122
  "tsup": "^8.0.1",
123
123
  "typescript": "^5.3.3",
124
124
  "unbuild": "^2.0.0",
125
- "vitest": "^1.0.4",
126
- "vue": "^3.3.11"
125
+ "vitest": "^1.1.0",
126
+ "vue": "^3.3.13"
127
127
  },
128
128
  "pnpm": {
129
129
  "peerDependencyRules": {