@agilebot/eslint-config 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.4.1
2
+ * @license @agilebot/eslint-config v0.4.2
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.4.1
2
+ * @license @agilebot/eslint-config v0.4.2
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",
@@ -460,15 +460,7 @@ function react(opts) {
460
460
  extends: ["plugin:jsx-a11y/recommended"],
461
461
  rules: {
462
462
  // 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
463
  "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
464
  // recommended rules from @eslint-react
473
465
  "@eslint-react/no-direct-mutation-state": "error",
474
466
  // Children API
@@ -504,6 +496,8 @@ function react(opts) {
504
496
  "@eslint-react/no-access-state-in-setstate": "error",
505
497
  "@eslint-react/prefer-shorthand-fragment": "error",
506
498
  "@eslint-react/no-missing-component-display-name": "error",
499
+ "@eslint-react/no-prop-types": "error",
500
+ "@eslint-react/no-useless-fragment": "error",
507
501
  // recommended rules from @eslint-react/dom
508
502
  "@eslint-react/dom/no-children-in-void-dom-elements": "error",
509
503
  "@eslint-react/dom/no-unsafe-target-blank": "error",
@@ -531,8 +525,11 @@ function react(opts) {
531
525
  checkLocalVariables: true
532
526
  }
533
527
  ],
528
+ "react/no-unused-prop-types": "error",
529
+ // Stylistic rules are not supported by @eslint-react. Use dprint or @stylistic instead.
530
+ "@stylistic/jsx-self-closing-comp": "error",
534
531
  // <App prop={'Hello'} />没必要,使用<App prop="Hello" />
535
- "react/jsx-curly-brace-presence": [
532
+ "@stylistic/jsx-curly-brace-presence": [
536
533
  "error",
537
534
  {
538
535
  props: "never",
@@ -540,10 +537,6 @@ function react(opts) {
540
537
  propElementValues: "always"
541
538
  }
542
539
  ],
543
- // 禁止声明未使用的props
544
- "react/no-unused-prop-types": "error",
545
- "@eslint-react/no-useless-fragment": "error",
546
- "@stylistic/jsx-self-closing-comp": "error",
547
540
  "jsx-a11y/click-events-have-key-events": "off",
548
541
  "jsx-a11y/no-static-element-interactions": "off",
549
542
  "jsx-a11y/alt-text": "off"
@@ -555,6 +548,21 @@ function react(opts) {
555
548
  }
556
549
  };
557
550
  }
551
+ function reactJsOnly() {
552
+ return {
553
+ rules: {
554
+ // The following can be enforced by TypeScript, no need to implement them
555
+ "react/jsx-no-duplicate-props": "error",
556
+ "react/jsx-no-undef": "error",
557
+ "react/jsx-uses-react": "error",
558
+ "react/jsx-uses-vars": "error",
559
+ "react/no-unescaped-entities": "error",
560
+ "react/no-unknown-property": "error",
561
+ "react/react-in-jsx-scope": "error",
562
+ "react/require-render-return": "error"
563
+ }
564
+ };
565
+ }
558
566
 
559
567
  // src/configs/vue.ts
560
568
  function vue(opts) {
@@ -843,7 +851,8 @@ function factory(root, options) {
843
851
  jsOnly(),
844
852
  (options == null ? void 0 : options.jsdoc) ? jsdoc({
845
853
  ts: false
846
- }) : {}
854
+ }) : {},
855
+ (options == null ? void 0 : options.react) ? reactJsOnly() : {}
847
856
  )),
848
857
  __spreadValues({
849
858
  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.1",
3
+ "version": "0.4.2",
4
4
  "description": "Agilebot's ESLint config",
5
5
  "bin": {
6
6
  "eslint-agilebot": "bin/eslint-agilebot"
@@ -44,14 +44,14 @@
44
44
  "eslint-plugin-vue": "^9.27.0",
45
45
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
46
46
  "vue-eslint-parser": "^9.4.3",
47
- "@agilebot/eslint-utils": "0.4.1"
47
+ "@agilebot/eslint-utils": "0.4.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "eslint-config-love": "^63.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
54
- "@agilebot/eslint-plugin": "0.4.1"
54
+ "@agilebot/eslint-plugin": "0.4.2"
55
55
  },
56
56
  "files": [
57
57
  "bin",