Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: christophehurpeau/eslint-config-pob
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v54.0.2
Choose a base ref
...
head repository: christophehurpeau/eslint-config-pob
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v55.0.0
Choose a head ref
  • 13 commits
  • 221 files changed
  • 3 contributors

Commits on Apr 9, 2024

  1. Copy the full SHA
    5a1d9dd View commit details

Commits on Apr 10, 2024

  1. Copy the full SHA
    a492e73 View commit details

Commits on Apr 11, 2024

  1. Copy the full SHA
    984f60b View commit details
  2. Copy the full SHA
    fe73ac8 View commit details

Commits on Apr 13, 2024

  1. Copy the full SHA
    1f68d46 View commit details

Commits on Apr 14, 2024

  1. Copy the full SHA
    4220bc1 View commit details
  2. Copy the full SHA
    6af8b5d View commit details
  3. Copy the full SHA
    05cd865 View commit details

Commits on Apr 15, 2024

  1. Copy the full SHA
    a5f6a43 View commit details

Commits on Apr 20, 2024

  1. Copy the full SHA
    295a348 View commit details
  2. Copy the full SHA
    4538052 View commit details
  3. Copy the full SHA
    c4f4813 View commit details
  4. Copy the full SHA
    c82ed6c View commit details
Showing with 2,713 additions and 675 deletions.
  1. +14 −0 @pob/eslint-config-typescript-react/CHANGELOG.md
  2. +3 −8 @pob/eslint-config-typescript-react/lib/index.js
  3. +6 −0 @pob/eslint-config-typescript-react/lib/rules/jsx-a11y.js
  4. +10 −0 @pob/eslint-config-typescript-react/lib/rules/react-hooks.js
  5. +111 −44 @pob/eslint-config-typescript-react/lib/rules/react.js
  6. +11 −11 @pob/eslint-config-typescript-react/package.json
  7. +7 −1 @pob/eslint-config-typescript-react/test/.eslintrc.json
  8. +6 −0 @pob/eslint-config-typescript-react/test/Hello.tsx
  9. +4 −0 @pob/eslint-config-typescript-react/test/a11y/aria-props.tsx
  10. +4 −0 @pob/eslint-config-typescript-react/test/a11y/aria-role.tsx
  11. +3 −0 @pob/eslint-config-typescript-react/test/a11y/aria-unsupported-elements.tsx
  12. +0 −1 @pob/eslint-config-typescript-react/test/components.tsx
  13. +8 −0 @pob/eslint-config-typescript-react/test/react-hooks/exhaustive-deps.tsx
  14. +10 −0 @pob/eslint-config-typescript-react/test/react-hooks/rules-of-hooks.tsx
  15. +6 −0 @pob/eslint-config-typescript-react/test/react/button-has-type.tsx
  16. +6 −0 @pob/eslint-config-typescript-react/test/react/destructuring-assignment.tsx
  17. +10 −0 @pob/eslint-config-typescript-react/test/react/jsx-boolean-value.tsx
  18. 0 @pob/eslint-config-typescript-react/test/{ → react}/jsx-curly-brace-presence.tsx
  19. +17 −0 @pob/eslint-config-typescript-react/test/react/jsx-fragments.tsx
  20. +4 −0 @pob/eslint-config-typescript-react/test/react/jsx-no-comment-textnodes.tsx
  21. +14 −0 @pob/eslint-config-typescript-react/test/react/jsx-no-duplicate-props.tsx
  22. +10 −0 @pob/eslint-config-typescript-react/test/react/jsx-no-target-blank.tsx
  23. +2 −0 @pob/eslint-config-typescript-react/test/react/jsx-no-undef.tsx
  24. +9 −0 @pob/eslint-config-typescript-react/test/react/jsx-pascal-case.tsx
  25. +6 −0 @pob/eslint-config-typescript-react/test/react/no-array-index-key.tsx
  26. +7 −0 @pob/eslint-config-typescript-react/test/react/no-deprecated.tsx
  27. +6 −0 @pob/eslint-config-typescript-react/test/react/no-string-refs.tsx
  28. +18 −0 @pob/eslint-config-typescript-react/test/react/prefer-stateless-function.tsx
  29. +17 −0 @pob/eslint-config-typescript-react/test/react/require-default-props.tsx
  30. +4 −0 @pob/eslint-config-typescript-react/test/react/self-closing-comp.tsx
  31. +14 −0 @pob/eslint-config-typescript/CHANGELOG.md
  32. +0 −1 @pob/eslint-config-typescript/lib/index.js
  33. +125 −169 @pob/eslint-config-typescript/lib/plugins/typescript-eslint-replace-eslint.js
  34. +153 −66 @pob/eslint-config-typescript/lib/plugins/typescript-eslint.js
  35. +11 −13 @pob/eslint-config-typescript/package.json
  36. +3 −1 @pob/eslint-config-typescript/test/consistent-return.ts
  37. +1 −0 @pob/eslint-config-typescript/test/switch.ts
  38. +10 −0 @pob/eslint-config-typescript/test/typescript-eslint/adjacent-overload-signatures.ts
  39. +4 −0 @pob/eslint-config-typescript/test/typescript-eslint/array-type.ts
  40. +2 −0 @pob/eslint-config-typescript/test/typescript-eslint/await-thenable.ts
  41. +14 −0 @pob/eslint-config-typescript/test/typescript-eslint/ban-ts-comment.ts
  42. +13 −0 @pob/eslint-config-typescript/test/typescript-eslint/class-literal-property-style.ts
  43. +6 −0 @pob/eslint-config-typescript/test/typescript-eslint/consistent-generic-constructors.ts
  44. +11 −0 @pob/eslint-config-typescript/test/typescript-eslint/consistent-indexed-object-style.ts
  45. +12 −0 @pob/eslint-config-typescript/test/typescript-eslint/consistent-type-assertions.ts
  46. +6 −0 @pob/eslint-config-typescript/test/typescript-eslint/consistent-type-definitions.ts
  47. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/no-array-delete.ts
  48. 0 @pob/eslint-config-typescript/test/{array-delete.ts → typescript-eslint/no-array-delete2.ts}
  49. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/prefer-find.ts
  50. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/prefer-optional-chain.ts
  51. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/prefer-promise-reject-errors.ts
  52. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/prefer-string-starts-ends-with.ts
  53. 0 @pob/eslint-config-typescript/test/{ → typescript-eslint}/template-expressions.ts
  54. +14 −0 @pob/eslint-config/CHANGELOG.md
  55. +13 −9 @pob/eslint-config/lib/base.js
  56. +3 −1 @pob/eslint-config/lib/node-module.js
  57. +2 −0 @pob/eslint-config/lib/node/commonjs.js
  58. +99 −0 @pob/eslint-config/lib/plugins/import/import-base.js
  59. +8 −0 @pob/eslint-config/lib/plugins/import/import-commonjs.js
  60. +8 −0 @pob/eslint-config/lib/plugins/import/import-module.js
  61. +0 −19 @pob/eslint-config/lib/plugins/prettier.js
  62. +491 −0 @pob/eslint-config/lib/rules/best-practices.js
  63. +1 −0 @pob/eslint-config/lib/rules/dev-only.js
  64. +125 −0 @pob/eslint-config/lib/rules/errors.js
  65. +0 −45 @pob/eslint-config/lib/rules/expert.js
  66. +8 −0 @pob/eslint-config/lib/rules/modules/base.js
  67. +11 −0 @pob/eslint-config/lib/rules/modules/commonjs.js
  68. +4 −1 @pob/eslint-config/lib/rules/{airbnb-fixes.js → modules/esm.js}
  69. +11 −29 @pob/eslint-config/lib/rules/style.js
  70. +8 −10 @pob/eslint-config/package.json
  71. +16 −0 @pob/eslint-config/test/best-practices/accessor-pairs.mjs
  72. +21 −0 @pob/eslint-config/test/best-practices/array-callback-return.mjs
  73. +37 −0 @pob/eslint-config/test/best-practices/block-scoped-var.js
  74. +44 −0 @pob/eslint-config/test/best-practices/complexity.mjs
  75. +14 −0 @pob/eslint-config/test/best-practices/consistent-return.mjs
  76. +12 −0 @pob/eslint-config/test/best-practices/curly.mjs
  77. +11 −0 @pob/eslint-config/test/best-practices/default-case-last.mjs
  78. +39 −0 @pob/eslint-config/test/best-practices/default-case.mjs
  79. +5 −0 @pob/eslint-config/test/best-practices/default-param-last.mjs
  80. +4 −0 @pob/eslint-config/test/best-practices/dot-notation.mjs
  81. +16 −0 @pob/eslint-config/test/best-practices/eqeqeq.mjs
  82. +10 −0 @pob/eslint-config/test/best-practices/grouped-accessor-pairs.mjs
  83. +6 −0 @pob/eslint-config/test/best-practices/guard-for-in.mjs
  84. +2 −0 @pob/eslint-config/test/best-practices/max-classes-per-file.mjs
  85. +2 −0 @pob/eslint-config/test/best-practices/no-alert.mjs
  86. +5 −0 @pob/eslint-config/test/best-practices/no-caller.mjs
  87. +21 −0 @pob/eslint-config/test/best-practices/no-case-declarations.mjs
  88. +7 −0 @pob/eslint-config/test/best-practices/no-constructor-return.mjs
  89. +17 −0 @pob/eslint-config/test/best-practices/no-else-return.mjs
  90. +5 −0 @pob/eslint-config/test/best-practices/no-empty-function.mjs
  91. +6 −0 @pob/eslint-config/test/best-practices/no-empty-pattern.mjs
  92. +6 −0 @pob/eslint-config/test/best-practices/no-eval.mjs
  93. +15 −0 @pob/eslint-config/test/best-practices/no-extend-native.mjs
  94. +13 −0 @pob/eslint-config/test/best-practices/no-extra-bind.mjs
  95. +22 −0 @pob/eslint-config/test/best-practices/no-extra-label.mjs
  96. +14 −0 @pob/eslint-config/test/best-practices/no-fallthrough.mjs
  97. +4 −0 @pob/eslint-config/test/best-practices/no-global-assign.mjs
  98. +2 −0 @pob/eslint-config/test/best-practices/no-implied-eval.mjs
  99. +9 −0 @pob/eslint-config/test/best-practices/no-label.mjs
  100. +8 −0 @pob/eslint-config/test/best-practices/no-lone-blocks.mjs
  101. +16 −0 @pob/eslint-config/test/best-practices/no-loop-func.mjs
  102. +4 −0 @pob/eslint-config/test/best-practices/no-multi-str.mjs
  103. +2 −0 @pob/eslint-config/test/best-practices/no-new-func.mjs
  104. +5 −0 @pob/eslint-config/test/best-practices/no-new-wrappers.mjs
  105. +8 −0 @pob/eslint-config/test/best-practices/no-new.mjs
  106. +3 −0 @pob/eslint-config/test/best-practices/no-param-reassign.mjs
  107. +4 −0 @pob/eslint-config/test/best-practices/no-proto.mjs
  108. +7 −0 @pob/eslint-config/test/best-practices/no-redeclare.mjs
  109. +2 −0 @pob/eslint-config/test/best-practices/no-restricted-properties.mjs
  110. +7 −0 @pob/eslint-config/test/best-practices/no-return-assign.mjs
  111. +9 −0 @pob/eslint-config/test/best-practices/no-return-await.mjs
  112. +2 −0 @pob/eslint-config/test/best-practices/no-script-url.mjs
  113. +5 −0 @pob/eslint-config/test/best-practices/no-self-assign.mjs
  114. +5 −0 @pob/eslint-config/test/best-practices/no-self-compare.mjs
  115. +2 −0 @pob/eslint-config/test/best-practices/no-sequences.mjs
  116. +2 −0 @pob/eslint-config/test/best-practices/no-throw-literal.mjs
  117. +2 −0 @pob/eslint-config/test/best-practices/no-unused-expressions.mjs
  118. +7 −0 @pob/eslint-config/test/best-practices/no-useless-catch.mjs
  119. +2 −0 @pob/eslint-config/test/best-practices/no-useless-concat.mjs
  120. +4 −0 @pob/eslint-config/test/best-practices/no-useless-escape.mjs
  121. +4 −0 @pob/eslint-config/test/best-practices/no-useless-return.mjs
  122. +4 −0 @pob/eslint-config/test/best-practices/no-void.mjs
  123. +6 −0 @pob/eslint-config/test/best-practices/no-with.cjs
  124. +4 −0 @pob/eslint-config/test/best-practices/prefer-promise-reject-errors.mjs
  125. +2 −0 @pob/eslint-config/test/best-practices/radix.mjs
  126. +4 −0 @pob/eslint-config/test/best-practices/yoda.mjs
  127. +2 −0 @pob/eslint-config/test/errors/for-direction.mjs
  128. +6 −0 @pob/eslint-config/test/errors/getter-return.mjs
  129. +6 −0 @pob/eslint-config/test/errors/no-async-promise-executor.mjs
  130. +6 −0 @pob/eslint-config/test/errors/no-compare-neg-zero.mjs
  131. +7 −0 @pob/eslint-config/test/errors/no-cond-assign.mjs
  132. +5 −0 @pob/eslint-config/test/errors/no-constant-condition.mjs
  133. +2 −0 @pob/eslint-config/test/errors/no-control-regex.mjs
  134. +5 −0 @pob/eslint-config/test/errors/no-debugger.mjs
  135. +3 −0 @pob/eslint-config/test/errors/no-dupe-args.mjs
  136. +10 −0 @pob/eslint-config/test/errors/no-dupe-else-if.mjs
  137. +5 −0 @pob/eslint-config/test/errors/no-dupe-keys.mjs
  138. +13 −0 @pob/eslint-config/test/errors/no-duplicate-case.mjs
  139. +2 −0 @pob/eslint-config/test/errors/no-empty-character-class.mjs
  140. +3 −0 @pob/eslint-config/test/errors/no-empty.mjs
  141. +6 −0 @pob/eslint-config/test/errors/no-ex-assign.mjs
  142. +2 −0 @pob/eslint-config/test/errors/no-extra-boolean-cast.mjs
  143. +3 −0 @pob/eslint-config/test/errors/no-func-assign.mjs
  144. +4 −0 @pob/eslint-config/test/errors/no-import-assign.mjs
  145. +7 −0 @pob/eslint-config/test/errors/no-inner-declarations.mjs
  146. +2 −0 @pob/eslint-config/test/errors/no-invalid-regexp.mjs
  147. +3 −0 @pob/eslint-config/test/errors/no-irregular-whitespace.mjs
  148. +2 −0 @pob/eslint-config/test/errors/no-loss-of-precision.mjs
  149. +2 −0 @pob/eslint-config/test/errors/no-misleading-character-class.mjs
  150. +2 −0 @pob/eslint-config/test/errors/no-obj-calls.mjs
  151. +4 −0 @pob/eslint-config/test/errors/no-promise-executor-return.mjs
  152. +3 −0 @pob/eslint-config/test/errors/no-prototype-builtins.mjs
  153. +2 −0 @pob/eslint-config/test/errors/no-regex-spaces.mjs
  154. +7 −0 @pob/eslint-config/test/errors/no-setter-return.mjs
  155. +4 −0 @pob/eslint-config/test/errors/no-sparse-arrays.mjs
  156. +2 −0 @pob/eslint-config/test/errors/no-template-curly-in-string.mjs
  157. +8 −0 @pob/eslint-config/test/errors/no-unreachable-loop.mjs
  158. +7 −0 @pob/eslint-config/test/errors/no-unreachable.mjs
  159. +12 −0 @pob/eslint-config/test/errors/no-unsafe-finally.mjs
  160. +7 −0 @pob/eslint-config/test/errors/no-unsafe-negation.mjs
  161. +4 −0 @pob/eslint-config/test/errors/no-unsafe-optional-chaining.mjs
  162. +2 −0 @pob/eslint-config/test/errors/no-useless-backreference.mjs
  163. +2 −0 @pob/eslint-config/test/errors/strict.cjs
  164. +10 −0 @pob/eslint-config/test/errors/use-isnan.mjs
  165. +2 −0 @pob/eslint-config/test/errors/valid-typeof.mjs
  166. +14 −0 @pob/eslint-config/test/es6/arrow-body-style.mjs
  167. +5 −0 @pob/eslint-config/test/es6/constructor-super.mjs
  168. +5 −0 @pob/eslint-config/test/es6/no-class-assign.mjs
  169. +4 −0 @pob/eslint-config/test/es6/no-const-assign.mjs
  170. +6 −0 @pob/eslint-config/test/es6/no-dupe-class-members.mjs
  171. +2 −0 @pob/eslint-config/test/es6/no-new-symbol.mjs
  172. +8 −0 @pob/eslint-config/test/es6/no-this-before-super.mjs
  173. +2 −0 @pob/eslint-config/test/es6/no-useless-computed-key.mjs
  174. +4 −0 @pob/eslint-config/test/es6/no-useless-constructor.mjs
  175. +4 −0 @pob/eslint-config/test/es6/no-useless-rename.mjs
  176. +4 −0 @pob/eslint-config/test/es6/no-var.mjs
  177. +7 −0 @pob/eslint-config/test/es6/object-shorthand.mjs
  178. +6 −0 @pob/eslint-config/test/es6/prefer-arrow-callback.mjs
  179. +3 −0 @pob/eslint-config/test/es6/prefer-const.mjs
  180. +3 −0 @pob/eslint-config/test/es6/prefer-destructuring.mjs
  181. +2 −0 @pob/eslint-config/test/es6/prefer-numeric-literals.mjs
  182. +4 −0 @pob/eslint-config/test/es6/prefer-rest-params.mjs
  183. +4 −0 @pob/eslint-config/test/es6/prefer-spread.mjs
  184. +4 −0 @pob/eslint-config/test/es6/prefer-template.mjs
  185. +4 −0 @pob/eslint-config/test/es6/require-yield.mjs
  186. +2 −0 @pob/eslint-config/test/es6/symbol-description.mjs
  187. +8 −0 @pob/eslint-config/test/imports/export.mjs
  188. +7 −0 @pob/eslint-config/test/imports/first.mjs
  189. +2 −0 @pob/eslint-config/test/imports/foo.mjs
  190. +4 −0 @pob/eslint-config/test/imports/named.mjs
  191. +4 −0 @pob/eslint-config/test/imports/newline-after-import.mjs
  192. +4 −0 @pob/eslint-config/test/imports/no-absolute-path.mjs
  193. +11 −0 @pob/eslint-config/test/imports/no-amd.cjs
  194. +5 −0 @pob/eslint-config/test/imports/no-cycle1.mjs
  195. +5 −0 @pob/eslint-config/test/imports/no-cycle2.mjs
  196. +6 −0 @pob/eslint-config/test/imports/no-duplicates.mjs
  197. +5 −0 @pob/eslint-config/test/imports/no-dynamic-require.cjs
  198. +4 −0 @pob/eslint-config/test/imports/no-mutable-exports.mjs
  199. +2 −0 @pob/eslint-config/test/imports/no-relative-packages.mjs
  200. +5 −0 @pob/eslint-config/test/imports/no-self-import.mjs
  201. +2 −0 @pob/eslint-config/test/imports/no-unresolved.mjs
  202. +2 −0 @pob/eslint-config/test/imports/no-useless-path-segments.mjs
  203. +6 −0 @pob/eslint-config/test/imports/no-webpack-loader-syntax.cjs
  204. +9 −0 @pob/eslint-config/test/imports/order.mjs
  205. +14 −0 @pob/eslint-config/test/node-commonjs/global-require.js
  206. +6 −0 @pob/eslint-config/test/node-commonjs/no-new-require.js
  207. +6 −0 @pob/eslint-config/test/node-commonjs/no-path-concat.js
  208. +1 −1 @pob/eslint-config/test/node-module/globals.js
  209. +2 −0 @pob/eslint-config/test/node-module/no-buffer-constructor.js
  210. +15 −0 @pob/eslint-config/test/node-module/no-duplicate-imports.js
  211. +4 −0 @pob/eslint-config/test/node-module/node-protocol.js
  212. +9 −0 @pob/eslint-config/test/valid/no-await-in-loop.mjs
  213. +5 −0 @pob/eslint-config/test/variables/no-restricted-globals.mjs
  214. +2 −0 @pob/eslint-config/test/variables/no-shadow-restricted-names.mjs
  215. +7 −0 @pob/eslint-config/test/variables/no-shadow.mjs
  216. +5 −0 @pob/eslint-config/test/variables/no-undef-init.mjs
  217. +3 −0 @pob/eslint-config/test/variables/no-use-before-define.mjs
  218. +14 −0 CHANGELOG.md
  219. +5 −7 package.json
  220. +17 −32 scripts/check-packages.mjs
  221. +187 −206 yarn.lock
14 changes: 14 additions & 0 deletions @pob/eslint-config-typescript-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [55.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.2...v55.0.0) (2024-04-20)


### ⚠ BREAKING CHANGES

* remove config eslint-config-airbnb as dependency

### Features

* remove config eslint-config-airbnb as dependency ([5fc0e37](https://github.com/christophehurpeau/eslint-config-pob/commit/5fc0e378d61343d3a0f0ea8b994183d60353a3a0))

Version bump for dependency: eslint-config


## [54.0.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.1...v54.0.2) (2024-04-07)

Note: no notable changes
11 changes: 3 additions & 8 deletions @pob/eslint-config-typescript-react/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
'use strict';

module.exports = {
extends: [
'eslint-config-airbnb/rules/react',
'eslint-config-airbnb/rules/react-a11y',
'eslint-config-airbnb/rules/react-hooks',
'@pob/eslint-config/prettier', // reapply prettier
'@pob/eslint-config/rules/expert', // reapply expert: eslint-config-airbnb/rules/react modifies no-underscore-dangle
'./rules/react',
].map(require.resolve),
extends: ['./rules/react', './rules/react-hooks', './rules/jsx-a11y'].map(
require.resolve,
),

settings: {
'import/resolver': {
6 changes: 6 additions & 0 deletions @pob/eslint-config-typescript-react/lib/rules/jsx-a11y.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = {
plugins: ['jsx-a11y'],
extends: ['plugin:jsx-a11y/strict'],
};
10 changes: 10 additions & 0 deletions @pob/eslint-config-typescript-react/lib/rules/react-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

module.exports = {
plugins: ['react-hooks'],

rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
};
155 changes: 111 additions & 44 deletions @pob/eslint-config-typescript-react/lib/rules/react.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
'use strict';

module.exports = {
extends: ['plugin:react/jsx-runtime'],
extends: ['plugin:react/recommended', 'plugin:react/jsx-runtime'],

rules: {
/* added rules */

// https://github.com/airbnb/javascript/issues/2829
'func-names': 'error',

@@ -23,41 +21,123 @@ module.exports = {
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
'react/no-direct-mutation-state': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-props': [
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
'react/button-has-type': 'error',

// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
'react/destructuring-assignment': [
'error',
'always',
{ ignoreClassFields: false, destructureInSignature: 'always' },
],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
'react/display-name': 'off',

'react/function-component-definition': [
'error',
{
noSortAlphabetically: true,
reservedFirst: true,
shorthandFirst: true,
callbacksLast: true,
namedComponents: ['function-declaration'],
// https://github.com/airbnb/javascript/issues/2829
unnamedComponents: ['function-expression'],
},
],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/sort-prop-types': [
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
'react/hook-use-state': 'error',

// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-boolean-value': ['error', 'never', { always: [] }],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' },
],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
'react/jsx-curly-newline': [
'error',
{
noSortAlphabetically: true,
requiredFirst: false,
callbacksLast: true,
multiline: 'consistent',
singleline: 'consistent',
},
],

'react/function-component-definition': [
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
'react/jsx-fragments': ['error', 'syntax'],

// https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
'react/jsx-no-constructed-context-values': 'error',

// Prevent usage of `javascript:` URLs
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
'react/jsx-no-script-url': [
'error',
[
{
name: 'Link',
props: ['to'],
},
],
],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
'react/jsx-no-undef': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
'react/jsx-no-useless-fragment': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
'react/jsx-pascal-case': [
'error',
{
namedComponents: ['function-declaration'],
// https://github.com/airbnb/javascript/issues/2829
unnamedComponents: ['function-expression'],
allowAllCaps: true,
ignore: [],
},
],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-props': [
'error',
{
noSortAlphabetically: true,
reservedFirst: true,
shorthandFirst: true,
callbacksLast: true,
},
],
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
'react/no-arrow-function-lifecycle': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
'react/no-array-index-key': 'error',

/* changed rules */
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
'react/no-invalid-html-attribute': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
'react/no-namespace': 'error',

// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
'react/no-unescaped-entities': 'off',

// https://github.com/yannickcr/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
'react/no-unstable-nested-components': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
'react/prefer-exact-props': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
'react/prefer-es6-class': ['error', 'always'],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
'react/prefer-stateless-function': [
'error',
{ ignorePureComponents: true },
],

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
// don't ignore case
'react/jsx-no-duplicate-props': 'error',
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/self-closing-comp': 'error',

// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
'react/sort-comp': [
@@ -98,27 +178,14 @@ module.exports = {
},
],

// use class fields
'react/state-in-constructor': ['error', 'never'],

// use static public field
'react/static-property-placement': ['error', 'static public field'],

/* disabled rules */

// https://github.com/yannickcr/eslint-plugin-react/issues/1009
'react/require-default-props': 'off',

// disable force destructuring for state and props
'react/destructuring-assignment': 'off',

// project should use babel-plugin-transform-react-remove-prop-types
'react/forbid-foreign-prop-types': 'off',

// allow props spreading
'react/jsx-props-no-spreading': 'off',

// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
'react/no-unescaped-entities': 'off',
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/sort-prop-types': [
'error',
{
noSortAlphabetically: true,
requiredFirst: false,
callbacksLast: true,
},
],
},
};
22 changes: 11 additions & 11 deletions @pob/eslint-config-typescript-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pob/eslint-config-typescript-react",
"version": "54.0.2",
"version": "55.0.0",
"description": "eslint config files",
"keywords": [],
"author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
@@ -39,9 +39,9 @@
"peerDependencies": {
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0"
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0"
},
"peerDependenciesMeta": {
"eslint-plugin-import": {
@@ -58,14 +58,14 @@
}
},
"dependencies": {
"@pob/eslint-config": "54.0.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0"
"@pob/eslint-config": "55.0.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react-hooks": "4.6.0"
},
"devDependencies": {
"@types/react": "18.2.74"
"@types/react": "18.2.79",
"react": "18.2.0"
}
}
8 changes: 7 additions & 1 deletion @pob/eslint-config-typescript-react/test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,13 @@
"extends": [
"../../eslint-config-typescript/lib/index.js",
"../lib/index.js"
]
],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": true }
]
}
}
]
}
6 changes: 6 additions & 0 deletions @pob/eslint-config-typescript-react/test/Hello.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { ReactNode } from 'react';

export function Hello(props: { name: string }): ReactNode {
// eslint-disable-next-line react/destructuring-assignment
return <div>Hello, {props.name}.</div>;
}
4 changes: 4 additions & 0 deletions @pob/eslint-config-typescript-react/test/a11y/aria-props.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const div1 = <div id="address_label">Enter your address</div>;

// eslint-disable-next-line jsx-a11y/aria-props, react/no-unknown-property
export const div2 = <input aria-labeledby="address_label" />;
4 changes: 4 additions & 0 deletions @pob/eslint-config-typescript-react/test/a11y/aria-role.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const Valid = <div role="button" />;

// eslint-disable-next-line jsx-a11y/aria-role
export const Invalid = <div role="foo" />;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// eslint-disable-next-line jsx-a11y/aria-unsupported-elements
export const bad = <meta charSet="utf8" aria-hidden="false" />;
//
1 change: 0 additions & 1 deletion @pob/eslint-config-typescript-react/test/components.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { forwardRef, memo, type ReactNode } from 'react';

// eslint-disable-next-line react/function-component-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useEffect } from 'react';

export function useHook(name: string): void {
useEffect(() => {
localStorage.setItem('formData', name);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useEffect } from 'react';

export function useHook(name: string): void {
if (name !== '') {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
localStorage.setItem('formData', name);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint-disable-next-line react/button-has-type
export const Invalid = <button>Hello</button>;
// eslint-disable-next-line react/button-has-type
export const InvalidType = <button type="foo">Hello</button>;

export const ValidType = <button type="button">Hello</button>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { ReactNode } from 'react';

export function MyComponent(props: { id: string | undefined }): ReactNode {
// eslint-disable-next-line react/destructuring-assignment
return <div id={props.id} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ReactElement } from 'react';

function Hello({ personal }: { personal: boolean }): ReactElement {
return personal ? <div>Hello, World!</div> : <div>Hello, World!</div>;
}

// eslint-disable-next-line react/jsx-boolean-value
export const Incorrect = <Hello personal={true} />;

export const Valid = <Hello personal />;
17 changes: 17 additions & 0 deletions @pob/eslint-config-typescript-react/test/react/jsx-fragments.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Fragment as Fragment2 } from 'react';
import { Fragment } from 'react/jsx-runtime';

export const fragment1 = (
<Fragment>
<div />
<div />
</Fragment>
);

export const fragment2 = (
// eslint-disable-next-line react/jsx-fragments
<Fragment2>
<div />
<div />
</Fragment2>
);
Loading