@fullstacksjs/eslint-config 13.6.0 → 13.7.0

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.
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
8
8
  var _eslintPluginJsxA11y = _interopRequireDefault(require("eslint-plugin-jsx-a11y"));
9
9
  var _eslintPluginReactHooks = _interopRequireDefault(require("eslint-plugin-react-hooks"));
10
+ var _conditions = require("../utils/conditions.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /** @return { import('eslint').Linter.Config } */
12
13
  function react(options = {}) {
14
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
13
15
  return {
14
16
  plugins: {
15
17
  ..._eslintPlugin.default.configs.all.plugins,
@@ -86,7 +88,9 @@ function react(options = {}) {
86
88
  '@eslint-react/no-unstable-default-props': 'error',
87
89
  '@eslint-react/no-unused-class-component-members': 'warn',
88
90
  '@eslint-react/no-unused-state': 'warn',
89
- '@eslint-react/no-unused-props': 'off',
91
+ ...(0, _conditions.predicate)(projectService, {
92
+ '@eslint-react/no-unused-props': 'warn'
93
+ }),
90
94
  '@eslint-react/no-useless-forward-ref': 'off',
91
95
  '@eslint-react/no-useless-fragment': 'warn',
92
96
  '@eslint-react/no-use-context': 'warn',
@@ -63,8 +63,6 @@ function typescript(options = {}) {
63
63
  prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'enable', 'loading']
64
64
  }] : [])],
65
65
  '@typescript-eslint/no-array-constructor': 'error',
66
- '@typescript-eslint/no-base-to-string': 'off',
67
- // false negative
68
66
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
69
67
  '@typescript-eslint/no-dupe-class-members': 'error',
70
68
  '@typescript-eslint/no-duplicate-enum-values': 'error',
@@ -171,6 +169,7 @@ function typescript(options = {}) {
171
169
  allowProtectedClassPropertyAccess: false,
172
170
  allowIndexSignaturePropertyAccess: true
173
171
  }],
172
+ '@typescript-eslint/no-base-to-string': 'error',
174
173
  '@typescript-eslint/no-confusing-void-expression': ['off', {
175
174
  ignoreArrowShorthand: true,
176
175
  ignoreVoidOperator: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "13.6.0",
3
+ "version": "13.7.0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -2,8 +2,12 @@ import reactPlugin from '@eslint-react/eslint-plugin';
2
2
  import a11yPlugin from 'eslint-plugin-jsx-a11y';
3
3
  import hooksPlugin from 'eslint-plugin-react-hooks';
4
4
 
5
+ import { predicate } from '../utils/conditions.mjs';
6
+
5
7
  /** @return { import('eslint').Linter.Config } */
6
8
  function react(options = {}) {
9
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
10
+
7
11
  return {
8
12
  plugins: {
9
13
  ...reactPlugin.configs.all.plugins,
@@ -82,7 +86,9 @@ function react(options = {}) {
82
86
  '@eslint-react/no-unstable-default-props': 'error',
83
87
  '@eslint-react/no-unused-class-component-members': 'warn',
84
88
  '@eslint-react/no-unused-state': 'warn',
85
- '@eslint-react/no-unused-props': 'off',
89
+ ...predicate(projectService, {
90
+ '@eslint-react/no-unused-props': 'warn',
91
+ }),
86
92
  '@eslint-react/no-useless-forward-ref': 'off',
87
93
  '@eslint-react/no-useless-fragment': 'warn',
88
94
  '@eslint-react/no-use-context': 'warn',
@@ -68,7 +68,6 @@ function typescript(options = {}) {
68
68
  : []),
69
69
  ],
70
70
  '@typescript-eslint/no-array-constructor': 'error',
71
- '@typescript-eslint/no-base-to-string': 'off', // false negative
72
71
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
73
72
  '@typescript-eslint/no-dupe-class-members': 'error',
74
73
  '@typescript-eslint/no-duplicate-enum-values': 'error',
@@ -156,6 +155,7 @@ function typescript(options = {}) {
156
155
  allowIndexSignaturePropertyAccess: true,
157
156
  },
158
157
  ],
158
+ '@typescript-eslint/no-base-to-string': 'error',
159
159
  '@typescript-eslint/no-confusing-void-expression': ['off', { ignoreArrowShorthand: true, ignoreVoidOperator: true }], // Annoying and conflict with @typescript-eslint/no-meaningless-void-operator
160
160
  '@typescript-eslint/no-duplicate-type-constituents': 'warn',
161
161
  '@typescript-eslint/no-for-in-array': 'error',