Skip to content

Commit 3b4db77

Browse files
committed
2 parents 87c11e2 + 4d516c2 commit 3b4db77

File tree

6 files changed

+106
-12
lines changed

6 files changed

+106
-12
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"prettier/flowtype",
88
"prettier/react"
99
],
10-
"parser": "babel-eslint",
10+
"parser": "@babel/eslint-parser",
1111
"env": {
1212
"es2017": true
1313
},

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ node_modules
66
.eslintcache
77
*.js
88
*.js.flow
9+
*.ts
910
!/src/**/*.js
11+
!/src/**/*.ts
1012
!/test/**/*.js
1113
!/.babelrc.js
1214
!/webpack.config.js

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@
55
"main": "index.js",
66
"sideEffects": false,
77
"scripts": {
8-
"lint": "eslint src test --cache",
9-
"lint:fix": "eslint --fix src test --cache",
10-
"prettier": "prettier --write *.json *.md *.js '{src,test}/**/*.js'",
11-
"prettier:check": "prettier --list-different *.json *.md *.js '{src,test}/**/*.js'",
8+
"lint": "eslint $npm_package_config_eslint",
9+
"lint:fix": "eslint --fix $npm_package_config_eslint",
10+
"prettier": "prettier --write $npm_package_config_prettier",
11+
"prettier:check": "prettier --list-different $npm_package_config_prettier",
1212
"flow": "flow",
1313
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
14-
"clean": "rimraf es lib $(cd src; ls) *.js.flow",
15-
"build": "npm run clean && cross-env BABEL_ENV=production babel src --out-dir es && flow-copy-source -v src/ es && cross-env BABEL_ENV=es5 babel src --out-dir . && flow-copy-source -v src/ .",
14+
"clean": "rimraf es lib $(cd src; ls) *.js.flow *.d.ts",
15+
"build": "npm run clean && babel src --out-dir es && flow-copy-source -v src/ es && copy src/**/*.d.ts es && cross-env BABEL_ENV=es5 babel src --out-dir . && flow-copy-source -v src/ . && copy src/**/*.d.ts .",
1616
"test": "cross-env NODE_ENV=test BABEL_ENV=es5 mocha $npm_package_config_mocha && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
1717
"test:watch": "cross-env NODE_ENV=test BABEL_ENV=test mocha --watch $npm_package_config_mocha",
1818
"test:debug": "cross-env NODE_ENV=test BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
1919
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
20-
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && npm test && npm run build",
20+
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && tsc && npm test && npm run build",
2121
"open:coverage": "open coverage/lcov-report/index.html",
2222
"semantic-release": "semantic-release",
2323
"storybook": "start-storybook -p 6006",
2424
"build-storybook": "build-storybook"
2525
},
2626
"husky": {
2727
"hooks": {
28-
"pre-commit": "lint-staged && npm run lint && flow",
28+
"pre-commit": "lint-staged && npm run lint && flow && tsc",
2929
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
3030
"pre-push": "npm test"
3131
}
3232
},
3333
"lint-staged": {
34-
"*.{js,json,css,md}": [
34+
"*.{js,json,css,md,ts}": [
3535
"prettier --write"
3636
]
3737
},
@@ -47,6 +47,8 @@
4747
},
4848
"config": {
4949
"mocha": "-r @babel/register -r jsdom-global/register test/configure.js 'test/**/*.js'",
50+
"eslint": "src test --cache",
51+
"prettier": "*.{json,md,js} {src,test}/**/*.{js,ts}",
5052
"commitizen": {
5153
"path": "cz-conventional-changelog"
5254
}
@@ -79,6 +81,7 @@
7981
"devDependencies": {
8082
"@babel/cli": "^7.12.10",
8183
"@babel/core": "^7.12.10",
84+
"@babel/eslint-parser": "^7.12.13",
8285
"@babel/plugin-proposal-class-properties": "^7.12.1",
8386
"@babel/plugin-proposal-export-default-from": "^7.12.1",
8487
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
@@ -122,7 +125,8 @@
122125
"react": "^16.6.3",
123126
"react-dom": "^16.6.3",
124127
"rimraf": "^3.0.2",
125-
"semantic-release": "^17.3.7"
128+
"semantic-release": "^17.3.7",
129+
"typescript": "^4.1.3"
126130
},
127131
"dependencies": {
128132
"@babel/runtime": "^7.12.5",

src/index.d.ts

Whitespace-only changes.

tsconfig.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"include": ["./src/**/*.ts"],
3+
"exclude": ["node_modules"],
4+
"compilerOptions": {
5+
/* Basic Options */
6+
"target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
7+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
8+
"lib": [
9+
"es2019"
10+
] /* Specify library files to be included in the compilation. */,
11+
// "allowJs": true, /* Allow javascript files to be compiled. */
12+
// "checkJs": true, /* Report errors in .js files. */
13+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
14+
// "declaration": true /* Generates corresponding '.d.ts' file. */,
15+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
16+
// "sourceMap": true, /* Generates corresponding '.map' file. */
17+
// "outFile": "./", /* Concatenate and emit output to single file. */
18+
"outDir": "./" /* Redirect output structure to the directory. */,
19+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
20+
// "composite": true, /* Enable project compilation */
21+
// "removeComments": true, /* Do not emit comments to output. */
22+
"noEmit": true /* Do not emit outputs. */,
23+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
24+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26+
27+
/* Strict Type-Checking Options */
28+
"strict": true /* Enable all strict type-checking options. */,
29+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30+
// "strictNullChecks": true, /* Enable strict null checks. */
31+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
32+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
33+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
34+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
35+
36+
/* Additional Checks */
37+
// "noUnusedLocals": true, /* Report errors on unused locals. */
38+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
39+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
40+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41+
42+
/* Module Resolution Options */
43+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
44+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
45+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
46+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
47+
// "typeRoots": [], /* List of folders to include type definitions from. */
48+
// "types": [], /* Type declaration files to be included in compilation. */
49+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
50+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
51+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
52+
53+
/* Source Map Options */
54+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
55+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
56+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
57+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
58+
59+
/* Experimental Options */
60+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
61+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
// "declarationDir": "lib" /* Output directory for generated declaration files. */
65+
}
66+
}

yarn.lock

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
semver "^5.4.1"
5353
source-map "^0.5.0"
5454

55+
"@babel/eslint-parser@^7.12.13":
56+
version "7.12.13"
57+
resolved "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.12.13.tgz#f3158c28ed9eecd95fb75ee3015033b8b3b869b2"
58+
integrity sha512-+VF2M8ZWXc2KVf6L0tFcv6w8IZkCc1rvN65oj6hXxhYtOanlCA6ONpgEdy/HVGmcogu4El4ohdzuyfWYxSsKow==
59+
dependencies:
60+
eslint-scope "5.1.0"
61+
eslint-visitor-keys "^1.3.0"
62+
semver "^6.3.0"
63+
5564
"@babel/generator@^7.12.10", "@babel/generator@^7.12.11":
5665
version "7.12.11"
5766
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.12.11.tgz#98a7df7b8c358c9a37ab07a24056853016aba3af"
@@ -3376,6 +3385,14 @@ eslint-plugin-react@^7.22.0:
33763385
resolve "^1.18.1"
33773386
string.prototype.matchall "^4.0.2"
33783387

3388+
eslint-scope@5.1.0:
3389+
version "5.1.0"
3390+
resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5"
3391+
integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==
3392+
dependencies:
3393+
esrecurse "^4.1.0"
3394+
estraverse "^4.1.1"
3395+
33793396
eslint-scope@^5.0.0, eslint-scope@^5.1.1:
33803397
version "5.1.1"
33813398
resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -3479,7 +3496,7 @@ esquery@^1.0.1, esquery@^1.2.0:
34793496
dependencies:
34803497
estraverse "^5.1.0"
34813498

3482-
esrecurse@^4.3.0:
3499+
esrecurse@^4.1.0, esrecurse@^4.3.0:
34833500
version "4.3.0"
34843501
resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921"
34853502
integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==
@@ -8867,6 +8884,11 @@ typescript@^3.9.3:
88678884
resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
88688885
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
88698886

8887+
typescript@^4.1.3:
8888+
version "4.1.3"
8889+
resolved "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
8890+
integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
8891+
88708892
uglify-js@^3.1.4:
88718893
version "3.12.5"
88728894
resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.5.tgz#83241496087c640efe9dfc934832e71725aba008"

0 commit comments

Comments
 (0)