Skip to content

Commit

Permalink
⬆️ Upgrade eslint to 7
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Nov 23, 2023
1 parent cf29d41 commit c0d1056
Show file tree
Hide file tree
Showing 29 changed files with 5,576 additions and 3,518 deletions.
5,067 changes: 2,899 additions & 2,168 deletions functions/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
"@babel/preset-env": "^7.3.4",
"babel-eslint": "^10.0.1",
"babel-preset-minify": "^0.5.0",
"eslint": "^5.14.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint": "^7.0.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"webpack": "^4.29.5"
},
"private": true
Expand Down
7 changes: 5 additions & 2 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
},
],
'no-console': 'warn',
'space-before-function-paren': ['error', 'never'],
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
js: 'never',
Expand All @@ -40,13 +41,15 @@ module.exports = {
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'BINDING',
['UNIQUE', 'SLOT'],
'TWO_WAY_BINDING',
'DEFINITION',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'CONTENT',
'EVENTS',
],
alphabetical: false,
},
],
'vue/name-property-casing': ['error', 'kebab-case'],
Expand Down
14 changes: 7 additions & 7 deletions src/components/LikeButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,22 @@ export default {
},
debouncedSnapKnobProgress: _debounce(
// eslint-disable-next-line func-names
function () { this.snapKnobProgress(); },
function() { this.snapKnobProgress(); },
50,
),
setClientX(e) {
this.clientX = e.targetTouches ? e.targetTouches[0].clientX : e.clientX;
},
showLikeCountBubble() {
this.isShowLikeCountBubble = true;
if (this.bubbleTimer) clearTimeout(this.bubbleTimer);
if (this.bubbleTimer) { clearTimeout(this.bubbleTimer); }
this.bubbleTimer = setTimeout(() => {
this.isShowLikeCountBubble = false;
}, 500);
// If the bubble has already shown, scale the bubble a little bit bigger
const { likeCountBubble: el } = this.$refs;
if (el) TweenLite.to(el, 0.1, { scale: 1.1 }).reverse(0);
if (el) { TweenLite.to(el, 0.1, { scale: 1.1 }).reverse(0); }
},
clearLongPress() {
this.isLongPressingKnob = false;
Expand Down Expand Up @@ -293,7 +293,7 @@ export default {
if (e && e.button !== undefined && e.button !== 0) {
return; // handle left click only
}
if (this.hasMovedKnob) return;
if (this.hasMovedKnob) { return; }
if (this.isMax && this.isKnobMovable && !this.isLongPressingKnob) {
this.knobProgress = 1;
Expand All @@ -307,7 +307,7 @@ export default {
this.showLikeCountBubble();
},
onMovingKnob(e) {
if (!this.isPressingKnob) return;
if (!this.isPressingKnob) { return; }
if (requestAnimationFrame) {
requestAnimationFrame(() => this.updateKnobProgressByEvent(e));
Expand All @@ -322,7 +322,7 @@ export default {
}
},
onPressKnob(e) {
if (checkIsMobileClient()) return;
if (checkIsMobileClient()) { return; }
if (e && e.button !== undefined && e.button !== 0) {
return; // handle left click only
}
Expand All @@ -341,7 +341,7 @@ export default {
onReleaseKnob() {
this.clearLongPress();
if (!this.isPressingKnob) return;
if (!this.isPressingKnob) { return; }
this.isPressingKnob = false;
this.snapKnobProgress();
Expand Down
2 changes: 1 addition & 1 deletion src/components/LikeButtonClapEffect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
},
removeGraph(id) {
const index = this.graphIds.indexOf(id);
if (index >= 0) this.graphIds.splice(index, 1);
if (index >= 0) { this.graphIds.splice(index, 1); }
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/LikeButtonClapEffectGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export default {
methods: {
animate() {
const { graph } = this.$refs;
if (!graph) return;
if (!graph) { return; }
const allTriangles = [...graph.children].map(g => g.children);
if (allTriangles.length === 0) return;
if (allTriangles.length === 0) { return; }
const {
yMax, yMin, scaleMax, scaleMin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
rel="noopener"
:style="upgradeLabelStyle"
>
{{ this.$t('HintLabel.Upgrade') }}
{{ $t('HintLabel.Upgrade') }}
</a>
</foreignObject>

Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
layout: {
type: String,
validator(value) {
return ['small', 'large', 'fluid'].indexOf(value) !== -1;
return ['small', 'large', 'fluid'].includes(value);
},
default: 'fluid',
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/NFTWidget/ContentPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ export default {
return this.isClickable ? this.url : this.detailsUrl;
},
props() {
if (!this.isClickable) return {};
if (!this.isClickable) { return {}; }
return {
href: this.url,
rel: 'noopener noreferrer',
target: '_blank',
}
},
resizedSrc() {
if (this.isFixedSize) return getLikeCoResizedImageUrl(this.imgSrc, 360);
if (this.isFixedSize) { return getLikeCoResizedImageUrl(this.imgSrc, 360); }
return this.imgSrc;
},
titleClasses() {
Expand Down
10 changes: 5 additions & 5 deletions src/layouts/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export default {
required: true,
},
},
data() {
return {
HOMEPAGE,
};
},
head() {
return {
title: this.message,
Expand All @@ -34,11 +39,6 @@ export default {
],
};
},
data() {
return {
HOMEPAGE,
};
},
computed: {
statusCode() {
return (this.error && this.error.statusCode) || 500;
Expand Down
18 changes: 9 additions & 9 deletions src/mixins/embed-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
url = `/in/like/${this.id}/?referrer=${encodeURIComponent(this.referrer)}`;
}
url += '&popup=1';
if (this.buttonType) url += `&type=${encodeURIComponent(this.buttonType)}`;
if (this.buttonType) { url += `&type=${encodeURIComponent(this.buttonType)}`; }
return url;
},
isPreview() {
Expand Down Expand Up @@ -53,11 +53,11 @@ export default {
console.error(err);
}
window.addEventListener('message', this.handleWindowMessage);
if (this.isPreview) return;
if (this.isPreview) { return; }
this.hasCookieSupport = await this.getIsCookieSupport();
this.parentSuperLikeID = this.getParentSuperLikeID();
await this.updateUserSignInStatus();
if (this.onCheckCookieSupport) this.onCheckCookieSupport(this.hasCookieSupport);
if (this.onCheckCookieSupport) { this.onCheckCookieSupport(this.hasCookieSupport); }
this.isUserFetched = true;
},
beforeDestroy() {
Expand Down Expand Up @@ -90,14 +90,14 @@ export default {
},
async handleWindowMessage(event) {
const { data } = event;
if (typeof data !== 'object') return;
if (typeof data !== 'object') { return; }

/* public acitons */
if (event.source === window.parent || event.source === window.top) {
switch (data.action) {
case 'SET_REFERRER': {
const { referrer } = data.content;
if (referrer === undefined) return;
if (referrer === undefined) { return; }
this.$router.replace({
name: this.$route.name,
params: this.$route.params,
Expand Down Expand Up @@ -149,13 +149,13 @@ export default {

// For preview usage
case 'PREVIEW': {
if (!this.isPreview) return;
if (!this.isPreview) { return; }

const { user } = data.content;
if (user) {
if (user.user) this.id = user.user;
if (user.displayName) this.displayName = user.displayName;
if (user.avatar) this.avatar = user.avatar;
if (user.user) { this.id = user.user; }
if (user.displayName) { this.displayName = user.displayName; }
if (user.avatar) { this.avatar = user.avatar; }
this.avatarHalo = getAvatarHaloTypeFromUser(user);
}
break;
Expand Down
10 changes: 5 additions & 5 deletions src/mixins/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
let amount;
try {
const parse = parseInt(params.amount, 10);
if (parse && !Number.isNaN(parse)) amount = parse;
if (parse && !Number.isNaN(parse)) { amount = parse; }
} catch (e) {
// no op;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ export default {
error({ statusCode: 404, message: '' });
return {};
});
if (!data) return {};
if (!data) { return {}; }
const {
displayName,
avatar,
Expand Down Expand Up @@ -289,7 +289,7 @@ export default {
return integration;
},
documentReferrer() {
if (!process.client) return '';
if (!process.client) { return ''; }
let windowReferrer = '';
try {
if (window.opener) {
Expand Down Expand Up @@ -441,7 +441,7 @@ export default {
return res;
},
getParentSuperLikeID() {
if (!document.cookie || !isCookieEnabled()) return '';
if (!document.cookie || !isCookieEnabled()) { return ''; }
return getCookie('likebutton_superlike_id');
},
async updateSuperLikeStatus() {
Expand Down Expand Up @@ -479,7 +479,7 @@ export default {
isCookieSupport: this.hasCookieSupport,
...this.apiMetadata,
})
.then(async ({ data: myData }) => {
.then(async({ data: myData }) => {
const {
liker,
isSubscribed,
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/experiment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function experimentsMixin(
return {
computed: {
[propName]() {
if (!this.$exp || !isEligible(this)) return false;
if (!this.$exp || !isEligible(this)) { return false; }
const { name, $activeVariants } = this.$exp;
if (
this.$exp.isEligible &&
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default {
);
},
notifyParentOfResizing() {
if (!window.parent || !this.$refs.widget) return;
if (!window.parent || !this.$refs.widget) { return; }
const {
scrollWidth: width,
scrollHeight: height,
Expand Down
3 changes: 1 addition & 2 deletions src/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint import/no-extraneous-dependencies: "off" */
// eslint-disable-next-line nuxt/no-cjs-in-config
const path = require('path');

Check failure on line 2 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected require, please use import instead

Check failure on line 2 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected require, please use import instead

Check failure on line 2 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / Deploy

Unexpected require, please use import instead

const { IS_TESTNET } = process.env;
Expand Down Expand Up @@ -196,4 +195,4 @@ const nuxtConfig = {
};

/* do not use es6 export since we directly require() it in functions */
module.exports = nuxtConfig; // eslint-disable-line nuxt/no-cjs-in-config
module.exports = nuxtConfig;

Check failure on line 198 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected module.exports, please use export default instead

Check failure on line 198 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected module.exports, please use export default instead

Check failure on line 198 in src/nuxt.config.js

View workflow job for this annotation

GitHub Actions / Deploy

Unexpected module.exports, please use export default instead
Loading

0 comments on commit c0d1056

Please sign in to comment.