Skip to content

Commit 2e14bea

Browse files
authored
Merge pull request #15 from github/tsc
Replace flow + babel with tsc
2 parents 2a59202 + 76690ae commit 2e14bea

16 files changed

Lines changed: 603 additions & 1302 deletions

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
dist
2-
prettier.config.js

.eslintrc.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": [
3-
"plugin:flowtype/recommended",
3+
"plugin:github/browser",
44
"plugin:github/es6",
5-
"plugin:github/browser"
6-
],
7-
"parser": "babel-eslint"
5+
"plugin:github/typescript"
6+
]
87
}

.flowconfig

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

index.d.ts

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

karma.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
module.exports = function(config) {
22
config.set({
33
frameworks: ['mocha', 'chai'],
4-
files: [{pattern: 'dist/index.esm.js', type: 'module'}, {pattern: 'test/test.js', type: 'module'}],
4+
files: [
5+
{pattern: 'dist/index.esm.js', type: 'module'},
6+
{pattern: 'test/test.js', type: 'module'}
7+
],
58
reporters: ['mocha'],
69
port: 9876,
710
colors: true,

package-lock.json

Lines changed: 548 additions & 1225 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"repository": "github/paste-markdown",
66
"main": "dist/index.umd.js",
77
"module": "dist/index.esm.js",
8-
"types": "index.d.ts",
8+
"types": "dist/index.d.ts",
99
"scripts": {
1010
"clean": "rm -rf dist",
1111
"lint": "github-lint",
1212
"prebuild": "npm run clean && npm run lint && mkdir dist",
13-
"build": "rollup -c && cp src/index.js.flow dist/index.umd.js.flow && cp src/index.js.flow dist/index.esm.js.flow",
13+
"build": "rollup -c",
1414
"pretest": "npm run build",
1515
"test": "karma start karma.config.js",
1616
"prepublishOnly": "npm run build",
@@ -22,24 +22,22 @@
2222
],
2323
"license": "MIT",
2424
"files": [
25-
"dist",
26-
"index.d.ts"
25+
"dist/index.d.ts",
26+
"dist/index.esm.js",
27+
"dist/index.umd.js"
2728
],
2829
"devDependencies": {
29-
"@babel/core": "^7.7.0",
30-
"babel-eslint": "^10.0.3",
31-
"babel-preset-github": "^3.2.1",
3230
"chai": "^4.2.0",
33-
"eslint": "^6.6.0",
34-
"eslint-plugin-github": "^3.2.1",
35-
"flow-bin": "^0.111.1",
31+
"eslint": "^6.8.0",
32+
"eslint-plugin-github": "^3.4.0",
3633
"karma": "^4.4.1",
3734
"karma-chai": "^0.1.0",
3835
"karma-chrome-launcher": "^3.1.0",
3936
"karma-mocha": "^1.3.0",
4037
"karma-mocha-reporter": "^2.2.5",
4138
"mocha": "^7.0.1",
42-
"rollup": "^1.26.3",
43-
"rollup-plugin-babel": "^4.3.3"
39+
"rollup": "^1.31.1",
40+
"rollup-plugin-typescript2": "^0.26.0",
41+
"typescript": "^3.7.5"
4442
}
4543
}

rollup.config.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
/* @flow strict */
2-
3-
import babel from 'rollup-plugin-babel'
4-
5-
const pkg = require('./package.json')
6-
1+
import typescript from 'rollup-plugin-typescript2'
2+
import pkg from './package.json'
73
export default {
8-
input: 'src/index.js',
4+
input: 'src/index.ts',
95
output: [
106
{
117
file: pkg['module'],
@@ -17,9 +13,5 @@ export default {
1713
name: 'paste-markdown'
1814
}
1915
],
20-
plugins: [
21-
babel({
22-
presets: ['github']
23-
})
24-
]
16+
plugins: [typescript()]
2517
}

src/index.js.flow

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

src/index.js renamed to src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
/* @flow strict */
2-
31
import {install as installLink, uninstall as uninstallLink} from './paste-markdown-image-link'
42
import {install as installTable, uninstall as uninstallTable} from './paste-markdown-table'
53
import {install as installText, uninstall as uninstallText} from './paste-markdown-text'
64

7-
type Subscription = {|
5+
interface Subscription {
86
unsubscribe: () => void
9-
|}
7+
}
108

11-
export default function subscribe(el: Element): Subscription {
9+
export default function subscribe(el: HTMLElement): Subscription {
1210
installTable(el)
1311
installLink(el)
1412
installText(el)

0 commit comments

Comments
 (0)