Skip to content

Commit bc2f3fc

Browse files
committed
Update for modern browsers
- adopt babel-preset-github (drop IE 11) - stop transforming custom element classes - check files with Flow
1 parent ebebcd0 commit bc2f3fc

File tree

5 files changed

+94
-180
lines changed

5 files changed

+94
-180
lines changed

.babelrc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
{
22
"env": {
33
"esm": {
4-
"plugins": [
5-
"@babel/plugin-proposal-object-rest-spread",
6-
"transform-custom-element-classes"
7-
],
8-
"presets": [
9-
["@babel/flow"],
10-
["@babel/env", {"modules": false}],
11-
]
4+
"presets": ["github"]
125
},
136
"umd": {
147
"plugins": [
15-
"@babel/plugin-proposal-object-rest-spread",
16-
"transform-custom-element-classes",
178
"@babel/plugin-transform-modules-umd"
189
],
19-
"presets": ["@babel/flow", "@babel/env"]
10+
"presets": ["github"]
2011
}
2112
}
2213
}

.eslintrc.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
{
22
"extends": [
3-
"plugin:github/es6",
43
"plugin:github/browser",
4+
"plugin:github/es6",
55
"plugin:github/flow"
6+
],
7+
"parser": "babel-eslint",
8+
"overrides": [
9+
{
10+
"files": "test/**/*.js",
11+
"rules": {
12+
"flowtype/require-valid-file-annotation": "off",
13+
"github/unescaped-html-literal": "off"
14+
}
15+
},
16+
{
17+
"files": "prettier.config.js",
18+
"rules": {
19+
"flowtype/require-valid-file-annotation": "off"
20+
}
21+
}
622
]
723
}

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict */
22

33
function keydown(fn: KeyboardEventHandler): KeyboardEventHandler {
44
return function(event: KeyboardEvent) {
@@ -248,14 +248,16 @@ function repeat(string: string, n: number): string {
248248
return Array(n + 1).join(string)
249249
}
250250

251-
function wordSelectionStart(text: string, index: number): number {
251+
function wordSelectionStart(text: string, i: number): number {
252+
let index = i
252253
while (text[index] && text[index - 1] != null && !text[index - 1].match(/\s/)) {
253254
index--
254255
}
255256
return index
256257
}
257258

258-
function wordSelectionEnd(text: string, index: number): number {
259+
function wordSelectionEnd(text: string, i: number): number {
260+
let index = i
259261
while (text[index] && !text[index].match(/\s/)) {
260262
index++
261263
}

package-lock.json

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

0 commit comments

Comments
 (0)