diff --git a/.eslintrc.json b/.eslintrc.json index b826af9..ae644d5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,7 +14,8 @@ "prettier", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:jest/recommended" ], "parserOptions": { "sourceType": "module", diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9dc13c..033d2ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: prerelease: false - uses: actions/setup-node@v1 with: - node-version: '12.x' + node-version: '16.x' registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm publish diff --git a/jestconfig.json b/jestconfig.json index d5929f1..eb79f0b 100644 --- a/jestconfig.json +++ b/jestconfig.json @@ -1,4 +1,5 @@ { + "testEnvironment": "jsdom", "transform": { "^.+\\.(t|j)sx?$": "ts-jest" }, diff --git a/package.json b/package.json index ce920e5..b7da7c7 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,10 @@ "private": false, "main": "dist/index.js", "typings": "dist/index.d.ts", + "engines": { + "npm": "^8", + "node": "^16" + }, "scripts": { "build": "tsc", "lint": "eslint --ext js,ts,tsx src", @@ -39,18 +43,19 @@ }, "homepage": "https://github.com/aboutbits/internationalization#readme", "devDependencies": { - "@types/node": "^14.11.5", - "@types/jest": "^26.0.9", - "@typescript-eslint/eslint-plugin": "^3.8.0", - "@typescript-eslint/parser": "^3.8.0", - "eslint": "^7.6.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-jest": "^23.20.0", - "eslint-plugin-prettier": "^3.1.4", - "jest": "^26.2.2", - "prettier": "^2.0.5", - "ts-jest": "^26.1.4", - "typescript": "^3.9.7" + "@types/jest": "^28.1.3", + "@types/node": "^16.0.0", + "@typescript-eslint/eslint-plugin": "^5.30.0", + "@typescript-eslint/parser": "^5.30.0", + "eslint": "^8.18.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jest": "^26.5.3", + "eslint-plugin-prettier": "^4.1.0", + "jest": "^28.1.2", + "jest-environment-jsdom": "^28.1.2", + "prettier": "^2.7.1", + "ts-jest": "^28.0.5", + "typescript": "^4.7.4" } } diff --git a/src/index.ts b/src/index.ts index 5d6a693..b385b7e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -113,9 +113,9 @@ class Internationalization { ) // Check if the potential locale is not undefined else return the fallback language - return (potentialLocale - ? potentialLocale.locale - : this.fallbackLanguage) as T + return ( + potentialLocale ? potentialLocale.locale : this.fallbackLanguage + ) as T } }