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

fix(eslint-plugin): inline react-hooks rules to get rid of @eslint/eslintrc #3397

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/olive-ants-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rnx-kit/eslint-plugin": patch
---

Inline recommended `react-hooks` rules so we no longer have to depend on
`@eslint/eslintrc`
2 changes: 0 additions & 2 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"test": "rnx-kit-scripts test"
},
"dependencies": {
"@eslint/eslintrc": "^3.0.0",
"@react-native/eslint-plugin": "^0.75.0",
"enhanced-resolve": "^5.8.3",
"eslint-plugin-react": "^7.35.2",
Expand All @@ -59,7 +58,6 @@
"@rnx-kit/scripts": "*",
"@rnx-kit/tsconfig": "*",
"@types/eslint": "^9.0.0",
"@types/eslint__eslintrc": "^2.1.1",
"@types/eslint__js": "^8.0.0",
"@types/estree": "*",
"@types/jest": "^29.2.1",
Expand Down
14 changes: 6 additions & 8 deletions packages/eslint-plugin/src/configs/react.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// @ts-check
"use strict";

const { FlatCompat } = require("@eslint/eslintrc");
const react = require("eslint-plugin-react");
const eslint = require("./eslint");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: eslint.configs.recommended,
});
// @ts-expect-error Could not find a declaration file for module
const reactHooks = require("eslint-plugin-react-hooks");

module.exports = [
...compat.extends("plugin:react-hooks/recommended"),
react.configs.flat.recommended,
{
name: "rnx-kit/react",
plugins: {
"react-hooks": reactHooks,
},
rules: {
"react/prop-types": "off",
...reactHooks.configs.recommended.rules,
},
settings: {
react: {
Expand Down
13 changes: 1 addition & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ __metadata:
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^3.0.0, @eslint/eslintrc@npm:^3.1.0":
"@eslint/eslintrc@npm:^3.1.0":
version: 3.1.0
resolution: "@eslint/eslintrc@npm:3.1.0"
dependencies:
Expand Down Expand Up @@ -3951,14 +3951,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "@rnx-kit/eslint-plugin@workspace:packages/eslint-plugin"
dependencies:
"@eslint/eslintrc": "npm:^3.0.0"
"@react-native/eslint-plugin": "npm:^0.75.0"
"@rnx-kit/eslint-config": "npm:*"
"@rnx-kit/jest-preset": "npm:*"
"@rnx-kit/scripts": "npm:*"
"@rnx-kit/tsconfig": "npm:*"
"@types/eslint": "npm:^9.0.0"
"@types/eslint__eslintrc": "npm:^2.1.1"
"@types/eslint__js": "npm:^8.0.0"
"@types/estree": "npm:*"
"@types/jest": "npm:^29.2.1"
Expand Down Expand Up @@ -4866,15 +4864,6 @@ __metadata:
languageName: node
linkType: hard

"@types/eslint__eslintrc@npm:^2.1.1":
version: 2.1.2
resolution: "@types/eslint__eslintrc@npm:2.1.2"
dependencies:
"@types/eslint": "npm:*"
checksum: 10c0/ccbeb74886fbbee1b016ed9c920ad932cb0b970c42eec4cea27e04c2640d5a92c20e44d4610de73551c4c8f658963a769ddc9fd75eac72edf33f035129600637
languageName: node
linkType: hard

"@types/eslint__js@npm:^8.0.0":
version: 8.42.3
resolution: "@types/eslint__js@npm:8.42.3"
Expand Down
Loading