@agilebot/eslint-config 0.2.3 → 0.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/README.md +1 -2
- package/bin/eslint-agilebot +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +90 -0
- package/dist/index.js +68 -36
- package/package.json +6 -2
package/README.md
CHANGED
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @agilebot/eslint-config v0.2.4
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
var __create = Object.create;
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
|
|
39
|
+
// src/cli.ts
|
|
40
|
+
var cli_exports = {};
|
|
41
|
+
__export(cli_exports, {
|
|
42
|
+
cli: () => cli
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(cli_exports);
|
|
45
|
+
var import_node_fs = __toESM(require("fs"));
|
|
46
|
+
var import_node_path = __toESM(require("path"));
|
|
47
|
+
function cli() {
|
|
48
|
+
const isEslint = /^\.eslint.*/;
|
|
49
|
+
const cwd = process.cwd();
|
|
50
|
+
const has = {
|
|
51
|
+
ext: false,
|
|
52
|
+
fix: false,
|
|
53
|
+
config: false
|
|
54
|
+
};
|
|
55
|
+
process.argv.forEach((arg) => {
|
|
56
|
+
has.ext = has.ext || arg === "--ext";
|
|
57
|
+
has.fix = has.fix || arg === "--fix";
|
|
58
|
+
has.config = has.config || arg === "-c" || arg === "--config";
|
|
59
|
+
});
|
|
60
|
+
if (!has.fix) {
|
|
61
|
+
process.argv.splice(2, 0, "--fix");
|
|
62
|
+
}
|
|
63
|
+
if (!has.ext) {
|
|
64
|
+
process.argv.splice(
|
|
65
|
+
2,
|
|
66
|
+
0,
|
|
67
|
+
"--ext",
|
|
68
|
+
".js,.jsx,.ts,.tsx,.cjs,.mjs,.cts,.mts,.vue"
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
import_node_fs.default.readdir(cwd, (err, files) => {
|
|
72
|
+
if (err) {
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
has.config = has.config || files.some((file) => {
|
|
76
|
+
return isEslint.test(file);
|
|
77
|
+
});
|
|
78
|
+
if (!has.config) {
|
|
79
|
+
throw new Error("No ESLint configuration file found");
|
|
80
|
+
}
|
|
81
|
+
const pkg = require.resolve("eslint/package.json");
|
|
82
|
+
const bin = import_node_path.default.join(pkg, "..", "bin", "eslint.js");
|
|
83
|
+
require(bin);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
cli
|
|
89
|
+
});
|
|
90
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @agilebot/eslint-config v0.2.4
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
"use strict";
|
|
2
11
|
var __create = Object.create;
|
|
3
12
|
var __defProp = Object.defineProperty;
|
|
4
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
14
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
16
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
17
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
8
31
|
var __export = (target, all) => {
|
|
9
32
|
for (var name in all)
|
|
10
33
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -182,6 +205,7 @@ var import_node_path = __toESM(require("path"));
|
|
|
182
205
|
var import_node_fs = __toESM(require("fs"));
|
|
183
206
|
var import_eslint_utils = require("@agilebot/eslint-utils");
|
|
184
207
|
function eslintImport(opts) {
|
|
208
|
+
var _a;
|
|
185
209
|
const rootDir = (0, import_eslint_utils.findRootDir)(__dirname);
|
|
186
210
|
const pkgPath = import_node_path.default.join(opts.packageDir, "package.json");
|
|
187
211
|
if (!import_node_fs.default.existsSync(pkgPath)) {
|
|
@@ -239,7 +263,7 @@ function eslintImport(opts) {
|
|
|
239
263
|
"**/.storybook/**",
|
|
240
264
|
"**/*.stories.{ts,tsx}",
|
|
241
265
|
"**/scripts/*.{ts,mts}",
|
|
242
|
-
...opts.devDependencies
|
|
266
|
+
...(_a = opts.devDependencies) != null ? _a : []
|
|
243
267
|
],
|
|
244
268
|
includeInternal: true
|
|
245
269
|
}
|
|
@@ -486,7 +510,7 @@ function agilebot(opts) {
|
|
|
486
510
|
plugins: ["react-hooks"],
|
|
487
511
|
rules: {
|
|
488
512
|
"react-hooks/exhaustive-deps": "off",
|
|
489
|
-
"@agilebot/react
|
|
513
|
+
"@agilebot/react-better-exhaustive-deps": [
|
|
490
514
|
"warn",
|
|
491
515
|
{
|
|
492
516
|
checkMemoizedVariableIsStatic: true,
|
|
@@ -508,7 +532,10 @@ function agilebot(opts) {
|
|
|
508
532
|
},
|
|
509
533
|
settings: {
|
|
510
534
|
"agilebot/project-root": opts.root,
|
|
511
|
-
"agilebot/monorepo-scope": opts.monorepoScope ?
|
|
535
|
+
"agilebot/monorepo-scope": opts.monorepoScope ? (
|
|
536
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all -- not supported in Node.js 12
|
|
537
|
+
opts.monorepoScope.replace(/\//g, "")
|
|
538
|
+
) : void 0
|
|
512
539
|
}
|
|
513
540
|
};
|
|
514
541
|
}
|
|
@@ -546,36 +573,41 @@ function godaddy() {
|
|
|
546
573
|
"max-depth": "off",
|
|
547
574
|
"no-undefined": "off",
|
|
548
575
|
"no-process-env": "off",
|
|
549
|
-
"no-sync": "off"
|
|
576
|
+
"no-sync": "off",
|
|
577
|
+
"no-continue": "off",
|
|
578
|
+
"no-case-declarations": "off",
|
|
579
|
+
"unicorn/prefer-string-slice": "off",
|
|
580
|
+
"unicorn/prefer-string-replace-all": "off"
|
|
550
581
|
}
|
|
551
582
|
};
|
|
552
583
|
}
|
|
553
584
|
|
|
554
585
|
// src/factory.ts
|
|
555
586
|
function factory(root, options) {
|
|
587
|
+
var _a, _b, _c, _d;
|
|
556
588
|
import_node_assert.default.ok(root, "root option is required");
|
|
557
589
|
const commonConfigs = [
|
|
558
590
|
unicorn({
|
|
559
|
-
module: options
|
|
591
|
+
module: (_a = options == null ? void 0 : options.module) != null ? _a : false
|
|
560
592
|
}),
|
|
561
593
|
eslint(),
|
|
562
594
|
eslintImport({
|
|
563
595
|
packageDir: root,
|
|
564
|
-
devDependencies: options
|
|
565
|
-
monorepoScope: options
|
|
596
|
+
devDependencies: options == null ? void 0 : options.devDependencies,
|
|
597
|
+
monorepoScope: options == null ? void 0 : options.monorepoScope
|
|
566
598
|
}),
|
|
567
599
|
prettier()
|
|
568
600
|
];
|
|
569
|
-
if (options
|
|
601
|
+
if (options == null ? void 0 : options.godaddy) {
|
|
570
602
|
return (0, import_eslint_utils3.mergeESLintConfig)(
|
|
571
603
|
godaddy(),
|
|
572
604
|
...commonConfigs,
|
|
573
|
-
options
|
|
605
|
+
(_b = options == null ? void 0 : options.config) != null ? _b : {}
|
|
574
606
|
);
|
|
575
607
|
}
|
|
576
608
|
const config = {
|
|
577
609
|
overrides: [
|
|
578
|
-
{
|
|
610
|
+
__spreadValues({
|
|
579
611
|
files: [
|
|
580
612
|
"*.ts",
|
|
581
613
|
"*.tsx",
|
|
@@ -587,34 +619,34 @@ function factory(root, options) {
|
|
|
587
619
|
"*.mjs",
|
|
588
620
|
"*.vue"
|
|
589
621
|
],
|
|
590
|
-
parser: !options
|
|
622
|
+
parser: !(options == null ? void 0 : options.vue) ? "@typescript-eslint/parser" : "vue-eslint-parser",
|
|
591
623
|
parserOptions: {
|
|
592
624
|
parser: "@typescript-eslint/parser",
|
|
593
|
-
tsconfigRootDir: root
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
)
|
|
617
|
-
|
|
625
|
+
tsconfigRootDir: root,
|
|
626
|
+
extraFileExtensions: !(options == null ? void 0 : options.vue) ? void 0 : [".vue"]
|
|
627
|
+
}
|
|
628
|
+
}, (0, import_eslint_utils3.mergeESLintConfig)(
|
|
629
|
+
env(),
|
|
630
|
+
standard(),
|
|
631
|
+
ts(),
|
|
632
|
+
promise(),
|
|
633
|
+
(options == null ? void 0 : options.react) ? react() : {},
|
|
634
|
+
(options == null ? void 0 : options.vue) ? vue({
|
|
635
|
+
version: options.vue
|
|
636
|
+
}) : {},
|
|
637
|
+
jsdoc(),
|
|
638
|
+
lodash(),
|
|
639
|
+
deprecation(),
|
|
640
|
+
cspell({
|
|
641
|
+
words: (_c = options == null ? void 0 : options.cspellWords) != null ? _c : []
|
|
642
|
+
}),
|
|
643
|
+
...commonConfigs,
|
|
644
|
+
agilebot({
|
|
645
|
+
root,
|
|
646
|
+
monorepoScope: options == null ? void 0 : options.monorepoScope
|
|
647
|
+
}),
|
|
648
|
+
(_d = options == null ? void 0 : options.config) != null ? _d : {}
|
|
649
|
+
)),
|
|
618
650
|
{
|
|
619
651
|
files: ["*.ts", "*.tsx"],
|
|
620
652
|
rules: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agilebot/eslint-config",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Agilebot's ESLint config",
|
|
5
|
+
"bin": {
|
|
6
|
+
"eslint-agilebot": "bin/eslint-agilebot"
|
|
7
|
+
},
|
|
5
8
|
"main": "dist/index.js",
|
|
6
9
|
"types": "dist/index.d.ts",
|
|
7
10
|
"license": "MIT",
|
|
@@ -40,13 +43,14 @@
|
|
|
40
43
|
"eslint-plugin-vue": "^9.25.0",
|
|
41
44
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
|
42
45
|
"fast-glob": "^3.3.2",
|
|
43
|
-
"@agilebot/eslint-utils": "0.2.
|
|
46
|
+
"@agilebot/eslint-utils": "0.2.4"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
49
|
"@agilebot/eslint-plugin": "*",
|
|
47
50
|
"eslint": "^7.0.0 || ^8.0.0"
|
|
48
51
|
},
|
|
49
52
|
"files": [
|
|
53
|
+
"bin",
|
|
50
54
|
"dist"
|
|
51
55
|
],
|
|
52
56
|
"scripts": {
|