-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tooling] Expand browsers target while keeping Polyfills under control (
#709) * expand browsers target * add eslint-plugin-compat * sort polyfils * adjust readme * add polyfills sync check action * only build js * trim * add Element.prototype.closest * add closest to demo links * fix ignore
- Loading branch information
1 parent
e3cc6ea
commit 172366d
Showing
12 changed files
with
172 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
> 5% | ||
IE 11 | ||
> 1% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { readFileSync } = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
|
||
const readme = readFileSync(path.resolve(__dirname, '../../README.md'), 'utf8'); | ||
|
||
const polyfillsFromDocs = /^```polyfills\s*\n([^`]+)\n^```/m | ||
.exec(readme)[1] | ||
.split('\n') | ||
.map(v => v.trim()) | ||
.sort(); | ||
// @ts-ignore | ||
const polyfillsFromSettings = require('../../.eslintrc.json').settings.polyfills.sort(); | ||
assert.deepStrictEqual(polyfillsFromDocs, polyfillsFromSettings); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Polyfills documentation | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'README.md' | ||
- '.browserslistrc' | ||
- '.eslintrc.json' | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Check Polyfills documentation and settings sync | ||
run: node .github/actions-scripts/polyfills-sync.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
// get polyfill settings from top level config | ||
// @ts-ignore | ||
const { settings } = require('../../../.eslintrc.json'); | ||
|
||
// Adding non-polyfilable Symbol-related functions as they are most probably | ||
// behind the flag | ||
|
||
settings.polyfills.push('Symbol.toStringTag', 'Symbol.for', 'Object.getOwnPropertySymbols', 'Object.getOwnPropertyDescriptors') | ||
|
||
module.exports = /** @type {import('eslint').Linter.Config} */({ | ||
root: true, | ||
extends: [ | ||
"plugin:compat/recommended" | ||
], | ||
parserOptions: { | ||
// ensure that it's compatible with ES5 browsers, so, no `const`, etc | ||
ecmaVersion: 5 | ||
}, | ||
env: { | ||
browser: true | ||
}, | ||
settings | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters