You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PR updates dependencies and devDependencies, but also includes unrelated changes to @shardeum-foundation packages. These should be in a separate PR or commit to avoid merge conflicts between branch lines with different versions.
The custom ESLint rule for unused pure function calls uses a hardcoded list of method names and context checks. Reviewers should validate that the rule does not produce false positives or negatives, especially for edge cases or custom pure functions not in the list.
constdefaultPureMethods=[// Array methods that return new arrays'concat','slice','map','filter','reduce','reduceRight','find','findIndex','some','every','includes','indexOf','lastIndexOf','join','toString','toLocaleString','flatMap','flat','with','toReversed','toSorted','toSpliced',// String methods that return new strings'substring','substr','toLowerCase','toUpperCase','trim','trimStart','trimEnd','replace','replaceAll','split','padStart','padEnd','repeat','charAt','charCodeAt','slice','substr','substring',// Object methods that return new objects/values'assign','keys','values','entries','freeze','seal','getOwnPropertyNames','getOwnPropertyDescriptors','sign',]constoptions=context.options[0]||{}constpureMethods=[...defaultPureMethods, ...(options.pureMethods||[])]functionisPureMethodCall(node){if(node.type!=='CallExpression')returnfalseif(node.callee.type!=='MemberExpression')returnfalseif(node.callee.property.type!=='Identifier')returnfalsereturnpureMethods.includes(node.callee.property.name)}
The ignore patterns in the ESLint config are extensive and may unintentionally exclude files that should be linted. Reviewers should confirm that all necessary files are still covered by linting.
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The pureMethods array may contain duplicate method names, especially since some methods like 'slice', 'substr', and 'substring' appear multiple times in defaultPureMethods. This can cause unnecessary repeated checks and potential confusion. Remove duplicates from the pureMethods array to ensure each method is only checked once. [general, importance: 6]
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The defaultPureMethods array includes 'assign', which is not a pure function (Object.assign mutates the first argument). Remove 'assign' to avoid false positives where mutating methods are flagged as pure. [possible issue, importance: 9]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement
Description
Migrated ESLint configuration to flat config with
eslint.config.mjsAdded custom ESLint plugin for unused pure function calls
Updated and expanded ESLint and related dependencies
Improved lint script and dependency versions in
package.jsonChanges walkthrough 📝
eslint.config.mjs
Add flat ESLint config with custom rules and ignoreseslint.config.mjs
.eslintrc.json
Remove legacy ESLint configuration file.eslintrc.json
index.js
Add custom ESLint plugin entry for pure functionseslint-plugin-pure-functions/index.js
no-unused-pure-calls.js
Add rule to detect unused pure function callseslint-plugin-pure-functions/rules/no-unused-pure-calls.js
package.json
Update ESLint dependencies and scripts for new configpackage.json