From 5384f324e18ef93279fbafa26853e9332c010e20 Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Fri, 1 Mar 2019 16:45:38 +0100 Subject: [PATCH] Make tslint-react-hooks available (#85) Make tslint-react-hooks rule available --- .circleci/config.yml | 1 + README.md | 6 +++--- package-lock.json | 7 ++++++- package.json | 5 +++-- tslint.json | 9 +++++---- tslint.report.available.json | 13 +++++++++++++ tslint.report.sources.json | 17 +++++++++++++++++ 7 files changed, 48 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a0a15f5..fb709d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,7 @@ jobs: steps: - checkout + - run: npm --version - run: npm install - run: diff --git a/README.md b/README.md index e8c98c3..b558478 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ the configurations that are extended in the following order: * [`tslint-microsoft-contrib`](https://github.com/Microsoft/tslint-microsoft-contrib/wiki/Release-Notes) * [`tslint-react`](https://github.com/Microsoft/tslint-microsoft-contrib/wiki/Release-Notes) * [`tslint-no-unused-expression-chai`](https://github.com/kwonoj/tslint-no-unused-expression-chai) +* [`tslint-react-hooks`](https://github.com/Gelio/tslint-react-hooks) to make sure upgrading dependencies in a project does not break any code/CI pipeline because of fixed/improve/more strict tslint rules. @@ -44,14 +45,13 @@ For further details see [Configured Rules](#configured-rules). 4. on the command line run `npm run tslint`. -PS: So far we didn't spend any effort in making this available via npm since it works quite well this way and it is not a high prio for us. We are releasing new version from the master branch using github [releases](https://github.com/bettermarks/bm-tslint-rules/releases) whenever we think it makes sense on a irregular basis. Mostly before and after breaking changes. of course with a tool like renovate you are also able to have digest updates. +PS: So far we didn't spend any effort in making this available via npm since it works quite well this way and it is not a high prio for us. We are releasing new version from the master branch using github [releases](https://github.com/bettermarks/bm-tslint-rules/releases) whenever we think it makes sense on a irregular basis. Mostly before and after breaking changes. With a tool like renovate you will have digest updates from master, otherwise you will need to check for new releases once in a while. Feel free to ask for a new release/tag when you want something specific that is not available yet by filing an issue. ## Configured rules The repo exports its [`tslint.json`](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.json) as it's main file. -We are using [karfau/tslint-report](https://github.com/karfau/tslint-report/) to provide a way of reasoning about (currently 301) [available](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.available.json) and (currently 179) [active](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.active.json) rules and their [sources](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.sources.json) (currently 6). -As of writing this the rule set has +We are using [karfau/tslint-report](https://github.com/karfau/tslint-report/) to provide a way of reasoning about [available](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.available.json) and [active](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.active.json) rules and their [sources](https://github.com/bettermarks/bm-tslint-rules/blob/master/tslint.report.sources.json). (As of writing this this rule set provides access to 301 rules from 7 sources of which 179 are active.) These can be generated using `npm run report` and will be generated automatically when running `npm version ...`. Our CircleCI integration makes sure the reports are always up to date. So when a commit lands on master you will be able to know what rules have been changed. diff --git a/package-lock.json b/package-lock.json index 730759e..33ee8ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bm-tslint-rules", - "version": "0.7.17", + "version": "0.7.18", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -484,6 +484,11 @@ "tsutils": "^2.13.1" } }, + "tslint-react-hooks": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tslint-react-hooks/-/tslint-react-hooks-1.1.0.tgz", + "integrity": "sha512-x6I2KShGpW9spMIGLrXeLiGXXr4g5mrXMRgjpDgO//73ZosyYKQ0aLqnJDDM+KAHM8fDPd3WtnWOF3U2Yk8wIA==" + }, "tslint-report": { "version": "github:karfau/tslint-report#e0f1866946f8218b7b363fb80266b7bbb7a7a79f", "from": "github:karfau/tslint-report#e0f1866", diff --git a/package.json b/package.json index 9dfa681..b3e2416 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bm-tslint-rules", - "version": "0.7.17", + "version": "0.7.18", "description": "default tslint rules to use for projects using typescript", "repository": "https://github.com/bettermarks/bm-tslint-rules", "bugs": "https://github.com/bettermarks/bm-tslint-rules/issues", @@ -33,7 +33,8 @@ "tslint-eslint-rules": "5.4.0", "tslint-microsoft-contrib": "6.0.0", "tslint-no-unused-expression-chai": "0.1.4", - "tslint-react": "3.6.0" + "tslint-react": "3.6.0", + "tslint-react-hooks": "1.1.0" }, "devDependencies": { "@types/node": "10.12.27", diff --git a/tslint.json b/tslint.json index 472af14..263fe37 100644 --- a/tslint.json +++ b/tslint.json @@ -1,10 +1,11 @@ { "extends": [ // TSLINT: https://palantir.github.io/tslint/rules/ - "tslint-eslint-rules", // https://eslint.org/docs/rules/ - "tslint-microsoft-contrib", // https://github.com/Microsoft/tslint-microsoft-contrib#supported-rules - "tslint-react", // https://github.com/palantir/tslint-react#rules - "tslint-no-unused-expression-chai" // https://github.com/karfau/tslint-no-unused-expression-chai/tree/should-support + "tslint-eslint-rules", + "tslint-microsoft-contrib", + "tslint-react", + "tslint-react-hooks", + "tslint-no-unused-expression-chai" ], "rulesDirectory": "dist", "rules": { diff --git a/tslint.report.available.json b/tslint.report.available.json index a1df2a4..84aeeae 100644 --- a/tslint.report.available.json +++ b/tslint.report.available.json @@ -5962,6 +5962,19 @@ "source": "tslint-microsoft-contrib", "sourcePath": "./node_modules/tslint-microsoft-contrib" }, + "react-hooks-nesting": { + "id": "./node_modules/tslint-react-hooks:react-hooks-nesting", + "description": "Enforces Rules of Hooks", + "descriptionDetails": "See https://reactjs.org/docs/hooks-rules.html", + "hasFix": false, + "type": "functionality", + "typescriptOnly": false, + "requiresTypeInfo": false, + "path": "./node_modules/tslint-react-hooks/dist/reactHooksNestingRule.js", + "ruleName": "react-hooks-nesting", + "source": "tslint-react-hooks", + "sourcePath": "./node_modules/tslint-react-hooks" + }, "react-iframe-missing-sandbox": { "id": "./node_modules/tslint-microsoft-contrib:react-iframe-missing-sandbox", "type": "functionality", diff --git a/tslint.report.sources.json b/tslint.report.sources.json index 3a24c6c..498e623 100644 --- a/tslint.report.sources.json +++ b/tslint.report.sources.json @@ -73,6 +73,23 @@ "tslint": ">=5.1.0" } }, + "./node_modules/tslint-react-hooks": { + "_from": "tslint-react-hooks@1.1.0", + "_resolved": "https://registry.npmjs.org/tslint-react-hooks/-/tslint-react-hooks-1.1.0.tgz", + "bugs": { + "url": "https://github.com/Gelio/tslint-react-hooks/issues" + }, + "description": "TSLint rule that enforces the Rules of Hooks", + "docs": "unknown", + "homepage": "https://github.com/Gelio/tslint-react-hooks", + "main": "tslint-react-hooks.json", + "name": "tslint-react-hooks", + "path": "./node_modules/tslint-react-hooks", + "peerDependencies": { + "tslint": "^5.1.0", + "typescript": ">=2.1.0" + } + }, "./node_modules/tslint-react": { "_from": "tslint-react@3.6.0", "_resolved": "https://registry.npmjs.org/tslint-react/-/tslint-react-3.6.0.tgz",