@siberiacancode/eslint 2.16.0 → 2.16.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/cjs/index.cjs +30 -20
- package/dist/cjs/index.d.cts +1 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +28 -19
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -34,10 +34,12 @@ let eslint_plugin_jsx_a11y = require("eslint-plugin-jsx-a11y");
|
|
|
34
34
|
eslint_plugin_jsx_a11y = __toESM(eslint_plugin_jsx_a11y);
|
|
35
35
|
let eslint_plugin_playwright = require("eslint-plugin-playwright");
|
|
36
36
|
eslint_plugin_playwright = __toESM(eslint_plugin_playwright);
|
|
37
|
-
let node_fs = require("node:fs");
|
|
38
|
-
node_fs = __toESM(node_fs);
|
|
39
37
|
let node_path = require("node:path");
|
|
40
38
|
node_path = __toESM(node_path);
|
|
39
|
+
let node_process = require("node:process");
|
|
40
|
+
node_process = __toESM(node_process);
|
|
41
|
+
let node_fs = require("node:fs");
|
|
42
|
+
node_fs = __toESM(node_fs);
|
|
41
43
|
|
|
42
44
|
//#region src/plugin/rules/function-component-definition.ts
|
|
43
45
|
const NAMED_TEMPLATES = {
|
|
@@ -391,15 +393,22 @@ const siberiacancodePlugin = {
|
|
|
391
393
|
|
|
392
394
|
//#endregion
|
|
393
395
|
//#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
396
|
const eslint = (inputOptions = {}, ...configs) => {
|
|
400
|
-
const { jsxA11y = false, playwright = false, ...options } = inputOptions;
|
|
401
|
-
const
|
|
402
|
-
|
|
397
|
+
const { jsxA11y = false, playwright = false, typescript = false, ...options } = inputOptions;
|
|
398
|
+
const stylistic = options.stylistic ?? false;
|
|
399
|
+
if (typescript === "engine") configs.unshift({
|
|
400
|
+
name: "siberiacancode/typescript",
|
|
401
|
+
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
|
402
|
+
rules: {
|
|
403
|
+
"ts/promise-function-async": "off",
|
|
404
|
+
"ts/strict-boolean-expressions": "off",
|
|
405
|
+
"ts/no-unnecessary-condition": "error",
|
|
406
|
+
"ts/no-namespace": "off",
|
|
407
|
+
"ts/no-floating-promises": "off",
|
|
408
|
+
"ts/no-misused-promises": "off",
|
|
409
|
+
"ts/no-empty-object-type": "warn"
|
|
410
|
+
}
|
|
411
|
+
});
|
|
403
412
|
if (jsxA11y) {
|
|
404
413
|
const jsxA11yRules = eslint_plugin_jsx_a11y.default.flatConfigs.recommended.rules;
|
|
405
414
|
configs.unshift({
|
|
@@ -460,14 +469,6 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
460
469
|
"style/semi": ["error", "always"]
|
|
461
470
|
}
|
|
462
471
|
});
|
|
463
|
-
configs.unshift({
|
|
464
|
-
name: "siberiacancode",
|
|
465
|
-
plugins: { siberiacancode: siberiacancodePlugin },
|
|
466
|
-
rules: {
|
|
467
|
-
"siberiacancode/function-component-definition": ["error", { namedComponents: ["arrow-function"] }],
|
|
468
|
-
"siberiacancode/no-unused-class": "error"
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
472
|
configs.unshift({
|
|
472
473
|
name: "siberiacancode/css",
|
|
473
474
|
plugins: { "siberiacancode-css": _eslint_css.default },
|
|
@@ -476,10 +477,18 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
476
477
|
return acc;
|
|
477
478
|
}, {}) }
|
|
478
479
|
});
|
|
480
|
+
configs.unshift({
|
|
481
|
+
name: "siberiacancode",
|
|
482
|
+
plugins: { siberiacancode: siberiacancodePlugin },
|
|
483
|
+
rules: {
|
|
484
|
+
"siberiacancode/function-component-definition": ["error", { namedComponents: ["arrow-function"] }],
|
|
485
|
+
"siberiacancode/no-unused-class": "error"
|
|
486
|
+
}
|
|
487
|
+
});
|
|
479
488
|
return (0, _antfu_eslint_config.default)({
|
|
480
489
|
...options,
|
|
481
|
-
|
|
482
|
-
|
|
490
|
+
stylistic,
|
|
491
|
+
...typescript === "engine" ? { typescript: { tsconfigPath: node_path.default.resolve(node_process.default.cwd(), "tsconfig.json") } } : typescript
|
|
483
492
|
}, {
|
|
484
493
|
name: "siberiacancode/rewrite",
|
|
485
494
|
rules: {
|
|
@@ -487,6 +496,7 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
487
496
|
"antfu/if-newline": "off",
|
|
488
497
|
"antfu/top-level-function": "off",
|
|
489
498
|
"no-console": "warn",
|
|
499
|
+
"react/prefer-namespace-import": "off",
|
|
490
500
|
"react-hooks/exhaustive-deps": "off",
|
|
491
501
|
"test/prefer-lowercase-title": "off"
|
|
492
502
|
}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -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;
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -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;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,8 +2,9 @@ import antfu from "@antfu/eslint-config";
|
|
|
2
2
|
import pluginCss from "@eslint/css";
|
|
3
3
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
4
|
import pluginPlaywright from "eslint-plugin-playwright";
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
import fs from "node:fs";
|
|
7
8
|
|
|
8
9
|
//#region src/plugin/rules/function-component-definition.ts
|
|
9
10
|
const NAMED_TEMPLATES = {
|
|
@@ -357,15 +358,22 @@ const siberiacancodePlugin = {
|
|
|
357
358
|
|
|
358
359
|
//#endregion
|
|
359
360
|
//#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
361
|
const eslint = (inputOptions = {}, ...configs) => {
|
|
366
|
-
const { jsxA11y = false, playwright = false, ...options } = inputOptions;
|
|
367
|
-
const
|
|
368
|
-
|
|
362
|
+
const { jsxA11y = false, playwright = false, typescript = false, ...options } = inputOptions;
|
|
363
|
+
const stylistic = options.stylistic ?? false;
|
|
364
|
+
if (typescript === "engine") configs.unshift({
|
|
365
|
+
name: "siberiacancode/typescript",
|
|
366
|
+
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
|
367
|
+
rules: {
|
|
368
|
+
"ts/promise-function-async": "off",
|
|
369
|
+
"ts/strict-boolean-expressions": "off",
|
|
370
|
+
"ts/no-unnecessary-condition": "error",
|
|
371
|
+
"ts/no-namespace": "off",
|
|
372
|
+
"ts/no-floating-promises": "off",
|
|
373
|
+
"ts/no-misused-promises": "off",
|
|
374
|
+
"ts/no-empty-object-type": "warn"
|
|
375
|
+
}
|
|
376
|
+
});
|
|
369
377
|
if (jsxA11y) {
|
|
370
378
|
const jsxA11yRules = pluginJsxA11y.flatConfigs.recommended.rules;
|
|
371
379
|
configs.unshift({
|
|
@@ -426,14 +434,6 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
426
434
|
"style/semi": ["error", "always"]
|
|
427
435
|
}
|
|
428
436
|
});
|
|
429
|
-
configs.unshift({
|
|
430
|
-
name: "siberiacancode",
|
|
431
|
-
plugins: { siberiacancode: siberiacancodePlugin },
|
|
432
|
-
rules: {
|
|
433
|
-
"siberiacancode/function-component-definition": ["error", { namedComponents: ["arrow-function"] }],
|
|
434
|
-
"siberiacancode/no-unused-class": "error"
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
437
|
configs.unshift({
|
|
438
438
|
name: "siberiacancode/css",
|
|
439
439
|
plugins: { "siberiacancode-css": pluginCss },
|
|
@@ -442,10 +442,18 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
442
442
|
return acc;
|
|
443
443
|
}, {}) }
|
|
444
444
|
});
|
|
445
|
+
configs.unshift({
|
|
446
|
+
name: "siberiacancode",
|
|
447
|
+
plugins: { siberiacancode: siberiacancodePlugin },
|
|
448
|
+
rules: {
|
|
449
|
+
"siberiacancode/function-component-definition": ["error", { namedComponents: ["arrow-function"] }],
|
|
450
|
+
"siberiacancode/no-unused-class": "error"
|
|
451
|
+
}
|
|
452
|
+
});
|
|
445
453
|
return antfu({
|
|
446
454
|
...options,
|
|
447
|
-
|
|
448
|
-
|
|
455
|
+
stylistic,
|
|
456
|
+
...typescript === "engine" ? { typescript: { tsconfigPath: path.resolve(process.cwd(), "tsconfig.json") } } : typescript
|
|
449
457
|
}, {
|
|
450
458
|
name: "siberiacancode/rewrite",
|
|
451
459
|
rules: {
|
|
@@ -453,6 +461,7 @@ const eslint = (inputOptions = {}, ...configs) => {
|
|
|
453
461
|
"antfu/if-newline": "off",
|
|
454
462
|
"antfu/top-level-function": "off",
|
|
455
463
|
"no-console": "warn",
|
|
464
|
+
"react/prefer-namespace-import": "off",
|
|
456
465
|
"react-hooks/exhaustive-deps": "off",
|
|
457
466
|
"test/prefer-lowercase-title": "off"
|
|
458
467
|
}
|