@ghettoddos/eslint-config 5.0.0 → 5.1.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.mts CHANGED
@@ -14,12 +14,12 @@ interface RuleOptions {
14
14
  */
15
15
  'accessor-pairs'?: Linter.RuleEntry<AccessorPairs>;
16
16
  /**
17
- * Having line breaks styles to object, array and named imports
17
+ * Enforce consistent line breaks for chaining member access
18
18
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-chaining.md
19
19
  */
20
20
  'antfu/consistent-chaining'?: Linter.RuleEntry<AntfuConsistentChaining>;
21
21
  /**
22
- * Having line breaks styles to object, array and named imports
22
+ * Enforce consistent line breaks inside braces and parentheses
23
23
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
24
24
  */
25
25
  'antfu/consistent-list-newline'?: Linter.RuleEntry<AntfuConsistentListNewline>;
@@ -45,22 +45,22 @@ interface RuleOptions {
45
45
  'antfu/indent-unindent'?: Linter.RuleEntry<AntfuIndentUnindent>;
46
46
  /**
47
47
  * Prevent importing modules in `dist` folder
48
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.test.ts
48
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.md
49
49
  */
50
50
  'antfu/no-import-dist'?: Linter.RuleEntry<[]>;
51
51
  /**
52
52
  * Prevent importing modules in `node_modules` folder by relative or absolute path
53
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.test.ts
53
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.md
54
54
  */
55
55
  'antfu/no-import-node-modules-by-path'?: Linter.RuleEntry<[]>;
56
56
  /**
57
57
  * Prevent using top-level await
58
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.test.ts
58
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.md
59
59
  */
60
60
  'antfu/no-top-level-await'?: Linter.RuleEntry<[]>;
61
61
  /**
62
62
  * Do not use `exports =`
63
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.test.ts
63
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.md
64
64
  */
65
65
  'antfu/no-ts-export-equal'?: Linter.RuleEntry<[]>;
66
66
  /**
@@ -6462,7 +6462,7 @@ interface RuleOptions {
6462
6462
  */
6463
6463
  'test/prefer-expect-resolves'?: Linter.RuleEntry<[]>;
6464
6464
  /**
6465
- * enforce using `expectTypeOf` instead of `expect(typeof ...)`
6465
+ * enforce using `expect(...).toBeTypeOf(...)` instead of `expect(typeof ...).toBe(...)`
6466
6466
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md
6467
6467
  */
6468
6468
  'test/prefer-expect-type-of'?: Linter.RuleEntry<[]>;
@@ -22066,7 +22066,7 @@ interface OptionsHasTypeScript {
22066
22066
  interface OptionsStylistic {
22067
22067
  stylistic?: boolean | StylisticConfig;
22068
22068
  }
22069
- interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi' | 'experimental'> {
22069
+ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi' | 'braceStyle' | 'experimental'> {
22070
22070
  /**
22071
22071
  * Specify the maximum line length.
22072
22072
  * @default 100
@@ -22260,6 +22260,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
22260
22260
  * @default true
22261
22261
  */
22262
22262
  unicorn?: boolean | OptionsUnicorn;
22263
+ /**
22264
+ * Options for eslint-plugin-perfectionist.
22265
+ *
22266
+ * @default true
22267
+ */
22268
+ perfectionist?: boolean | OptionsOverrides;
22263
22269
  /**
22264
22270
  * Options for eslint-plugin-import-lite.
22265
22271
  *
@@ -22479,7 +22485,7 @@ declare function node(): Promise<TypedFlatConfigItem[]>;
22479
22485
  *
22480
22486
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
22481
22487
  */
22482
- declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
22488
+ declare function perfectionist(options: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
22483
22489
  //#endregion
22484
22490
  //#region src/configs/pnpm.d.ts
22485
22491
  declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
package/dist/index.mjs CHANGED
@@ -337,6 +337,7 @@ function isInGitHooksOrLintStaged() {
337
337
  //#endregion
338
338
  //#region src/configs/stylistic.ts
339
339
  const StylisticConfigDefaults = {
340
+ braceStyle: "stroustrup",
340
341
  experimental: false,
341
342
  indent: 2,
342
343
  jsx: true,
@@ -346,12 +347,13 @@ const StylisticConfigDefaults = {
346
347
  tabWidth: 4
347
348
  };
348
349
  async function stylistic(options = {}) {
349
- const { experimental, indent, jsx, lessOpinionated = false, overrides = {}, printWidth, quotes, semi, tabWidth } = {
350
+ const { braceStyle, experimental, indent, jsx, lessOpinionated = false, overrides = {}, printWidth, quotes, semi, tabWidth } = {
350
351
  ...StylisticConfigDefaults,
351
352
  ...options
352
353
  };
353
354
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
354
355
  const config = pluginStylistic.configs.customize({
356
+ braceStyle,
355
357
  experimental,
356
358
  indent,
357
359
  jsx,
@@ -1031,7 +1033,8 @@ async function node() {
1031
1033
  *
1032
1034
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
1033
1035
  */
1034
- async function perfectionist() {
1036
+ async function perfectionist(options) {
1037
+ const { overrides = {} } = options;
1035
1038
  return [{
1036
1039
  name: "perfectionist/setup",
1037
1040
  plugins: { perfectionist: pluginPerfectionist },
@@ -1073,7 +1076,8 @@ async function perfectionist() {
1073
1076
  "perfectionist/sort-named-imports": ["error", {
1074
1077
  order: "asc",
1075
1078
  type: "natural"
1076
- }]
1079
+ }],
1080
+ ...overrides
1077
1081
  }
1078
1082
  }];
1079
1083
  }
@@ -1942,7 +1946,7 @@ async function unocss(options = {}) {
1942
1946
  async function vue(options = {}) {
1943
1947
  const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true, vueVersion = 3 } = options;
1944
1948
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1945
- const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1949
+ const { braceStyle = "stroustrup", indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1946
1950
  if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
1947
1951
  const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
1948
1952
  interopDefault(import("eslint-plugin-vue")),
@@ -2083,7 +2087,7 @@ async function vue(options = {}) {
2083
2087
  }],
2084
2088
  "vue/brace-style": [
2085
2089
  "error",
2086
- "stroustrup",
2090
+ braceStyle,
2087
2091
  { allowSingleLine: true }
2088
2092
  ],
2089
2093
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -2222,7 +2226,7 @@ const defaultPluginRenaming = {
2222
2226
  * The merged ESLint configurations.
2223
2227
  */
2224
2228
  function config(options = {}, ...userConfigs) {
2225
- const { autoRenamePlugins = true, baseline: enableBaseLineJs = false, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = isPackageExists("next"), node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, sonarjs: enableSonarJs = false, tailwindcss: enableTailwindCSS = isPackageExists("tailwindcss"), type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2229
+ const { autoRenamePlugins = true, baseline: enableBaseLineJs = false, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = isPackageExists("next"), node: enableNode = true, perfectionist: enablePerfectionist = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, sonarjs: enableSonarJs = false, tailwindcss: enableTailwindCSS = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2226
2230
  let isInEditor = options.isInEditor;
2227
2231
  if (isInEditor == null) {
2228
2232
  isInEditor = isInEditorEnv();
@@ -2244,7 +2248,8 @@ function config(options = {}, ...userConfigs) {
2244
2248
  configs.push(ignores(userIgnores, !enableTypeScript), javascript({
2245
2249
  isInEditor,
2246
2250
  overrides: getOverrides(options, "javascript")
2247
- }), comments(), command(), deMorgan(), preferEarlyReturn(), perfectionist());
2251
+ }), comments(), command(), deMorgan(), preferEarlyReturn());
2252
+ if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
2248
2253
  if (enableNode) configs.push(node());
2249
2254
  if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
2250
2255
  if (enableImports) configs.push(imports({
@@ -2363,6 +2368,7 @@ const CONFIG_PRESET_FULL_ON = {
2363
2368
  markdown: true,
2364
2369
  nextjs: true,
2365
2370
  node: true,
2371
+ perfectionist: true,
2366
2372
  pnpm: true,
2367
2373
  react: true,
2368
2374
  regexp: true,
@@ -2391,6 +2397,7 @@ const CONFIG_PRESET_FULL_OFF = {
2391
2397
  markdown: false,
2392
2398
  nextjs: false,
2393
2399
  node: false,
2400
+ perfectionist: false,
2394
2401
  pnpm: false,
2395
2402
  react: false,
2396
2403
  regexp: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ghettoddos/eslint-config",
3
3
  "type": "module",
4
- "version": "5.0.0",
4
+ "version": "5.1.0",
5
5
  "description": "ghettoDdOS ESLint config",
6
6
  "author": "ghettoDdOS <pen.egor2002@gamil.com> (https://github.com/ghettoDdOS/)",
7
7
  "license": "MIT",
@@ -86,14 +86,14 @@
86
86
  "@stylistic/eslint-plugin": "^5.10.0",
87
87
  "@typescript-eslint/eslint-plugin": "^8.59.2",
88
88
  "@typescript-eslint/parser": "^8.59.2",
89
- "@vitest/eslint-plugin": "^1.6.16",
89
+ "@vitest/eslint-plugin": "^1.6.17",
90
90
  "eslint-config-flat-gitignore": "^2.3.0",
91
91
  "eslint-flat-config-utils": "^3.2.0",
92
92
  "eslint-merge-processors": "^2.0.0",
93
- "eslint-plugin-antfu": "^3.2.2",
93
+ "eslint-plugin-antfu": "^3.2.3",
94
94
  "eslint-plugin-baseline-js": "^0.6.2",
95
95
  "eslint-plugin-command": "^3.5.2",
96
- "eslint-plugin-de-morgan": "^2.1.1",
96
+ "eslint-plugin-de-morgan": "^2.1.2",
97
97
  "eslint-plugin-import-lite": "^0.6.0",
98
98
  "eslint-plugin-jsdoc": "^62.9.0",
99
99
  "eslint-plugin-jsonc": "^3.1.2",
@@ -142,11 +142,12 @@
142
142
  "pnpm-workspace-yaml": "^1.6.0",
143
143
  "simple-git-hooks": "^2.13.1",
144
144
  "tsdown": "^0.21.10",
145
+ "tsdown-stale-guard": "^0.1.2",
145
146
  "tsx": "^4.21.0",
146
147
  "typescript": "^6.0.3",
147
148
  "vue": "^3.5.34",
148
149
  "vue-eslint-parser": "^10.4.0",
149
- "@ghettoddos/eslint-config": "5.0.0"
150
+ "@ghettoddos/eslint-config": "5.1.0"
150
151
  },
151
152
  "resolutions": {
152
153
  "@eslint-community/eslint-utils": "catalog:peer",
@@ -159,8 +160,8 @@
159
160
  "tsx": "catalog:dev"
160
161
  },
161
162
  "simple-git-hooks": {
162
- "pre-commit": "nlx lint-staged",
163
- "commit-msg": "nlx commitlint --edit `$1`"
163
+ "pre-commit": "npx lint-staged",
164
+ "commit-msg": "npx --no -- commitlint --edit $1"
164
165
  },
165
166
  "lint-staged": {
166
167
  "*": "eslint --fix"