@agilebot/eslint-config 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +9 -9
- 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.d.ts +1 -0
- package/dist/index.js +75 -34
- package/package.json +7 -3
package/LICENSE
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2024 Agilebot, Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Agilebot, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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.d.ts
CHANGED
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
|
}
|
@@ -280,7 +304,8 @@ function eslintImport(opts) {
|
|
280
304
|
typescript: {
|
281
305
|
alwaysTryTypes: true
|
282
306
|
}
|
283
|
-
}
|
307
|
+
},
|
308
|
+
"import/internal-regex": opts.monorepoScope ? `^${opts.monorepoScope.replaceAll("/", "")}/` : void 0
|
284
309
|
}
|
285
310
|
};
|
286
311
|
}
|
@@ -292,7 +317,7 @@ function unicorn(opts) {
|
|
292
317
|
extends: ["plugin:unicorn/recommended"],
|
293
318
|
rules: {
|
294
319
|
"unicorn/prefer-module": opts.module ? "error" : "off",
|
295
|
-
"unicorn/prefer-top-level-await":
|
320
|
+
"unicorn/prefer-top-level-await": "off",
|
296
321
|
"unicorn/filename-case": "off",
|
297
322
|
"unicorn/import-style": "off",
|
298
323
|
"unicorn/prefer-at": "off",
|
@@ -479,13 +504,13 @@ function cspell(opts) {
|
|
479
504
|
}
|
480
505
|
|
481
506
|
// src/configs/agilebot.ts
|
482
|
-
function agilebot() {
|
507
|
+
function agilebot(opts) {
|
483
508
|
return {
|
484
509
|
extends: ["plugin:@agilebot/recommended"],
|
485
510
|
plugins: ["react-hooks"],
|
486
511
|
rules: {
|
487
512
|
"react-hooks/exhaustive-deps": "off",
|
488
|
-
"@agilebot/react
|
513
|
+
"@agilebot/react-better-exhaustive-deps": [
|
489
514
|
"warn",
|
490
515
|
{
|
491
516
|
checkMemoizedVariableIsStatic: true,
|
@@ -504,6 +529,13 @@ function agilebot() {
|
|
504
529
|
}
|
505
530
|
}
|
506
531
|
]
|
532
|
+
},
|
533
|
+
settings: {
|
534
|
+
"agilebot/project-root": opts.root,
|
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
|
507
539
|
}
|
508
540
|
};
|
509
541
|
}
|
@@ -541,35 +573,41 @@ function godaddy() {
|
|
541
573
|
"max-depth": "off",
|
542
574
|
"no-undefined": "off",
|
543
575
|
"no-process-env": "off",
|
544
|
-
"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"
|
545
581
|
}
|
546
582
|
};
|
547
583
|
}
|
548
584
|
|
549
585
|
// src/factory.ts
|
550
586
|
function factory(root, options) {
|
587
|
+
var _a, _b, _c, _d;
|
551
588
|
import_node_assert.default.ok(root, "root option is required");
|
552
589
|
const commonConfigs = [
|
553
590
|
unicorn({
|
554
|
-
module: options
|
591
|
+
module: (_a = options == null ? void 0 : options.module) != null ? _a : false
|
555
592
|
}),
|
556
593
|
eslint(),
|
557
594
|
eslintImport({
|
558
595
|
packageDir: root,
|
559
|
-
devDependencies: options
|
596
|
+
devDependencies: options == null ? void 0 : options.devDependencies,
|
597
|
+
monorepoScope: options == null ? void 0 : options.monorepoScope
|
560
598
|
}),
|
561
599
|
prettier()
|
562
600
|
];
|
563
|
-
if (options
|
601
|
+
if (options == null ? void 0 : options.godaddy) {
|
564
602
|
return (0, import_eslint_utils3.mergeESLintConfig)(
|
565
603
|
godaddy(),
|
566
604
|
...commonConfigs,
|
567
|
-
options
|
605
|
+
(_b = options == null ? void 0 : options.config) != null ? _b : {}
|
568
606
|
);
|
569
607
|
}
|
570
608
|
const config = {
|
571
609
|
overrides: [
|
572
|
-
{
|
610
|
+
__spreadValues({
|
573
611
|
files: [
|
574
612
|
"*.ts",
|
575
613
|
"*.tsx",
|
@@ -581,31 +619,34 @@ function factory(root, options) {
|
|
581
619
|
"*.mjs",
|
582
620
|
"*.vue"
|
583
621
|
],
|
584
|
-
parser: !options
|
622
|
+
parser: !(options == null ? void 0 : options.vue) ? "@typescript-eslint/parser" : "vue-eslint-parser",
|
585
623
|
parserOptions: {
|
586
624
|
parser: "@typescript-eslint/parser",
|
587
|
-
tsconfigRootDir: root
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
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
|
+
)),
|
609
650
|
{
|
610
651
|
files: ["*.ts", "*.tsx"],
|
611
652
|
rules: {
|
package/package.json
CHANGED
@@ -1,8 +1,11 @@
|
|
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
|
-
"
|
5
|
+
"bin": {
|
6
|
+
"eslint-agilebot": "bin/eslint-agilebot"
|
7
|
+
},
|
8
|
+
"main": "dist/index.js",
|
6
9
|
"types": "dist/index.d.ts",
|
7
10
|
"license": "MIT",
|
8
11
|
"keywords": [
|
@@ -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": {
|