Skip to content

Commit

Permalink
fix(plugins/debug): 'is-from-react' use correct settings when calling…
Browse files Browse the repository at this point in the history
… 'isInitializedFromReact'
  • Loading branch information
Rel1cx committed Nov 22, 2024
1 parent f90c948 commit e0b2940
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.1-beta.0
1.17.1-next.1
3 changes: 3 additions & 0 deletions examples/vite-react-dom-legacy/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module.exports = {
extends: [
"plugin:@eslint-react/recommended-legacy",
],
rules: {
"@eslint-react/naming-convention/filename": ["warn", "kebab-case"],
},
},
],
};
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/monorepo",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"private": true,
"description": "A series of composable ESLint plugins for libraries and frameworks that use React as a UI runtime.",
"keywords": [
Expand Down Expand Up @@ -124,8 +124,7 @@
"safer-buffer": "npm:@nolyfill/safer-buffer@^1.0.41",
"side-channel": "npm:@nolyfill/side-channel@^1.0.29",
"typedarray": "npm:@nolyfill/typedarray@^1.0.29",
"typescript": "^5.6.3",
"valibot": "0.42.1"
"typescript": "^5.6.3"
}
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/core",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-debug/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-debug",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint plugin for debugging related rules.",
"keywords": [
"eslint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default createRule<[], MessageID>({
name: RULE_NAME,
create(context) {
const settings = decodeSettings(context.settings);
const finalSettings = {
...settings,
strictImportCheck: true,
} satisfies typeof settings;
function isFromReact(
node: TSESTree.Identifier | TSESTree.JSXIdentifier,
initialScope: Scope,
Expand All @@ -37,13 +41,13 @@ export default createRule<[], MessageID>({
case node.parent.type === AST_NODE_TYPES.MemberExpression
&& node.parent.property === node
&& node.parent.object.type === AST_NODE_TYPES.Identifier:
return isInitializedFromReact(node.parent.object.name, initialScope, settings);
return isInitializedFromReact(node.parent.object.name, initialScope, finalSettings);
case node.parent.type === AST_NODE_TYPES.JSXMemberExpression
&& node.parent.property === node
&& node.parent.object.type === AST_NODE_TYPES.JSXIdentifier:
return isInitializedFromReact(node.parent.object.name, initialScope, settings);
return isInitializedFromReact(node.parent.object.name, initialScope, finalSettings);
default:
return isInitializedFromReact(name, initialScope, settings);
return isInitializedFromReact(name, initialScope, finalSettings);
}
}
function getReportDescriptor(
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-dom",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint plugin for React DOM related rules.",
"keywords": [
"eslint",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-hooks-extra",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
"keywords": [
"eslint",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-naming-convention",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint plugin for naming convention related rules.",
"keywords": [
"eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-web-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-web-api",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
"keywords": [
"eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-x/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-x",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
"keywords": [
"eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/eslint-plugin",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "The main ESLint plugin of ESLint React. Contains all the rules and presets of ESLint React.",
"keywords": [
"eslint",
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/shared",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's Shared constants and functions.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down Expand Up @@ -54,6 +54,6 @@
"micro-memoize": "^4.1.2",
"tsup": "^8.3.5",
"type-fest": "^4.27.0",
"valibot": "^1.0.0-beta.7"
"valibot": "^1.0.0-beta.8"
}
}
2 changes: 1 addition & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/tools",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's std library and primitives.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/types",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's type definitions.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/ast",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's TSESTree AST utility module.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/jsx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/jsx",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/var/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/var",
"version": "1.17.1-beta.0",
"version": "1.17.1-next.1",
"description": "TSESTree AST utility module for static analysis of variables",
"homepage": "https://github.com/rel1cx/eslint-react",
"bugs": {
Expand Down
11 changes: 5 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0b2940

Please sign in to comment.