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

Array mutation pattern with new immutable-data's ignoreNonConstDeclarations is not working #692

Closed
rickmed opened this issue Jul 21, 2023 · 3 comments · Fixed by #683
Closed
Labels
Status: Beta Released It's now live. Status: Released It's now live. Type: Bug Inconsistencies or issues which will cause a problem for users or implementors.

Comments

@rickmed
Copy link

rickmed commented Jul 21, 2023

Regarding the feature released as beta in #691

the rule complains with this:

let arr2 = []
for (const x of [1, 2]) {
    arr2.push(x)   // rule complains here with "Modifying an existing object/array is not allowed."
}

my .eslintrc:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "sourceType": "module",
    "project": "./tsconfig.json"
  },
  "plugins": [
    "@typescript-eslint",
    "functional"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended"
  ],
  "rules": {
    "semi": ["error", "never"],
    "quotes": ["error", "double", { "allowTemplateLiterals": true }],
    "no-inner-declarations" : "off",
    "no-console": "error",
    "functional/immutable-data": ["error", {
      "ignoreNonConstDeclarations": true
      }],
    "prefer-const": "off"
  },
  "env": {
    "es2022": true,
    "node": true
  }
}

installed version is eslint-plugin-functional@6.0.0-next.6

@rickmed rickmed added Status: Triage This issue needs to be triaged. Type: Bug Inconsistencies or issues which will cause a problem for users or implementors. labels Jul 21, 2023
@rickmed rickmed changed the title Array mutation pattern in new ignoreNonConstDeclarations of immutable-data is not working Array mutation pattern with new ignoreNonConstDeclarations of immutable-data is not working Jul 21, 2023
@rickmed rickmed changed the title Array mutation pattern with new ignoreNonConstDeclarations of immutable-data is not working Array mutation pattern with new immutable-data's ignoreNonConstDeclarations is not working Jul 23, 2023
@RebeccaStevens RebeccaStevens removed the Status: Triage This issue needs to be triaged. label Jul 24, 2023
github-actions bot pushed a commit that referenced this issue Jul 24, 2023
# [6.0.0-next.7](v6.0.0-next.6...v6.0.0-next.7) (2023-07-24)

### Bug Fixes

* **immutable-data:** rework logic, it should work now ([9644994](9644994)), closes [#692](#692)
@github-actions
Copy link

🎉 This issue has been resolved in version 6.0.0-next.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the Status: Beta Released It's now live. label Jul 24, 2023
@rickmed
Copy link
Author

rickmed commented Jul 24, 2023

9644994 fix worked for me 👍

RebeccaStevens added a commit that referenced this issue Jul 30, 2023
github-actions bot pushed a commit that referenced this issue Jul 30, 2023
# [6.0.0](v5.0.8...v6.0.0) (2023-07-30)

### Bug Fixes

* add sanity checks to type immutablity override settings ([d3ce5b0](d3ce5b0))
* further updates for v6 ([71ecdb5](71ecdb5))
* **immutable-data:** rework logic, it should work now ([9644994](9644994)), closes [#692](#692)
* migrate code for [@typescript-eslint](https://github.com/typescript-eslint) v6 ([5c6b1a2](5c6b1a2))
* replace `ignorePattern` option with `ignoreIdentifierPattern` and `ignoreCodePattern` ([48d8eba](48d8eba)), closes [#467](#467)

### Build System

* increase minimum supported TypeScript version to 4.3.5 ([aefe6b2](aefe6b2))

### Features

* **functional-parameters:** add option to ignore getters and setters ([9c89b9e](9c89b9e))
* **immutable-data:** add new option `ignoreNonConstDeclarations` ([ecde24a](ecde24a)), closes [#691](#691)
* **no-expression-statements:** add option to ignore self returning functions ([894fb91](894fb91)), closes [#611](#611)
* **prefer-immutable-types:** use suggestions instead of a fixer by default ([#598](#598)) ([3fb9028](3fb9028))
* remove `assumeTypes` option ([6be5862](6be5862))

### BREAKING CHANGES

* replace `ignorePattern` option with `ignoreIdentifierPattern` and `ignoreCodePattern`
* increase minimum supported TypeScript version to 4.3.5
* remove `assumeTypes` option
* **prefer-immutable-types:** The fixer config no longer inherits as many options as before; be sure to be
explicit in your configs.
@github-actions
Copy link

🎉 This issue has been resolved in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the Status: Released It's now live. label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Beta Released It's now live. Status: Released It's now live. Type: Bug Inconsistencies or issues which will cause a problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants