Skip to content

Commit 53fd5d9

Browse files
authored
Merge pull request #1 from github/initial-impl
Initial implementation
2 parents f714842 + 55e281b commit 53fd5d9

29 files changed

+4586
-1
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
max_line_length = 120
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

.eslintrc.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"root": true,
3+
"plugins": ["github"],
4+
"extends": ["plugin:github/recommended", "plugin:github/typescript", "plugin:github/browser"],
5+
"rules": {
6+
"no-invalid-this": "off",
7+
"@typescript-eslint/no-invalid-this": ["error"],
8+
"import/extensions": ["error", "ignorePackages"],
9+
"import/no-namespace": "off",
10+
"import/no-unresolved": "off",
11+
"@typescript-eslint/consistent-type-imports": ["error", {"prefer": "type-imports"}]
12+
},
13+
"overrides": [
14+
{
15+
"files": "test/*",
16+
"rules": {
17+
"@typescript-eslint/no-empty-function": "off"
18+
},
19+
"globals": {
20+
"chai": false,
21+
"expect": false
22+
},
23+
"env": {
24+
"mocha": true
25+
}
26+
},
27+
{
28+
"files": "*.cjs",
29+
"env": {
30+
"node": true
31+
},
32+
"rules": {
33+
"import/no-commonjs": "off",
34+
"filenames/match-regex": "off",
35+
"@typescript-eslint/no-var-requires": "off"
36+
}
37+
}
38+
]
39+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib/
2+
node_modules/

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @github/web-systems-reviewers

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
11
# browser-support
22

3-
Polyfills & Capable Browser detection
3+
Polyfills for small new features, plus functions to determine browser feature support.
4+
5+
### How is this used on GitHub?
6+
7+
We use all of these polyfills on GitHub.com. We also use the `isSupported()` function to determine if the browser is well supported, unsupported browsers do not send errors or statistics to our backend monitoring.
8+
9+
## Installation
10+
11+
```
12+
$ npm install @github/browser-support
13+
```
14+
15+
## Usage
16+
17+
### JS
18+
19+
```js
20+
import {isSupported, isPolyfilled, apply} from '@github/browser-support'
21+
22+
// Check if a browser is supported
23+
if (!isSupported()) {
24+
apply()
25+
console.assert(isSupported() === true)
26+
console.assert(isPolyfilled() === true)
27+
}
28+
```
29+
30+
## Development
31+
32+
```
33+
npm install
34+
npm test
35+
```
36+
37+
## Contributing
38+
39+
### Adding polyfills
40+
41+
Please do not add any polyfills for ECMA features that are Stage 3 or below. We _only_ wish to polyfill features from ECMAScript that are Stage 4 (about to be included in a new years specification) or already specified.
42+
43+
### Removing polyfills
44+
45+
When our supported browsers (see github/github for details) all support a feature without polyfills, we can remove the polyfill. This code is designed to be kept lightweight, we do not want to ship dozens of kb of polyfills.
46+
47+
As a polyfill is removed, it may be worth adding feature detection to the `baseSupport` const, to ensure that our baseline moves with our browser support matrix.
48+
49+
## License
50+
51+
Distributed under the MIT license. See LICENSE for details.

0 commit comments

Comments
 (0)