Skip to content

Rules should not accept unstable values created via function #77

@huynhducduy

Description

@huynhducduy

Rules should not accept unstable values created with function.

For example:

This should be considered warnings, but currently not:

function bar() {
    return {} // can be objects, arrays, functions, jsxs
}

const foo = bar()

<Item config={foo} />

This should be considered valid:

function bar() {
    return {} // can be objects, arrays, functions, jsxs
}

const foo = useMemo(bar(), []) // wrapped with useMemo
const foo = useOtherCustomHook() // this will make sense after resolved https://github.com/cvazac/eslint-plugin-react-perf/issues/76

<Item config={foo} />

This should be still considered valid:

function bar() {
    return 'bar' // can be any other primitives
}

const foo = bar()

<Item config={foo} />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions