Skip to content

Commit

Permalink
Merge pull request #149 from javierbrea/release
Browse files Browse the repository at this point in the history
TypeScript docs
  • Loading branch information
javierbrea authored Aug 22, 2021
2 parents d202445 + 757bd5f commit 0d87d86
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
### BREAKING CHANGES

## [2.4.2] - 2021-08-22

### Added
- docs(#107): Add usage with TypeScript docs

### Changed
- chore(deps): Update devDependencies


## [2.4.1] - 2021-08-16

### Fixed
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ __This plugin ensures that your architecture boundaries are respected by the ele
* [Elements matchers](#elements-matchers)
* [Advanced example](#advanced-example)
- [Resolvers](#resolvers)
- [Usage with TypeScript](#usage-with-typescript)
- [Debug mode](#debug-mode)
- [Acknowledgements](#acknowledgements)
- [Contributing](#contributing)
Expand Down Expand Up @@ -387,6 +388,41 @@ This plugin uses `eslint-module-utils/resolve` module under the hood, which is a
}
```

## Usage with TypeScript

This plugin can be used also in [TypeScript](https://www.typescriptlang.org/) projects using `@typescript-eslint/eslint-plugin`. Follow next steps to configure it:

Install dependencies:

```bash
npm i --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-import-resolver-typescript
```

Configure [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint) as parser, load the [`@typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) plugin, and setup the [`eslint-import-resolver-typescript`](https://github.com/alexgorbatchev/eslint-import-resolver-typescript) resolver in the `.eslintrc.js` config file:

```js
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "boundaries"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:boundaries/recommended",
],
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
};
```

> Note that `eslint-import-resolver-typescript` detects even custom paths defined in the `tsconfig.json` file, so its usage is also compatible with this plugin.
In case you face any issue configuring it, you can also [use this repository as a guide](https://github.com/javierbrea/epb-ts-example). It contains a fully working and tested example.

## Debug mode

In order to help during the configuration process, the plugin can trace information about the files and imports being analyzed. The information includes the file path, the assigned element type, the captured values, etc. So, it can help you to check that your `elements` setting works as expected. You can enable it using the `ESLINT_PLUGIN_BOUNDARIES_DEBUG` environment variable.
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-boundaries",
"version": "2.4.1",
"version": "2.4.2",
"description": "Eslint plugin checking architecture boundaries between elements",
"keywords": [
"eslint",
Expand Down Expand Up @@ -31,7 +31,7 @@
"eslint": "^6.0.0 || ^7.0.0"
},
"dependencies": {
"eslint-import-resolver-node": "0.3.5",
"eslint-import-resolver-node": "0.3.6",
"eslint-module-utils": "2.6.2",
"chalk": "4.1.2",
"is-core-module": "2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sonar.organization=javierbrea
sonar.projectKey=javierbrea_eslint-plugin-boundaries
sonar.projectVersion=2.4.1
sonar.projectVersion=2.4.2

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down

0 comments on commit 0d87d86

Please sign in to comment.