Skip to content

Commit d91338a

Browse files
committed
feat: rewrite with TypeScript and hooks
To provide a better experience for RNGlobalize users that are also using TypeScript, RNGlobalize has been rewritten in TypeScript, providing up-to-date typings builded with the package. Additionally, the library has moved to using hooks, which simplifies many of the component implementations. BREAKING CHANGE: The `withGlobalize` HOC has been removed in favor of using the `useContext` hook and the context is now exported as `GlobalizeContext` instead of `Context`. closes #47
1 parent 0470c66 commit d91338a

44 files changed

Lines changed: 4439 additions & 4062 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
11
{
2-
"extends": "airbnb",
3-
"parser": "babel-eslint",
4-
"env": {
5-
"browser": false,
6-
"jest": true,
7-
"node": true
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended",
5+
"airbnb"
6+
],
7+
"plugins": ["@typescript-eslint"],
8+
"settings": {
9+
"import/resolver": {
10+
"node": {
11+
"extensions": [
12+
".js",
13+
".jsx",
14+
".ts",
15+
".tsx"
16+
]
17+
}
18+
}
819
},
920
"rules": {
10-
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
11-
"no-param-reassign": ["error", { "props": false }],
12-
"no-underscore-dangle": "off",
13-
"import/extensions": "off",
14-
"import/no-extraneous-dependencies": ["error", {
15-
"devDependencies": ["gulpfile.js", "**/*.test.js"],
16-
"optionalDependencies": false,
17-
"peerDependencies": true
21+
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
22+
"no-underscore-dangle": ["error", { "allow": ["_raw"] }],
23+
"import/extensions": ["error", "ignorePackages", {
24+
"js": "never",
25+
"mjs": "never",
26+
"jsx": "never",
27+
"ts": "never",
28+
"tsx": "never"
1829
}],
19-
"import/no-unresolved": "off",
20-
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }],
21-
"react/require-default-props": "off"
30+
"import/prefer-default-export": "off",
31+
"react/jsx-filename-extension": ["error", { "extensions": [".jsx", ".tsx"] }],
32+
"react/prop-types": "off",
33+
"react/static-property-placement": ["error", "static public field"],
34+
"@typescript-eslint/ban-ts-ignore": "off",
35+
"@typescript-eslint/ban-types": "off",
36+
"@typescript-eslint/explicit-function-return-type": "off",
37+
"@typescript-eslint/no-explicit-any": "off",
38+
"@typescript-eslint/no-non-null-assertion": "off"
2239
}
2340
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
dist
2+
13
### Node ###
24
# Logs
35
logs

lib/components/FormattedCurrency.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

lib/components/FormattedDate.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

lib/components/FormattedMessage.js

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)