@siberiacancode/eslint 2.16.0 → 2.16.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.
@@ -391,15 +391,22 @@ const siberiacancodePlugin = {
391
391
 
392
392
  //#endregion
393
393
  //#region src/index.ts
394
- const getDefaultTypescriptConfig = (option) => {
395
- if (typeof option === "object") return option;
396
- if (option === true && node_fs.default.existsSync("./tsconfig.json")) return { tsconfigPath: "./tsconfig.json" };
397
- return option;
398
- };
399
394
  const eslint = (inputOptions = {}, ...configs) => {
400
- const { jsxA11y = false, playwright = false, ...options } = inputOptions;
401
- const typescript = getDefaultTypescriptConfig(options?.typescript ?? false);
402
- const stylistic = options?.stylistic ?? false;
395
+ const { jsxA11y = false, playwright = false, typescript = false, ...options } = inputOptions;
396
+ const stylistic = options.stylistic ?? false;
397
+ if (typescript === "engine") configs.unshift({
398
+ name: "siberiacancode/typescript",
399
+ files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
400
+ rules: {
401
+ "ts/promise-function-async": "off",
402
+ "ts/strict-boolean-expressions": "off",
403
+ "ts/no-unnecessary-condition": "error",
404
+ "ts/no-namespace": "off",
405
+ "ts/no-floating-promises": "off",
406
+ "ts/no-misused-promises": "off",
407
+ "ts/no-empty-object-type": "warn"
408
+ }
409
+ });
403
410
  if (jsxA11y) {
404
411
  const jsxA11yRules = eslint_plugin_jsx_a11y.default.flatConfigs.recommended.rules;
405
412
  configs.unshift({
@@ -478,8 +485,8 @@ const eslint = (inputOptions = {}, ...configs) => {
478
485
  });
479
486
  return (0, _antfu_eslint_config.default)({
480
487
  ...options,
481
- typescript,
482
- stylistic
488
+ stylistic,
489
+ ...typescript === "engine" ? { typescript: { tsconfigPath: "./tsconfig.json" } } : typescript
483
490
  }, {
484
491
  name: "siberiacancode/rewrite",
485
492
  rules: {
@@ -6,6 +6,7 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
6
6
  type EslintOptions = OptionsConfig & TypedFlatConfigItem & {
7
7
  jsxA11y?: boolean;
8
8
  playwright?: boolean;
9
+ typescript?: 'engine';
9
10
  };
10
11
  type Eslint = (options?: EslintOptions, ...userConfigs: Awaitable<FlatConfigComposer<any, any> | Linter.Config[] | TypedFlatConfigItem | TypedFlatConfigItem[]>[]) => FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
11
12
  declare const eslint: Eslint;
@@ -6,6 +6,7 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
6
6
  type EslintOptions = OptionsConfig & TypedFlatConfigItem & {
7
7
  jsxA11y?: boolean;
8
8
  playwright?: boolean;
9
+ typescript?: 'engine';
9
10
  };
10
11
  type Eslint = (options?: EslintOptions, ...userConfigs: Awaitable<FlatConfigComposer<any, any> | Linter.Config[] | TypedFlatConfigItem | TypedFlatConfigItem[]>[]) => FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
11
12
  declare const eslint: Eslint;
@@ -357,15 +357,22 @@ const siberiacancodePlugin = {
357
357
 
358
358
  //#endregion
359
359
  //#region src/index.ts
360
- const getDefaultTypescriptConfig = (option) => {
361
- if (typeof option === "object") return option;
362
- if (option === true && fs.existsSync("./tsconfig.json")) return { tsconfigPath: "./tsconfig.json" };
363
- return option;
364
- };
365
360
  const eslint = (inputOptions = {}, ...configs) => {
366
- const { jsxA11y = false, playwright = false, ...options } = inputOptions;
367
- const typescript = getDefaultTypescriptConfig(options?.typescript ?? false);
368
- const stylistic = options?.stylistic ?? false;
361
+ const { jsxA11y = false, playwright = false, typescript = false, ...options } = inputOptions;
362
+ const stylistic = options.stylistic ?? false;
363
+ if (typescript === "engine") configs.unshift({
364
+ name: "siberiacancode/typescript",
365
+ files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
366
+ rules: {
367
+ "ts/promise-function-async": "off",
368
+ "ts/strict-boolean-expressions": "off",
369
+ "ts/no-unnecessary-condition": "error",
370
+ "ts/no-namespace": "off",
371
+ "ts/no-floating-promises": "off",
372
+ "ts/no-misused-promises": "off",
373
+ "ts/no-empty-object-type": "warn"
374
+ }
375
+ });
369
376
  if (jsxA11y) {
370
377
  const jsxA11yRules = pluginJsxA11y.flatConfigs.recommended.rules;
371
378
  configs.unshift({
@@ -444,8 +451,8 @@ const eslint = (inputOptions = {}, ...configs) => {
444
451
  });
445
452
  return antfu({
446
453
  ...options,
447
- typescript,
448
- stylistic
454
+ stylistic,
455
+ ...typescript === "engine" ? { typescript: { tsconfigPath: "./tsconfig.json" } } : typescript
449
456
  }, {
450
457
  name: "siberiacancode/rewrite",
451
458
  rules: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@siberiacancode/eslint",
3
3
  "type": "module",
4
- "version": "2.16.0",
4
+ "version": "2.16.1",
5
5
  "description": "eslint configs",
6
6
  "author": {
7
7
  "name": "SIBERIA CAN CODE 🧊",