Skip to content

Commit

Permalink
Disable react/react-in-jsx-scope because it's often available globally
Browse files Browse the repository at this point in the history
  • Loading branch information
leroykorterink committed Nov 7, 2024
1 parent 5ef951c commit 3fa1e21
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions src/react.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
/**
* @type {import('eslint').Linter.Config}
*/
/** @type {import('eslint').Linter.Config} */
export const recommended = {
rules: {
/**
* Unicorn plugin
*/
'unicorn/prevent-abbreviations': [
'error',
// Allow variables that end with `prop` or `props`
{ ignore: [/props?/iu, /ref/iu] },
{
// Allow variables that end with `prop` or `props`
ignore: [/props?/iu, /ref/iu],
},
],

/**
* React plugin
*/
'react/button-has-type': 'error',
'react/destructuring-assignment': 'error',
'react/forbid-foreign-prop-types': 'error',
'react/function-component-definition': 'error',
'react/hook-use-state': 'error',
'react/iframe-missing-sandbox': 'error',
'react/jsx-boolean-value': 'error',
'react/jsx-curly-brace-presence': 'error',
'react/jsx-fragments': 'error',
'react/jsx-handler-names': [
'error',
{
eventHandlerPrefix: 'on',
eventHandlerPropPrefix: 'on',
checkLocalVariables: true,
},
],
'react/jsx-no-bind': 'error',
'react/jsx-no-constructed-context-values': 'error',
'react/jsx-no-literals': [
'error',
{
ignoreProps: true,
},
],
'react/jsx-no-script-url': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-pascal-case': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-adjacent-inline-elements': 'error',
'react/no-array-index-key': 'error',
Expand All @@ -40,28 +63,11 @@ export const recommended = {
'react/no-will-update-set-state': 'error',
'react/prefer-es6-class': 'error',
'react/prefer-stateless-function': 'error',
'react/react-in-jsx-scope': 'off',
'react/state-in-constructor': ['error', 'never'],
'react/static-property-placement': 'error',
'react/style-prop-object': 'error',
'react/void-dom-elements-no-children': 'error',
'react/button-has-type': 'error',
'react/jsx-boolean-value': 'error',
'react/jsx-curly-brace-presence': 'error',
'react/jsx-fragments': 'error',
'react/jsx-handler-names': [
'error',
{
eventHandlerPrefix: 'on',
eventHandlerPropPrefix: 'on',
checkLocalVariables: true,
},
],
'react/jsx-no-bind': 'error',
'react/jsx-no-constructed-context-values': 'error',
'react/jsx-no-literals': ['error', { ignoreProps: true }],
'react/jsx-no-script-url': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-pascal-case': 'error',

/**
* JSX A11y plugin
Expand Down

0 comments on commit 3fa1e21

Please sign in to comment.