@agilebot/eslint-config 0.4.1 → 0.4.3
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 +1 -1
- package/dist/index.js +28 -18
- package/package.json +3 -4
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.4.
|
2
|
+
* @license @agilebot/eslint-config v0.4.3
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -335,7 +335,7 @@ function imports(opts) {
|
|
335
335
|
noUselessIndex: true
|
336
336
|
}
|
337
337
|
],
|
338
|
-
"import-x/no-cycle": "error",
|
338
|
+
"import-x/no-cycle": (0, import_eslint_utils2.isInEditor)() ? "off" : "error",
|
339
339
|
"import-x/newline-after-import": "error",
|
340
340
|
"import-x/first": "error",
|
341
341
|
"import-x/no-import-module-exports": "error",
|
@@ -455,20 +455,13 @@ function react(opts) {
|
|
455
455
|
"@eslint-react",
|
456
456
|
"react-hooks",
|
457
457
|
"jsx-a11y",
|
458
|
-
"@stylistic"
|
458
|
+
"@stylistic",
|
459
|
+
"@agilebot"
|
459
460
|
],
|
460
461
|
extends: ["plugin:jsx-a11y/recommended"],
|
461
462
|
rules: {
|
462
463
|
// recommended rules from eslint-plugin-react
|
463
|
-
"react/jsx-no-duplicate-props": "error",
|
464
|
-
"react/jsx-no-undef": "error",
|
465
|
-
"react/jsx-uses-react": "error",
|
466
|
-
"react/jsx-uses-vars": "error",
|
467
464
|
"react/no-is-mounted": "error",
|
468
|
-
"react/no-unescaped-entities": "error",
|
469
|
-
"react/no-unknown-property": "error",
|
470
|
-
"react/react-in-jsx-scope": "error",
|
471
|
-
"react/require-render-return": "error",
|
472
465
|
// recommended rules from @eslint-react
|
473
466
|
"@eslint-react/no-direct-mutation-state": "error",
|
474
467
|
// Children API
|
@@ -504,6 +497,8 @@ function react(opts) {
|
|
504
497
|
"@eslint-react/no-access-state-in-setstate": "error",
|
505
498
|
"@eslint-react/prefer-shorthand-fragment": "error",
|
506
499
|
"@eslint-react/no-missing-component-display-name": "error",
|
500
|
+
"@eslint-react/no-prop-types": "error",
|
501
|
+
"@eslint-react/no-useless-fragment": "error",
|
507
502
|
// recommended rules from @eslint-react/dom
|
508
503
|
"@eslint-react/dom/no-children-in-void-dom-elements": "error",
|
509
504
|
"@eslint-react/dom/no-unsafe-target-blank": "error",
|
@@ -514,7 +509,7 @@ function react(opts) {
|
|
514
509
|
// recommended rules from @eslint-react/hooks-extra
|
515
510
|
"@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
516
511
|
// recommended rules react-hooks
|
517
|
-
"react-
|
512
|
+
"@agilebot/react-rules-of-hooks": "error",
|
518
513
|
// recommended rules from @eslint-react/naming-convention
|
519
514
|
"@eslint-react/naming-convention/component-name": "error",
|
520
515
|
"@eslint-react/naming-convention/use-state": "error",
|
@@ -531,8 +526,11 @@ function react(opts) {
|
|
531
526
|
checkLocalVariables: true
|
532
527
|
}
|
533
528
|
],
|
529
|
+
"react/no-unused-prop-types": "error",
|
530
|
+
// Stylistic rules are not supported by @eslint-react. Use dprint or @stylistic instead.
|
531
|
+
"@stylistic/jsx-self-closing-comp": "error",
|
534
532
|
// <App prop={'Hello'} />没必要,使用<App prop="Hello" />
|
535
|
-
"
|
533
|
+
"@stylistic/jsx-curly-brace-presence": [
|
536
534
|
"error",
|
537
535
|
{
|
538
536
|
props: "never",
|
@@ -540,10 +538,6 @@ function react(opts) {
|
|
540
538
|
propElementValues: "always"
|
541
539
|
}
|
542
540
|
],
|
543
|
-
// 禁止声明未使用的props
|
544
|
-
"react/no-unused-prop-types": "error",
|
545
|
-
"@eslint-react/no-useless-fragment": "error",
|
546
|
-
"@stylistic/jsx-self-closing-comp": "error",
|
547
541
|
"jsx-a11y/click-events-have-key-events": "off",
|
548
542
|
"jsx-a11y/no-static-element-interactions": "off",
|
549
543
|
"jsx-a11y/alt-text": "off"
|
@@ -555,6 +549,21 @@ function react(opts) {
|
|
555
549
|
}
|
556
550
|
};
|
557
551
|
}
|
552
|
+
function reactJsOnly() {
|
553
|
+
return {
|
554
|
+
rules: {
|
555
|
+
// The following can be enforced by TypeScript, no need to implement them
|
556
|
+
"react/jsx-no-duplicate-props": "error",
|
557
|
+
"react/jsx-no-undef": "error",
|
558
|
+
"react/jsx-uses-react": "error",
|
559
|
+
"react/jsx-uses-vars": "error",
|
560
|
+
"react/no-unescaped-entities": "error",
|
561
|
+
"react/no-unknown-property": "error",
|
562
|
+
"react/react-in-jsx-scope": "error",
|
563
|
+
"react/require-render-return": "error"
|
564
|
+
}
|
565
|
+
};
|
566
|
+
}
|
558
567
|
|
559
568
|
// src/configs/vue.ts
|
560
569
|
function vue(opts) {
|
@@ -843,7 +852,8 @@ function factory(root, options) {
|
|
843
852
|
jsOnly(),
|
844
853
|
(options == null ? void 0 : options.jsdoc) ? jsdoc({
|
845
854
|
ts: false
|
846
|
-
}) : {}
|
855
|
+
}) : {},
|
856
|
+
(options == null ? void 0 : options.react) ? reactJsOnly() : {}
|
847
857
|
)),
|
848
858
|
__spreadValues({
|
849
859
|
files: TS_EXTS.map((ext) => `*${ext}`)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-config",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.3",
|
4
4
|
"description": "Agilebot's ESLint config",
|
5
5
|
"bin": {
|
6
6
|
"eslint-agilebot": "bin/eslint-agilebot"
|
@@ -38,20 +38,19 @@
|
|
38
38
|
"eslint-plugin-prettier": "^5.2.1",
|
39
39
|
"eslint-plugin-promise": "^7.1.0",
|
40
40
|
"eslint-plugin-react": "^7.35.0",
|
41
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
42
41
|
"eslint-plugin-unicorn": "^55.0.0",
|
43
42
|
"eslint-plugin-unused-imports": "^4.1.3",
|
44
43
|
"eslint-plugin-vue": "^9.27.0",
|
45
44
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
46
45
|
"vue-eslint-parser": "^9.4.3",
|
47
|
-
"@agilebot/eslint-utils": "0.4.
|
46
|
+
"@agilebot/eslint-utils": "0.4.3"
|
48
47
|
},
|
49
48
|
"devDependencies": {
|
50
49
|
"eslint-config-love": "^63.0.0"
|
51
50
|
},
|
52
51
|
"peerDependencies": {
|
53
52
|
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
54
|
-
"@agilebot/eslint-plugin": "0.4.
|
53
|
+
"@agilebot/eslint-plugin": "0.4.3"
|
55
54
|
},
|
56
55
|
"files": [
|
57
56
|
"bin",
|