Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,39 @@ Example of possible babel configuration:
// ...
```

## Usage with Jest

[Jest](https://jestjs.io/) currently (v27.4.2 at the time of writing) doesn't play nice with ES modules and [`package.json` exports](https://nodejs.org/api/packages.html#subpath-exports).
See [this issue](https://github.com/facebook/jest/issues/9771) about the exports support status.
Both problems are easily solved for the time being with a config tweak and the support of [`jest-node-exports-resolver`](https://github.com/k-g-a/jest-node-exports-resolver).

Example of Jest configuration:

```javascript
// ...

resolver: "jest-node-exports-resolver",
transformIgnorePatterns: ["node_modules/(?!@cgnal)"],

// ...
```

## Usage with `eslint-plugin-import`

[`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import) still have to support the aforementioned exports field.
You can refer to [this issue](https://github.com/import-js/eslint-plugin-import/issues/1868) to track the situation.
In the meanwhile you can add a custom resolver such as [`@tophat/eslint-import-resolver-require`](https://github.com/tophat/eslint-import-resolver-require) and tweak your configuration to use it:

```javascript
// ...

"settings": {
"import/resolver": "@tophat/eslint-import-resolver-require",
}

// ...
```

## NPM scripts and Gulp tasks

Only a few Gulp tasks are exposed as npm scripts, as such scripts are only a facilitation to run tasks without having to install [`gulp-cli`](https://www.npmjs.com/package/gulp-cli) as a global module.
Expand Down
43 changes: 33 additions & 10 deletions package-lock.json

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

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
"node": ">=12.0.0"
},
"exports": {
"./http": {
"default": "src/http/index.js"
}
"./http": "./src/http/index.js"
},
"files": [
"src",
Expand Down Expand Up @@ -49,7 +47,7 @@
"test": "gulp test"
},
"sideEffects": false,
"version": "0.1.0",
"version": "0.1.1",
"dependencies": {
"@babel/runtime-corejs3": "^7.16.3",
"core-js": "^3.19.2",
Expand All @@ -63,7 +61,7 @@
"del": "^6.0.0",
"docdash": "^1.2.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.0.3",
"eslint-plugin-jsdoc": "^37.1.0",
"gulp": "^4.0.2",
"gulp-eslint-new": "^1.0.0",
"gulp-jest": "^4.0.4",
Expand Down