chore: update standard and eslint-plugin-html (#1963)

This commit is contained in:
Nolan Lawson 2021-02-20 13:40:33 -08:00 committed by GitHub
parent e3d3249a20
commit 533360e32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 481 additions and 335 deletions

View File

@ -103,13 +103,13 @@
}, },
"devDependencies": { "devDependencies": {
"assert": "^2.0.0", "assert": "^2.0.0",
"eslint-plugin-html": "^6.1.0", "eslint-plugin-html": "^6.1.1",
"fake-indexeddb": "^3.1.2", "fake-indexeddb": "^3.1.2",
"globby": "^11.0.1", "globby": "^11.0.1",
"husky": "^5.0.9", "husky": "^5.0.9",
"lint-staged": "^10.5.4", "lint-staged": "^10.5.4",
"mocha": "^8.3.0", "mocha": "^8.3.0",
"standard": "^14.3.4", "standard": "^16.0.3",
"testcafe": "^1.11.0", "testcafe": "^1.11.0",
"vercel": "^20.1.0" "vercel": "^20.1.0"
}, },

View File

@ -95,7 +95,7 @@ A11yDialog.prototype.show = function (event) {
// attribute to `true`; in case they already have this attribute, keep a // attribute to `true`; in case they already have this attribute, keep a
// reference of their original value to be able to restore it later // reference of their original value to be able to restore it later
this._targets.forEach(function (target) { this._targets.forEach(function (target) {
var original = target.getAttribute('aria-hidden') const original = target.getAttribute('aria-hidden')
if (original) { if (original) {
target.setAttribute('data-a11y-dialog-original', original) target.setAttribute('data-a11y-dialog-original', original)
@ -142,7 +142,7 @@ A11yDialog.prototype.hide = function (event) {
// Iterate over the targets to enable them by remove their `aria-hidden` // Iterate over the targets to enable them by remove their `aria-hidden`
// attribute or resetting them to their initial value // attribute or resetting them to their initial value
this._targets.forEach(function (target) { this._targets.forEach(function (target) {
var original = target.getAttribute('data-a11y-dialog-original') const original = target.getAttribute('data-a11y-dialog-original')
if (original) { if (original) {
target.setAttribute('aria-hidden', original) target.setAttribute('aria-hidden', original)
@ -223,7 +223,7 @@ A11yDialog.prototype.on = function (type, handler) {
* @param {Function} handler * @param {Function} handler
*/ */
A11yDialog.prototype.off = function (type, handler) { A11yDialog.prototype.off = function (type, handler) {
var index = this._listeners[type].indexOf(handler) const index = this._listeners[type].indexOf(handler)
if (index > -1) { if (index > -1) {
this._listeners[type].splice(index, 1) this._listeners[type].splice(index, 1)
@ -241,7 +241,7 @@ A11yDialog.prototype.off = function (type, handler) {
* @param {Event} event * @param {Event} event
*/ */
A11yDialog.prototype._fire = function (type, event) { A11yDialog.prototype._fire = function (type, event) {
var listeners = this._listeners[type] || [] const listeners = this._listeners[type] || []
listeners.forEach(function (listener) { listeners.forEach(function (listener) {
listener(this.node, event) listener(this.node, event)
@ -334,7 +334,7 @@ function collect (target) {
* @param {Element} node * @param {Element} node
*/ */
function setFocusToFirstItem (node) { function setFocusToFirstItem (node) {
var focusableChildren = getFocusableChildren(node) const focusableChildren = getFocusableChildren(node)
if (focusableChildren.length) { if (focusableChildren.length) {
focusableChildren[0].focus() focusableChildren[0].focus()
@ -383,7 +383,7 @@ function getFocusableChildren (node) {
* @param {Event} event * @param {Event} event
*/ */
function trapTabKey (node, event) { function trapTabKey (node, event) {
var focusableChildren = getFocusableChildren(node) const focusableChildren = getFocusableChildren(node)
let activeElement = document.activeElement let activeElement = document.activeElement
for (const shadowRoot of shadowRoots) { for (const shadowRoot of shadowRoots) {
if (shadowRoot.getRootNode().host === activeElement) { if (shadowRoot.getRootNode().host === activeElement) {
@ -391,7 +391,7 @@ function trapTabKey (node, event) {
break break
} }
} }
var focusedItemIndex = focusableChildren.indexOf(activeElement) const focusedItemIndex = focusableChildren.indexOf(activeElement)
// If the SHIFT key is being pressed while tabbing (moving backwards) and // If the SHIFT key is being pressed while tabbing (moving backwards) and
// the currently focused item is the first one, move the focus to the last // the currently focused item is the first one, move the focus to the last
@ -415,8 +415,8 @@ function trapTabKey (node, event) {
* @return {Array<Element>} * @return {Array<Element>}
*/ */
function getSiblings (node) { function getSiblings (node) {
var nodes = toArray(node.parentNode.childNodes) const nodes = toArray(node.parentNode.childNodes)
var siblings = nodes.filter(function (node) { const siblings = nodes.filter(function (node) {
return node.nodeType === 1 return node.nodeType === 1
}) })

View File

@ -2,6 +2,9 @@
// is highlighted/selected // is highlighted/selected
export function normalizePageName (page) { export function normalizePageName (page) {
// notifications/mentions and settings/foo are a special case; they show as selected in the nav // notifications/mentions and settings/foo are a special case; they show as selected in the nav
return page === 'notifications/mentions' ? 'notifications' return page === 'notifications/mentions'
: (page && page.startsWith('settings/')) ? 'settings' : page ? 'notifications'
: (page && page.startsWith('settings/'))
? 'settings'
: page
} }

View File

@ -37,8 +37,7 @@ export function firstVisibleElementIndex (elements) {
const rect = element.getBoundingClientRect() const rect = element.getBoundingClientRect()
if (rect.top < offsetHeight && rect.bottom >= topOverlay) { if (rect.top < offsetHeight && rect.bottom >= topOverlay) {
first = i first = i
firstComplete = ( firstComplete = (rect.top < topOverlay && i < (len - 1)) ? i + 1 : i
rect.top < topOverlay && i < (len - 1)) ? i + 1 : i
break break
} }
} }

View File

@ -6,9 +6,11 @@ import { isChromePre82 } from '../_utils/userAgent/isChromePre82'
// Disabled in Chrome because convertToBlob() is slow // Disabled in Chrome because convertToBlob() is slow
// https://github.com/nolanlawson/pinafore/issues/1396 // https://github.com/nolanlawson/pinafore/issues/1396
const OFFSCREEN_CANVAS = !isChromePre82() && typeof OffscreenCanvas === 'function' const OFFSCREEN_CANVAS = !isChromePre82() && typeof OffscreenCanvas === 'function'
? new OffscreenCanvas(RESOLUTION, RESOLUTION) : null ? new OffscreenCanvas(RESOLUTION, RESOLUTION)
: null
const OFFSCREEN_CANVAS_CONTEXT_2D = OFFSCREEN_CANVAS const OFFSCREEN_CANVAS_CONTEXT_2D = OFFSCREEN_CANVAS
? OFFSCREEN_CANVAS.getContext('2d') : null ? OFFSCREEN_CANVAS.getContext('2d')
: null
registerPromiseWorker(async (encoded) => { registerPromiseWorker(async (encoded) => {
const pixels = decodeBlurHash(encoded, RESOLUTION, RESOLUTION) const pixels = decodeBlurHash(encoded, RESOLUTION, RESOLUTION)

View File

@ -101,6 +101,7 @@ test('Check status aria labels for de-emojified text', async t => {
.click(homeNavButton) .click(homeNavButton)
.click(displayNameInComposeBox) .click(displayNameInComposeBox)
.expect(getNthStatus(1).getAttribute('aria-label')).match( .expect(getNthStatus(1).getAttribute('aria-label')).match(
// eslint-disable-next-line prefer-regex-literals
new RegExp('foo, hey ho lotsa emojos, (.* ago|just now), @foobar, Public', 'i') new RegExp('foo, hey ho lotsa emojos, (.* ago|just now), @foobar, Public', 'i')
) )
.click(settingsNavButton) .click(settingsNavButton)

View File

@ -80,21 +80,23 @@ module.exports = {
node: { node: {
setImmediate: false setImmediate: false
}, },
optimization: dev ? {} : { optimization: dev
minimize: !process.env.DEBUG, ? {}
minimizer: [ : {
terser() minimize: !process.env.DEBUG,
], minimizer: [
// TODO: we should be able to enable this, but Sapper breaks if we do so terser()
// // isolate runtime chunk to avoid excessive cache invalidations https://webpack.js.org/guides/caching/ ],
// runtimeChunk: 'single', // TODO: we should be able to enable this, but Sapper breaks if we do so
splitChunks: { // // isolate runtime chunk to avoid excessive cache invalidations https://webpack.js.org/guides/caching/
chunks: 'async', // runtimeChunk: 'single',
minSize: 5000, splitChunks: {
maxAsyncRequests: Infinity, chunks: 'async',
maxInitialRequests: Infinity minSize: 5000,
} maxAsyncRequests: Infinity,
}, maxInitialRequests: Infinity
}
},
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.browser': true, 'process.browser': true,
@ -115,18 +117,20 @@ module.exports = {
failOnError: true, failOnError: true,
cwd: process.cwd() cwd: process.cwd()
}) })
].concat(dev ? [ ].concat(dev
new webpack.HotModuleReplacementPlugin({ ? [
requestTimeout: 120000 new webpack.HotModuleReplacementPlugin({
}) requestTimeout: 120000
] : [ })
]
: [
new BundleAnalyzerPlugin({ // generates report.html new BundleAnalyzerPlugin({ // generates report.html
analyzerMode: 'static', analyzerMode: 'static',
openAnalyzer: false, openAnalyzer: false,
logLevel: 'silent' logLevel: 'silent'
}) })
]), ]),
devtool: dev ? 'inline-source-map' : 'source-map', devtool: dev ? 'inline-source-map' : 'source-map',
performance: { performance: {
hints: dev ? false : (process.env.DEBUG ? 'warning' : 'error'), hints: dev ? false : (process.env.DEBUG ? 'warning' : 'error'),

View File

@ -60,9 +60,7 @@ module.exports = {
performance: { performance: {
hints: false // it doesn't matter if server.js is large hints: false // it doesn't matter if server.js is large
}, },
optimization: dev ? {} : { optimization: dev ? {} : { minimize: false },
minimize: false
},
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs), 'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs),

View File

@ -12,12 +12,14 @@ module.exports = {
resolve, resolve,
mode, mode,
devtool: dev ? 'inline-source-map' : 'source-map', devtool: dev ? 'inline-source-map' : 'source-map',
optimization: dev ? {} : { optimization: dev
minimize: !process.env.DEBUG, ? {}
minimizer: [ : {
terser() minimize: !process.env.DEBUG,
] minimizer: [
}, terser()
]
},
module: { module: {
rules: [ rules: [
{ {

703
yarn.lock

File diff suppressed because it is too large Load Diff