Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

Commit

Permalink
Make tslint-react-hooks available (#85)
Browse files Browse the repository at this point in the history
Make tslint-react-hooks rule available
  • Loading branch information
karfau authored Mar 1, 2019
1 parent 993b15b commit 5384f32
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 10 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
steps:
- checkout

- run: npm --version
- run: npm install

- run:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
13 changes: 13 additions & 0 deletions tslint.report.available.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions tslint.report.sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@
"tslint": ">=5.1.0"
}
},
"./node_modules/tslint-react-hooks": {
"_from": "[email protected]",
"_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": "[email protected]",
"_resolved": "https://registry.npmjs.org/tslint-react/-/tslint-react-3.6.0.tgz",
Expand Down

0 comments on commit 5384f32

Please sign in to comment.