Skip to content

bug: strict-mutable rule impacted by order of source code #111

@nwhittaker

Description

@nwhittaker

Prerequisites

Stencil ESLint Version

0.7.2

Current Behavior

Given a mutable prop @Prop({ mutable: true }) that is mutated somewhere within the component, the strict-mutable rule:

  1. Will pass if the prop is mutated at a line in the code file below the line where the prop is defined.
  2. Will not pass if the prop is mutated at a line above the line where the prop is defined.

Expected Behavior

The rule passes regardless of where the prop is mutated relative to where the prop is defined in the code file.

Steps to Reproduce

  1. Visit the reproduction repo and checkout the [@stencil-community/eslint-plugin/strict-mutable[1] branch.
  2. Run npm i.
  3. Run npm run lint. Should fail with:
    error  @Prop() "fullName" should not be mutable  @stencil-community/strict-mutable
    
  4. Open the src/components/my-component/my-component.tsx file.
  5. Move the @Prop({ mutable: true }) fullName: string; line to above line 25.
  6. Run npm run lint. Should pass.

[1] https://github.com/nwhittaker/stencil-component/tree/%40stencil-community/eslint-plugin/strict-mutable

Code Reproduction URL

https://github.com/nwhittaker/stencil-component/tree/%40stencil-community/eslint-plugin/strict-mutable

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions