Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to typescript #253

Merged
merged 10 commits into from Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 3 additions & 14 deletions .eslintrc
@@ -1,13 +1,14 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jasmine/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["jasmine", "@typescript-eslint", "prettier"],
"ignorePatterns": [
"dist/**/*"
],
"rules": {
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-explicit-any": "off",
Expand All @@ -24,18 +25,6 @@
],
"jasmine/no-spec-dupes": ["warn", "branch"],
"jasmine/no-suite-dupes": ["warn", "branch"],
"valid-jsdoc": [
"warn",
{
"requireReturn": false,
"requireParamDescription": false,
"requireReturnDescription": false,
"prefer": {
"returns": "return",
"params": "param"
}
}
],
"complexity": ["warn", 7],
"no-param-reassign": ["error", { "props": false }],
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
Expand Down
11 changes: 11 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,11 @@
{
"eslint.nodePath": "./node_modules/eslint",
mindhells marked this conversation as resolved.
Show resolved Hide resolved
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"eslint.options": {
"overrideConfigFile": "./.eslintrc"
}
mindhells marked this conversation as resolved.
Show resolved Hide resolved
}
mindhells marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -81,5 +81,5 @@ npm test
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Added some feature'`
4. Check the build: `npm run build`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
5. Push to the branch: `git push origin my-new-feature`
6. Submit a pull request :D
11 changes: 0 additions & 11 deletions fixup
Copy link

@rchl rchl Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be something from before but I wonder what's the reasoning for adding those package.json files in the first place? I'm pretty sure that those don't really have any effect since it's the package's main package.json that decides whether something is an esm or commonjs module.

This file was deleted.

37 changes: 29 additions & 8 deletions package-lock.json

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

12 changes: 8 additions & 4 deletions package.json
Expand Up @@ -12,11 +12,11 @@
"index.d.ts"
],
"scripts": {
"lint": "eslint src/*.ts",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "ts-node --project tsconfig-cjs.json node_modules/jasmine/bin/jasmine",
"prebuild": "npm run test",
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./fixup",
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"prerelease": "npm run build",
"release": "npm version -m \"New version: %s\"",
"postrelease": "npm run push && npm publish",
Expand All @@ -30,15 +30,18 @@
]
},
"dependencies": {
"axios": "^1.6.2",
"is-retry-allowed": "^2.2.0"
},
"peerDependencies": {
"axios": "^0 || ^1"
mindhells marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/node": "^20.9.1",
"@types/jasmine": "^5.1.2",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"axios": "^1.6.2",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jasmine": "^4.1.3",
Expand All @@ -58,11 +61,12 @@
"bugs": {
"url": "https://github.com/softonic/axios-retry/issues"
},
"types": "dist/esm/index.d.ts",
"types": "dist/cjs/index.d.ts",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"exports": {
".": {
"types": "./dist/esm/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mindhells

This setup would result in the following error.

$ npx tsc
srv/app.ts:5:1 - error TS2349: This expression is not callable.
  Type 'typeof import("/home/study/workspace/ts-node-oidc/node_modules/axios-retry/dist/index")' has no call signatures.

5 axiosRetry(axios);
  ~~~~~~~~~~

A draft amendment is prepared below. We hope you will review it.

#255

},
Expand Down