{"id":13801739,"url":"https://github.com/purely-functional/eslint-plugin-pure","last_synced_at":"2025-05-13T11:31:45.219Z","repository":{"id":215164885,"uuid":"59922033","full_name":"purely-functional/eslint-plugin-pure","owner":"purely-functional","description":null,"archived":false,"fork":false,"pushed_at":"2016-06-07T15:41:40.000Z","size":9,"stargazers_count":28,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-22T12:30:39.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purely-functional.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-29T01:54:09.000Z","updated_at":"2023-06-29T09:14:18.000Z","dependencies_parsed_at":"2024-01-07T21:52:40.511Z","dependency_job_id":null,"html_url":"https://github.com/purely-functional/eslint-plugin-pure","commit_stats":null,"previous_names":["purely-functional/eslint-plugin-pure"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purely-functional%2Feslint-plugin-pure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purely-functional%2Feslint-plugin-pure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purely-functional%2Feslint-plugin-pure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purely-functional%2Feslint-plugin-pure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purely-functional","download_url":"https://codeload.github.com/purely-functional/eslint-plugin-pure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253932935,"owners_count":21986480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:26.648Z","updated_at":"2025-05-13T11:31:40.202Z","avatar_url":"https://github.com/purely-functional.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Practices and Specific ES Features"],"readme":"# eslint-plugin-pure\n\nEnforce rules to make your code purely functional by disallowing some language constructs.\n\n__Note:__ Your code must be using ES6 modules, because `module.exports =` is considered impure code!\n\n\n## What are disallowed?\n\n- __ExpressionStatements__ are disallowed. ExpressionStatements are statements whose result is not used (i.e. not stored in a variable, thrown, or returned). This signifys that some side-effect is taking place.\n\n  ```js\n  array.push(1)\n  ```\n\n  Binding to a variable is allowed, though, e.g.\n  \n  ```js\n  export function getArrayLength (array) {\n    const arrayLength = array.length\n    return arrayLength\n  }\n  ```\n\n  To prevent cheating by just binding side-effect to an unused variable, use `no-unused-vars` rule.\n\n- __AssignmentExpressions__ are disallowed for obvious reasons.\n\n- __UpdateExpressions__ are disallowed for obvious reasons.\n\n- __SequenceExpressions__ are disallowed, because `(a, b, c)` results in `c`, and that means `a` and `b` are evaluated for purely side-effects.\n\n\n## Installation\n\nYou'll first need to install [ESLint](http://eslint.org):\n\n```\n$ npm i eslint --save-dev\n```\n\nNext, install `eslint-plugin-pure`:\n\n```\n$ npm install purely-functional/eslint-plugin-pure --save-dev\n```\n\n**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-pure` globally.\n\n\n\n## Usage\n\nAdd `pure` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:\n\n```yaml\nplugins:\n  - pure\n```\n\nThen in the files you want to make pure, put this comment in:\n\n```js\n/* eslint pure/pure: 2 */\n```\n\nUse these built-in recommended rules. These rules are useful outside of pure code but when used in conjunction with this plugin yields a powerful effect:\n\n```yaml\nrules:\n  no-var: 2\n  prefer-const: 2\n  no-undef: 2\n  no-unused-vars: 2\n```\n\nAlso look into [eslint-plugin-immutable](https://github.com/jhusain/eslint-plugin-immutable) for even more enforcement (such as disallowing `this`).\n\n\n\n## Should I use this everywhere?\n\nProbably not.\nI recommend using this in your reducers or in entity modules.\n\n\n\n## Supported Rules\n\n* [pure](docs/rules/pure.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurely-functional%2Feslint-plugin-pure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurely-functional%2Feslint-plugin-pure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurely-functional%2Feslint-plugin-pure/lists"}