Skip to content

Commit 06dd492

Browse files
committed
refactor!: rewrite in TypeScript
1 parent 70ef058 commit 06dd492

File tree

10 files changed

+3079
-1114
lines changed

10 files changed

+3079
-1114
lines changed

.eslintrc

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
{
2-
"extends": "airbnb",
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+
}
19+
},
320
"rules": {
421
"class-methods-use-this": "off",
5-
"prefer-const": ["error", {"destructuring": "all"}],
6-
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "peerDependencies": true}],
7-
"react/jsx-filename-extension": ["error", {"extensions": [".js", ".jsx"]}],
8-
"react/require-default-props": "off"
22+
"import/extensions": ["error", "ignorePackages", {
23+
"js": "never",
24+
"mjs": "never",
25+
"jsx": "never",
26+
"ts": "never",
27+
"tsx": "never"
28+
}],
29+
"import/no-extraneous-dependencies": ["error", { "devDependencies": true, "peerDependencies": true }],
30+
"react/jsx-filename-extension": ["error", { "extensions": [".jsx", ".tsx"] }],
31+
"react/require-default-props": "off",
32+
"react/static-property-placement": ["error", "static public field"],
33+
"@typescript-eslint/explicit-function-return-type": "off",
34+
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }]
935
}
1036
}

.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

package.json

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "1.9.2",
44
"description": "Autolinking component for React Native",
55
"author": "Josh Swan <josh@disruptivelabs.io>",
6-
"main": "src/index.js",
7-
"types": "src/index.d.ts",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
88
"license": "MIT",
99
"repository": {
1010
"type": "git",
@@ -20,37 +20,45 @@
2020
"linking"
2121
],
2222
"files": [
23-
"src/",
23+
"dist/",
2424
"LICENSE",
2525
"README.md"
2626
],
2727
"scripts": {
28-
"lint": "eslint src/**/*.js test/**/*.js",
28+
"build": "tsc",
29+
"lint": "tsc --noEmit && eslint src --ext .ts,.tsx",
2930
"test": "mocha --require @babel/register --require test/setup.js --recursive test/*.test.js"
3031
},
3132
"dependencies": {
3233
"autolinker": "^3.11.1",
3334
"prop-types": "^15.7.2"
3435
},
3536
"devDependencies": {
36-
"@babel/core": "^7.7.2",
37-
"@babel/register": "^7.7.0",
37+
"@babel/core": "^7.8.4",
38+
"@babel/register": "^7.8.3",
39+
"@types/react": "^16.9.19",
40+
"@types/react-native": "^0.61.12",
41+
"@typescript-eslint/eslint-plugin": "^2.19.0",
42+
"@typescript-eslint/parser": "^2.19.0",
3843
"babel-eslint": "^10.0.3",
3944
"chai": "^4.2.0",
40-
"enzyme": "^3.10.0",
41-
"enzyme-adapter-react-16": "^1.15.1",
45+
"enzyme": "^3.11.0",
46+
"enzyme-adapter-react-16": "^1.15.2",
4247
"eslint": "^5.16.0",
4348
"eslint-config-airbnb": "^18.0.1",
4449
"eslint-plugin-import": "^2.18.2",
4550
"eslint-plugin-jsx-a11y": "^6.2.3",
4651
"eslint-plugin-react": "^7.14.3",
4752
"eslint-plugin-react-hooks": "^1.7.0",
53+
"jest": "^25.1.0",
4854
"mocha": "^6.2.2",
49-
"react": "16.9.0",
50-
"react-dom": "16.9.0",
51-
"react-native": "^0.61.4",
52-
"react-native-mock-render": "^0.1.7",
53-
"sinon": "^7.5.0"
55+
"react": "16.12.0",
56+
"react-dom": "16.12.0",
57+
"react-native": "^0.61.5",
58+
"react-native-mock-render": "^0.1.8",
59+
"sinon": "^8.1.1",
60+
"ts-node": "^8.6.2",
61+
"typescript": "^3.7.5"
5462
},
5563
"peerDependencies": {
5664
"react-native": ">=0.25.0"

src/index.d.ts

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

0 commit comments

Comments
 (0)