Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: migrate from eslint-plugin-react to eslint-react #157

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

liby
Copy link
Contributor

@liby liby commented Jun 25, 2024

@liby liby requested a review from frantic1048 June 25, 2024 02:43
'react/require-default-props': 'off',
'@eslint-react/naming-convention/filename-extension': ['warn', { extensions: ['.jsx', '.tsx'] }],
'@eslint-react/jsx/no-missing-key': ['error'],
'@eslint-react/jsx/no-useless-fragment': ['error'],
Copy link
Contributor Author

@liby liby Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liby liby force-pushed the feature/migrate-to-eslint-react branch from 2a2c680 to cc7539c Compare June 25, 2024 03:09
'warn',
{ extensions: ['.jsx', '.tsx'] },
],
'@eslint-react/no-missing-key': ['error'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is already included in the plugin:@eslint-react/recommended-legacy preset. May we omit it?

https://github.com/Rel1cx/eslint-react/blob/3e3af56a1df933180e423a777887e66f72d2fcf0/packages/plugins/eslint-plugin/src/index.ts#L108

'react/require-default-props': 'off',
'@eslint-react/naming-convention/filename-extension': [
'warn',
{ extensions: ['.jsx', '.tsx'] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eslint-react/naming-convention/filename-extension already defaults to "extensions": [".jsx", ".tsx"]. May we omit it?

In contrast, react/jsx-filename-extension defaults to "extensions": [".jsx"], thus we are manually set extensions in the past.

References:

  1. @eslint-react/naming-convention/filename-extension: https://eslint-react.xyz/rules/naming-convention-filename-extension
  2. react/jsx-filename-extension: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
  3. react/jsx-filename-extension issue about .tsx extension: Default values for the React /jsx-filename-extension rule  jsx-eslint/eslint-plugin-react#2919

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will remove them. Previously, what I considered was to explicitly declare the rule configuration to avoid being affected by upstream changes.
However, we have corresponding config-snapshot.test.ts, so even if the default configuration upstream changes, we can still observe it here.

@liby liby force-pushed the feature/migrate-to-eslint-react branch from f482ef6 to b570b2d Compare June 25, 2024 07:08
@liby liby force-pushed the feature/migrate-to-eslint-react branch from b570b2d to 70ca097 Compare June 25, 2024 08:00
@liby liby merged commit 1ffcf25 into main Jun 26, 2024
6 checks passed
@liby liby deleted the feature/migrate-to-eslint-react branch June 26, 2024 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants