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": {
"assert": "^2.0.0",
"eslint-plugin-html": "^6.1.0",
"eslint-plugin-html": "^6.1.1",
"fake-indexeddb": "^3.1.2",
"globby": "^11.0.1",
"husky": "^5.0.9",
"lint-staged": "^10.5.4",
"mocha": "^8.3.0",
"standard": "^14.3.4",
"standard": "^16.0.3",
"testcafe": "^1.11.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
// reference of their original value to be able to restore it later
this._targets.forEach(function (target) {
var original = target.getAttribute('aria-hidden')
const original = target.getAttribute('aria-hidden')
if (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`
// attribute or resetting them to their initial value
this._targets.forEach(function (target) {
var original = target.getAttribute('data-a11y-dialog-original')
const original = target.getAttribute('data-a11y-dialog-original')
if (original) {
target.setAttribute('aria-hidden', original)
@ -223,7 +223,7 @@ A11yDialog.prototype.on = function (type, handler) {
* @param {Function} handler
*/
A11yDialog.prototype.off = function (type, handler) {
var index = this._listeners[type].indexOf(handler)
const index = this._listeners[type].indexOf(handler)
if (index > -1) {
this._listeners[type].splice(index, 1)
@ -241,7 +241,7 @@ A11yDialog.prototype.off = function (type, handler) {
* @param {Event} event
*/
A11yDialog.prototype._fire = function (type, event) {
var listeners = this._listeners[type] || []
const listeners = this._listeners[type] || []
listeners.forEach(function (listener) {
listener(this.node, event)
@ -334,7 +334,7 @@ function collect (target) {
* @param {Element} node
*/
function setFocusToFirstItem (node) {
var focusableChildren = getFocusableChildren(node)
const focusableChildren = getFocusableChildren(node)
if (focusableChildren.length) {
focusableChildren[0].focus()
@ -383,7 +383,7 @@ function getFocusableChildren (node) {
* @param {Event} event
*/
function trapTabKey (node, event) {
var focusableChildren = getFocusableChildren(node)
const focusableChildren = getFocusableChildren(node)
let activeElement = document.activeElement
for (const shadowRoot of shadowRoots) {
if (shadowRoot.getRootNode().host === activeElement) {
@ -391,7 +391,7 @@ function trapTabKey (node, event) {
break
}
}
var focusedItemIndex = focusableChildren.indexOf(activeElement)
const focusedItemIndex = focusableChildren.indexOf(activeElement)
// 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
@ -415,8 +415,8 @@ function trapTabKey (node, event) {
* @return {Array<Element>}
*/
function getSiblings (node) {
var nodes = toArray(node.parentNode.childNodes)
var siblings = nodes.filter(function (node) {
const nodes = toArray(node.parentNode.childNodes)
const siblings = nodes.filter(function (node) {
return node.nodeType === 1
})

View file

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

View file

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

View file

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

View file

@ -80,7 +80,9 @@ module.exports = {
node: {
setImmediate: false
},
optimization: dev ? {} : {
optimization: dev
? {}
: {
minimize: !process.env.DEBUG,
minimizer: [
terser()
@ -115,11 +117,13 @@ module.exports = {
failOnError: true,
cwd: process.cwd()
})
].concat(dev ? [
].concat(dev
? [
new webpack.HotModuleReplacementPlugin({
requestTimeout: 120000
})
] : [
]
: [
new BundleAnalyzerPlugin({ // generates report.html
analyzerMode: 'static',

View file

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

View file

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

703
yarn.lock

File diff suppressed because it is too large Load diff