@agilebot/eslint-config 0.2.4 → 0.2.5
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/cli.js +36 -7
- package/dist/index.js +18 -10
- package/package.json +5 -4
package/dist/cli.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.2.
|
2
|
+
* @license @agilebot/eslint-config v0.2.5
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -42,32 +42,63 @@ __export(cli_exports, {
|
|
42
42
|
cli: () => cli
|
43
43
|
});
|
44
44
|
module.exports = __toCommonJS(cli_exports);
|
45
|
+
|
46
|
+
// src/cli/index.ts
|
45
47
|
var import_node_fs = __toESM(require("fs"));
|
46
48
|
var import_node_path = __toESM(require("path"));
|
49
|
+
var import_eslint_utils = require("@agilebot/eslint-utils");
|
50
|
+
|
51
|
+
// src/cli/constants.ts
|
52
|
+
var defaultExtensions = [
|
53
|
+
".js",
|
54
|
+
".jsx",
|
55
|
+
".ts",
|
56
|
+
".tsx",
|
57
|
+
".cjs",
|
58
|
+
".mjs",
|
59
|
+
".cts",
|
60
|
+
".mts",
|
61
|
+
".vue"
|
62
|
+
];
|
63
|
+
var isEslint = /^\.eslint.*/;
|
64
|
+
|
65
|
+
// src/cli/index.ts
|
47
66
|
function cli() {
|
48
|
-
const isEslint = /^\.eslint.*/;
|
49
67
|
const cwd = process.cwd();
|
50
68
|
const has = {
|
51
69
|
ext: false,
|
52
70
|
fix: false,
|
53
|
-
config: false
|
71
|
+
config: false,
|
72
|
+
checkIntl: false
|
54
73
|
};
|
74
|
+
const pkg = require.resolve("eslint/package.json");
|
75
|
+
const bin = import_node_path.default.join(pkg, "..", "bin", "eslint.js");
|
55
76
|
process.argv.forEach((arg) => {
|
56
77
|
has.ext = has.ext || arg === "--ext";
|
57
78
|
has.fix = has.fix || arg === "--fix";
|
58
79
|
has.config = has.config || arg === "-c" || arg === "--config";
|
80
|
+
has.checkIntl = has.checkIntl || arg === "--check-intl";
|
59
81
|
});
|
60
82
|
if (!has.fix) {
|
61
83
|
process.argv.splice(2, 0, "--fix");
|
62
84
|
}
|
63
85
|
if (!has.ext) {
|
86
|
+
process.argv.splice(2, 0, "--ext", defaultExtensions.join(","));
|
87
|
+
}
|
88
|
+
if (!(0, import_eslint_utils.isCI)()) {
|
64
89
|
process.argv.splice(
|
65
90
|
2,
|
66
91
|
0,
|
67
|
-
"--
|
68
|
-
"
|
92
|
+
"--plugin",
|
93
|
+
"file-progress",
|
94
|
+
"--rule",
|
95
|
+
"file-progress/activate: 1"
|
69
96
|
);
|
70
97
|
}
|
98
|
+
if (has.checkIntl) {
|
99
|
+
process.argv.splice(process.argv.indexOf("--check-intl"), 1);
|
100
|
+
process.argv.splice(2, 0, "--rule", "@agilebot/intl-id-unused: 1");
|
101
|
+
}
|
71
102
|
import_node_fs.default.readdir(cwd, (err, files) => {
|
72
103
|
if (err) {
|
73
104
|
throw err;
|
@@ -78,8 +109,6 @@ function cli() {
|
|
78
109
|
if (!has.config) {
|
79
110
|
throw new Error("No ESLint configuration file found");
|
80
111
|
}
|
81
|
-
const pkg = require.resolve("eslint/package.json");
|
82
|
-
const bin = import_node_path.default.join(pkg, "..", "bin", "eslint.js");
|
83
112
|
require(bin);
|
84
113
|
});
|
85
114
|
}
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.2.
|
2
|
+
* @license @agilebot/eslint-config v0.2.5
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -59,7 +59,7 @@ module.exports = __toCommonJS(src_exports);
|
|
59
59
|
|
60
60
|
// src/factory.ts
|
61
61
|
var import_node_assert = __toESM(require("assert"));
|
62
|
-
var
|
62
|
+
var import_eslint_utils2 = require("@agilebot/eslint-utils");
|
63
63
|
var import_fast_glob = require("fast-glob");
|
64
64
|
|
65
65
|
// src/configs/env.ts
|
@@ -104,11 +104,21 @@ function standard() {
|
|
104
104
|
// src/configs/ts.ts
|
105
105
|
function ts() {
|
106
106
|
return {
|
107
|
-
plugins: ["@typescript-eslint", "@stylistic"],
|
107
|
+
plugins: ["@typescript-eslint", "@stylistic", "prefer-arrow-functions"],
|
108
108
|
rules: {
|
109
|
-
"@typescript-eslint/no-unused-vars": "warn",
|
110
109
|
// 如果没用模板字符串,避免使用反引号
|
111
110
|
"@stylistic/quotes": ["error", "single", { avoidEscape: true }],
|
111
|
+
"prefer-arrow-functions/prefer-arrow-functions": [
|
112
|
+
"warn",
|
113
|
+
{
|
114
|
+
allowNamedFunctions: true,
|
115
|
+
classPropertiesAllowed: false,
|
116
|
+
disallowPrototype: false,
|
117
|
+
returnStyle: "unchanged",
|
118
|
+
singleReturnOnly: false
|
119
|
+
}
|
120
|
+
],
|
121
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
112
122
|
// 优先使用interface而不是type
|
113
123
|
"@typescript-eslint/consistent-type-definitions": "error",
|
114
124
|
// The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings.
|
@@ -448,10 +458,9 @@ function lodash() {
|
|
448
458
|
}
|
449
459
|
|
450
460
|
// src/configs/eslint.ts
|
451
|
-
var import_eslint_utils2 = require("@agilebot/eslint-utils");
|
452
461
|
function eslint() {
|
453
462
|
return {
|
454
|
-
plugins: ["eslint-comments"
|
463
|
+
plugins: ["eslint-comments"],
|
455
464
|
rules: {
|
456
465
|
// 禁止未使用的eslint-disable注释
|
457
466
|
"eslint-comments/no-unused-disable": "error",
|
@@ -467,8 +476,7 @@ function eslint() {
|
|
467
476
|
{
|
468
477
|
ignore: ["eslint-env", "exported", "global", "globals"]
|
469
478
|
}
|
470
|
-
]
|
471
|
-
"file-progress/activate": (0, import_eslint_utils2.isCI)() ? "off" : "warn"
|
479
|
+
]
|
472
480
|
}
|
473
481
|
};
|
474
482
|
}
|
@@ -599,7 +607,7 @@ function factory(root, options) {
|
|
599
607
|
prettier()
|
600
608
|
];
|
601
609
|
if (options == null ? void 0 : options.godaddy) {
|
602
|
-
return (0,
|
610
|
+
return (0, import_eslint_utils2.mergeESLintConfig)(
|
603
611
|
godaddy(),
|
604
612
|
...commonConfigs,
|
605
613
|
(_b = options == null ? void 0 : options.config) != null ? _b : {}
|
@@ -625,7 +633,7 @@ function factory(root, options) {
|
|
625
633
|
tsconfigRootDir: root,
|
626
634
|
extraFileExtensions: !(options == null ? void 0 : options.vue) ? void 0 : [".vue"]
|
627
635
|
}
|
628
|
-
}, (0,
|
636
|
+
}, (0, import_eslint_utils2.mergeESLintConfig)(
|
629
637
|
env(),
|
630
638
|
standard(),
|
631
639
|
ts(),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-config",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.5",
|
4
4
|
"description": "Agilebot's ESLint config",
|
5
5
|
"bin": {
|
6
6
|
"eslint-agilebot": "bin/eslint-agilebot"
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
35
35
|
"eslint-plugin-n": "^17.2.0",
|
36
36
|
"eslint-plugin-no-relative-import-paths": "^1.5.4",
|
37
|
+
"eslint-plugin-prefer-arrow-functions": "^3.3.2",
|
37
38
|
"eslint-plugin-prettier": "^5.1.3",
|
38
39
|
"eslint-plugin-promise": "^6.0.0",
|
39
40
|
"eslint-plugin-react": "^7.34.1",
|
@@ -43,11 +44,11 @@
|
|
43
44
|
"eslint-plugin-vue": "^9.25.0",
|
44
45
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
45
46
|
"fast-glob": "^3.3.2",
|
46
|
-
"@agilebot/eslint-utils": "0.2.
|
47
|
+
"@agilebot/eslint-utils": "0.2.5"
|
47
48
|
},
|
48
49
|
"peerDependencies": {
|
49
|
-
"
|
50
|
-
"eslint": "
|
50
|
+
"eslint": "^7.0.0 || ^8.0.0",
|
51
|
+
"@agilebot/eslint-plugin": "0.2.5"
|
51
52
|
},
|
52
53
|
"files": [
|
53
54
|
"bin",
|