Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Lint

Liyas Thomas1587a44cd7ae
diff --git a/assets/css/fonts.scss b/assets/css/fonts.scss
index ecb70d187..d1c89084e 100644
--- a/assets/css/fonts.scss
+++ b/assets/css/fonts.scss
@@ -9,7 +9,7 @@
// Do not use font-display: swap for the icon font - it looks really bad when the page
// loads.
font-display: block;
- src: url("~static/fonts/material-icons-v48.woff2") format("woff2");
+ src: url("~static/fonts/material-icons-v52.woff2") format("woff2");
}
.material-icons {
@@ -40,9 +40,7 @@
font-display: swap;
src: local("Poppins Medium"), local("Poppins-Medium"),
url("~static/fonts/poppins-v9-latin-500.woff2") format("woff2"),
- /* Chrome 26+, Opera 23+, Firefox 39+ */
- url("~static/fonts/poppins-v9-latin-500.woff") format("woff");
- /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+ url("~static/fonts/poppins-v9-latin-500.woff") format("woff");
}
/* poppins-700 - latin */
@@ -53,9 +51,7 @@
font-display: swap;
src: local("Poppins Bold"), local("Poppins-Bold"),
url("~static/fonts/poppins-v9-latin-700.woff2") format("woff2"),
- /* Chrome 26+, Opera 23+, Firefox 39+ */
- url("~static/fonts/poppins-v9-latin-700.woff") format("woff");
- /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+ url("~static/fonts/poppins-v9-latin-700.woff") format("woff");
}
/* roboto-mono-regular - latin */
@@ -66,7 +62,5 @@
font-display: swap;
src: local("Roboto Mono"), local("RobotoMono-Regular"),
url("~static/fonts/roboto-mono-v7-latin-regular.woff2") format("woff2"),
- /* Chrome 26+, Opera 23+, Firefox 39+ */
- url("~static/fonts/roboto-mono-v7-latin-regular.woff") format("woff");
- /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+ url("~static/fonts/roboto-mono-v7-latin-regular.woff") format("woff");
}
diff --git a/assets/css/styles.scss b/assets/css/styles.scss
index ec15fc503..9004e0d5c 100644
--- a/assets/css/styles.scss
+++ b/assets/css/styles.scss
@@ -389,7 +389,7 @@ button {
// justify-content: center;
margin: 4px;
padding: 6px 16px;
- border-radius: 20px;
+ border-radius: 8px;
background-color: var(--ac-color);
color: var(--act-color);
font-size: 16px;
@@ -457,7 +457,7 @@ button {
fieldset {
margin: 16px 0;
- border-radius: 16px;
+ border-radius: 8px;
background-color: var(--bg-dark-color);
transition: all 0.2s ease-in-out;
@@ -814,7 +814,7 @@ ol li {
section {
display: flex;
flex-wrap: wrap;
- border-radius: 16px;
+ border-radius: 8px;
}
.toasted-container .toasted {
diff --git a/assets/js/curlparser.js b/assets/js/curlparser.js
index fb0a2fc39..a0d097eb1 100644
--- a/assets/js/curlparser.js
+++ b/assets/js/curlparser.js
@@ -7,7 +7,7 @@ import * as querystring from "querystring"
* output this: 'msg1=value1&msg2=value2'
* @param dataArguments
*/
-const joinDataArguments = dataArguments => {
+const joinDataArguments = (dataArguments) => {
let data = ""
dataArguments.forEach((argument, i) => {
if (i === 0) {
@@ -19,7 +19,7 @@ const joinDataArguments = dataArguments => {
return data
}
-const parseCurlCommand = curlCommand => {
+const parseCurlCommand = (curlCommand) => {
let newlineFound = /\r|\n/.exec(curlCommand)
if (newlineFound) {
// remove newlines
@@ -47,7 +47,7 @@ const parseCurlCommand = curlCommand => {
}
let headers
- const parseHeaders = headerFieldName => {
+ const parseHeaders = (headerFieldName) => {
if (parsedArguments[headerFieldName]) {
if (!headers) {
headers = {}
@@ -55,7 +55,7 @@ const parseCurlCommand = curlCommand => {
if (!Array.isArray(parsedArguments[headerFieldName])) {
parsedArguments[headerFieldName] = [parsedArguments[headerFieldName]]
}
- parsedArguments[headerFieldName].forEach(header => {
+ parsedArguments[headerFieldName].forEach((header) => {
if (header.includes("Cookie")) {
// stupid javascript tricks: closure
cookieString = header
@@ -95,7 +95,7 @@ const parseCurlCommand = curlCommand => {
if (!Array.isArray(parsedArguments.F)) {
parsedArguments.F = [parsedArguments.F]
}
- parsedArguments.F.forEach(multipartArgument => {
+ parsedArguments.F.forEach((multipartArgument) => {
// input looks like key=value. value could be json or a file path prepended with an @
const [key, value] = multipartArgument.split("=", 2)
multipartUploads[key] = value
@@ -103,7 +103,7 @@ const parseCurlCommand = curlCommand => {
}
if (cookieString) {
const cookieParseOptions = {
- decode: s => s,
+ decode: (s) => s,
}
// separate out cookie headers into separate data structure
// note: cookie is case insensitive
diff --git a/assets/js/oauth.js b/assets/js/oauth.js
index a37ddeb40..bebac822c 100644
--- a/assets/js/oauth.js
+++ b/assets/js/oauth.js
@@ -12,7 +12,7 @@ const redirectUri = `${window.location.origin}/`
const sendPostRequest = async (url, params) => {
const body = Object.keys(params)
- .map(key => `${key}=${params[key]}`)
+ .map((key) => `${key}=${params[key]}`)
.join("&")
const options = {
method: "post",
@@ -38,11 +38,11 @@ const sendPostRequest = async (url, params) => {
* @returns {Object}
*/
-const parseQueryString = searchQuery => {
+const parseQueryString = (searchQuery) => {
if (searchQuery === "") {
return {}
}
- const segments = searchQuery.split("&").map(s => s.split("="))
+ const segments = searchQuery.split("&").map((s) => s.split("="))
const queryString = segments.reduce((obj, el) => ({ ...obj, [el[0]]: el[1] }), {})
return queryString
}
@@ -53,7 +53,7 @@ const parseQueryString = searchQuery => {
* @returns {Object}
*/
-const getTokenConfiguration = async endpoint => {
+const getTokenConfiguration = async (endpoint) => {
const options = {
method: "GET",
headers: {
@@ -81,7 +81,7 @@ const getTokenConfiguration = async endpoint => {
const generateRandomString = () => {
const array = new Uint32Array(28)
window.crypto.getRandomValues(array)
- return Array.from(array, dec => `0${dec.toString(16)}`.substr(-2)).join("")
+ return Array.from(array, (dec) => `0${dec.toString(16)}`.substr(-2)).join("")
}
/**
@@ -90,7 +90,7 @@ const generateRandomString = () => {
* @returns {Promise<ArrayBuffer>}
*/
-const sha256 = plain => {
+const sha256 = (plain) => {
const encoder = new TextEncoder()
const data = encoder.encode(plain)
return window.crypto.subtle.digest("SHA-256", data)
@@ -121,7 +121,7 @@ const base64urlencode = (
* @returns {String}
*/
-const pkceChallengeFromVerifier = async v => {
+const pkceChallengeFromVerifier = async (v) => {
const hashed = await sha256(v)
return base64urlencode(hashed)
}
diff --git a/assets/js/pwa.js b/assets/js/pwa.js
index cdecc3854..2ef76b641 100644
--- a/assets/js/pwa.js
+++ b/assets/js/pwa.js
@@ -18,7 +18,7 @@ export default () => {
//*** If the PWA has not been installed, show the install PWA prompt.. ***//
let deferredPrompt = null
- window.addEventListener("beforeinstallprompt", event => {
+ window.addEventListener("beforeinstallprompt", (event) => {
deferredPrompt = event
// Show the install button if the prompt appeared.
@@ -28,7 +28,7 @@ export default () => {
})
// When the app is installed, remove install prompts.
- window.addEventListener("appinstalled", event => {
+ window.addEventListener("appinstalled", (event) => {
localStorage.setItem("pwaInstalled", "yes")
pwaInstalled = true
document.getElementById("installPWA").style.display = "none"
diff --git a/components/collections/collection.vue b/components/collections/collection.vue
index c59209826..a490f7a09 100644
--- a/components/collections/collection.vue
+++ b/components/collections/collection.vue
@@ -120,7 +120,7 @@ export default {
this.$store.commit("postwoman/removeCollection", {
collectionIndex: this.collectionIndex,
})
- this.syncCollections();
+ this.syncCollections()
},
editFolder(collectionIndex, folder, folderIndex) {
this.$emit("edit-folder", { collectionIndex, folder, folderIndex })
diff --git a/components/collections/editCollection.vue b/components/collections/editCollection.vue
index 96c9bde52..a25b4d99f 100644
--- a/components/collections/editCollection.vue
+++ b/components/collections/editCollection.vue
@@ -80,8 +80,8 @@ export default {
collection: collectionUpdated,
collectionIndex: this.$props.editingCollectionIndex,
})
- this.$emit("hide-modal");
- this.syncCollections();
+ this.$emit("hide-modal")
+ this.syncCollections()
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/editFolder.vue b/components/collections/editFolder.vue
index 0a161f903..38506700b 100644
--- a/components/collections/editFolder.vue
+++ b/components/collections/editFolder.vue
@@ -71,7 +71,7 @@ export default {
folderIndex: this.$props.folderIndex,
})
this.hideModal()
- this.syncCollections();
+ this.syncCollections()
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/editRequest.vue b/components/collections/editRequest.vue
index b8bb99a4b..289c57005 100644
--- a/components/collections/editRequest.vue
+++ b/components/collections/editRequest.vue
@@ -139,7 +139,7 @@ export default {
})
this.hideModal()
- this.syncCollections();
+ this.syncCollections()
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/folder.vue b/components/collections/folder.vue
index 89e5c1ef5..8c652e9bb 100644
--- a/components/collections/folder.vue
+++ b/components/collections/folder.vue
@@ -106,7 +106,7 @@ export default {
collectionIndex: this.collectionIndex,
folderIndex: this.folderIndex,
})
- this.syncCollections();
+ this.syncCollections()
},
editFolder() {
this.$emit("edit-folder")
diff --git a/components/collections/index.vue b/components/collections/index.vue
index 77db8ad86..e7579c5d8 100644
--- a/components/collections/index.vue
+++ b/components/collections/index.vue
@@ -135,7 +135,8 @@ export default {
computed: {
collections() {
return fb.currentUser !== null
- ? fb.currentCollections : this.$store.state.postwoman.collections
+ ? fb.currentCollections
+ : this.$store.state.postwoman.collections
},
},
async mounted() {
diff --git a/components/collections/request.vue b/components/collections/request.vue
index d55b8f59d..43eede7d0 100644
--- a/components/collections/request.vue
+++ b/components/collections/request.vue
@@ -69,7 +69,7 @@ export default {
folderIndex: this.folderIndex,
requestIndex: this.requestIndex,
})
- this.syncCollections();
+ this.syncCollections()
},
},
}
diff --git a/components/environments/index.vue b/components/environments/index.vue
index e3f3af215..a17a9af5f 100644
--- a/components/environments/index.vue
+++ b/components/environments/index.vue
@@ -83,7 +83,8 @@ export default {
computed: {
environments() {
return fb.currentUser !== null
- ? fb.currentEnvironments : this.$store.state.postwoman.environments
+ ? fb.currentEnvironments
+ : this.$store.state.postwoman.environments
},
},
async mounted() {
diff --git a/components/firebase/logout.vue b/components/firebase/logout.vue
index 4363a6385..2d7507330 100644
--- a/components/firebase/logout.vue
+++ b/components/firebase/logout.vue
@@ -24,7 +24,7 @@ export default {
firebase
.auth()
.signOut()
- .catch(err => {
+ .catch((err) => {
self.$toast.show(err.message || err, {
icon: "error",
})
diff --git a/components/graphql/field.vue b/components/graphql/field.vue
index 5200a1d3f..faee9fe98 100644
--- a/components/graphql/field.vue
+++ b/components/graphql/field.vue
@@ -38,7 +38,7 @@
display: inline-block;
padding: 4px 8px;
margin: 4px 0;
- border-radius: 4px;
+ border-radius: 8px;
font-size: 14px;
font-weight: 700;
}
diff --git a/components/layout/header.vue b/components/layout/header.vue
index 610e1d33a..9588fa161 100644
--- a/components/layout/header.vue
+++ b/components/layout/header.vue
@@ -113,14 +113,11 @@
</svg>
<span>{{ $t("tweet") }}</span>
</button>
- <button
- v-if="navigatorShare"
- class="icon"
- @click="nativeShare"
- v-close-popover
- v-tooltip="$t('more')"
- >
+ </div>
+ <div v-if="navigatorShare">
+ <button class="icon" @click="nativeShare" v-close-popover v-tooltip="$t('more')">
<i class="material-icons">share</i>
+ <span>Share</span>
</button>
</div>
</template>
diff --git a/components/layout/logo.vue b/components/layout/logo.vue
index ece25547c..29ded0081 100644
--- a/components/layout/logo.vue
+++ b/components/layout/logo.vue
@@ -5,7 +5,7 @@
x="0px"
y="0px"
viewBox="0 0 612.001 612.001"
- style="enable-background:new 0 0 612.001 612.001;"
+ style="enable-background: new 0 0 612.001 612.001;"
xml:space="preserve"
>
<defs id="defs11" />
@@ -13,7 +13,7 @@
<circle
:fill="color"
transform="scale(1,-1)"
- style="stroke-width:1.19531453"
+ style="stroke-width: 1.19531453;"
r="178.70923"
cy="-501.55591"
cx="822.40845"
diff --git a/components/realtime/log.vue b/components/realtime/log.vue
index 0bd3fbbdb..acd1ce287 100644
--- a/components/realtime/log.vue
+++ b/components/realtime/log.vue
@@ -47,8 +47,8 @@ export default {
methods: {
getSourcePrefix,
},
- updated: function() {
- this.$nextTick(function() {
+ updated: function () {
+ this.$nextTick(function () {
if (this.$refs.log) {
this.$refs.log.scrollBy(0, this.$refs.log.scrollHeight + 100)
}
diff --git a/components/realtime/mqtt.vue b/components/realtime/mqtt.vue
index ab15ef4e7..889405981 100644
--- a/components/realtime/mqtt.vue
+++ b/components/realtime/mqtt.vue
@@ -77,7 +77,7 @@ export default {
"pw-section": () => import("../../components/layout/section"),
realtimeLog: () => import("./log"),
},
- data: function() {
+ data: function () {
return {
url: "wss://test.mosquitto.org:8081",
client: null,
diff --git a/components/ui/ace-editor.vue b/components/ui/ace-editor.vue
index 2b5140ddc..ce4303e04 100644
--- a/components/ui/ace-editor.vue
+++ b/components/ui/ace-editor.vue
@@ -120,7 +120,7 @@ export default {
return this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME
},
- provideLinting: debounce(function(code) {
+ provideLinting: debounce(function (code) {
if (this.lang === "json") {
try {
jsonParse(code)
diff --git a/components/ui/autocomplete.vue b/components/ui/autocomplete.vue
index c2f64f619..534ce5b74 100644
--- a/components/ui/autocomplete.vue
+++ b/components/ui/autocomplete.vue
@@ -194,14 +194,14 @@ export default {
return (
this.source
- .filter(entry => {
+ .filter((entry) => {
return (
entry.toLowerCase().startsWith(input.toLowerCase()) &&
input.toLowerCase() !== entry.toLowerCase()
)
})
// Cut off the part that's already been typed.
- .map(entry => entry.substring(this.selectionStart))
+ .map((entry) => entry.substring(this.selectionStart))
// We only want the top 6 suggestions.
.slice(0, 6)
)
diff --git a/components/ui/modal.vue b/components/ui/modal.vue
index 78b12c1b7..da6862d27 100644
--- a/components/ui/modal.vue
+++ b/components/ui/modal.vue
@@ -50,7 +50,7 @@
padding: 16px;
transition: all 0.2s ease;
background-color: var(--bg-color);
- border-radius: 16px;
+ border-radius: 8px;
box-shadow: 0px 16px 70px rgba(0, 0, 0, 0.5);
max-height: calc(100vh - 128px);
max-width: 720px;
diff --git a/components/ui/tabs.vue b/components/ui/tabs.vue
index 8c5af7f7f..63347b365 100644
--- a/components/ui/tabs.vue
+++ b/components/ui/tabs.vue
@@ -2,7 +2,7 @@
<div class="tabs-wrapper">
<div class="tabs">
<ul>
- <li v-for="tab in tabs" :class="{ 'is-active': tab.isActive }">
+ <li v-for="(tab, index) in tabs" :class="{ 'is-active': tab.isActive }" :key="index">
<a :href="tab.href" @click="selectTab(tab)">
<i v-if="tab.icon" class="material-icons">
{{ tab.icon }}
@@ -45,7 +45,7 @@
justify-content: center;
padding: 8px 16px;
color: var(--fg-light-color);
- border-radius: 4px;
+ border-radius: 8px;
cursor: pointer;
.material-icons {
@@ -87,7 +87,7 @@ export default {
methods: {
selectTab({ id }) {
- this.tabs.forEach(tab => {
+ this.tabs.forEach((tab) => {
tab.isActive = tab.id == id
})
},
diff --git a/functions/postwomanTesting.js b/functions/postwomanTesting.js
index 56466ef50..c1fed8cc1 100644
--- a/functions/postwomanTesting.js
+++ b/functions/postwomanTesting.js
@@ -31,7 +31,7 @@ export default function runTestScriptWithVariables(script, variables) {
// run pre-request script within this function so that it has access to the pw object.
new Function("pw", script)(pw)
//
- const testReports = pw._testReports.map(item => {
+ const testReports = pw._testReports.map((item) => {
if (item.result) {
item.styles = styles[item.result]
} else {
@@ -64,7 +64,7 @@ class Expectation {
this.expectValue = expectValue
this.not = _not || new Expectation(this.expectValue, true, _testReports)
this._testReports = _testReports // this values is used within Test.it, which wraps Expectation and passes _testReports value.
- this._satisfies = function(expectValue, targetValue) {
+ this._satisfies = function (expectValue, targetValue) {
// Used for testing if two values match the expectation, which could be === OR !==, depending on if not
// was used. Expectation#_satisfies prevents the need to have an if(this.not) branch in every test method.
// Signature is _satisfies([expectValue,] targetValue): if only one argument is given, it is assumed the targetValue, and expectValue is set to this.expectValue
diff --git a/functions/utils/debounce.js b/functions/utils/debounce.js
index a5e9fdb1e..0db17993b 100644
--- a/functions/utils/debounce.js
+++ b/functions/utils/debounce.js
@@ -4,7 +4,7 @@
// NOTE : Don't use lambda functions as this doesn't get bound properly in them, use the 'function (args) {}' format
const debounce = (func, delay) => {
let inDebounce
- return function() {
+ return function () {
const context = this
const args = arguments
clearTimeout(inDebounce)
diff --git a/middleware/parsedefaulturl.js b/middleware/parsedefaulturl.js
index 7b3d49a7e..424d44604 100644
--- a/middleware/parsedefaulturl.js
+++ b/middleware/parsedefaulturl.js
@@ -1,4 +1,4 @@
-export default function({ route, redirect }) {
+export default function ({ route, redirect }) {
if (route.fullPath !== "/") {
return redirect("/")
}
diff --git a/static/fonts/material-icons-v48.woff2 b/static/fonts/material-icons-v48.woff2
deleted file mode 100644
index 34cdd2afb..000000000
Binary files a/static/fonts/material-icons-v48.woff2 and /dev/null differ
diff --git a/static/fonts/material-icons-v52.woff2 b/static/fonts/material-icons-v52.woff2
new file mode 100644
index 000000000..2546ee686
Binary files /dev/null and b/static/fonts/material-icons-v52.woff2 differ
diff --git a/store/mutations.js b/store/mutations.js
index d577b8339..1f637cd73 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -9,7 +9,7 @@ export default {
setCollapsedSection({ theme }, value) {
theme.collapsedSections.includes(value)
- ? (theme.collapsedSections = theme.collapsedSections.filter(section => section !== value))
+ ? (theme.collapsedSections = theme.collapsedSections.filter((section) => section !== value))
: theme.collapsedSections.push(value)
},
diff --git a/tests/e2e/integration/app.starter.spec.js b/tests/e2e/integration/app.starter.spec.js
index 70c134f0a..bdd72f9c3 100644
--- a/tests/e2e/integration/app.starter.spec.js
+++ b/tests/e2e/integration/app.starter.spec.js
@@ -1,7 +1,5 @@
describe("Visit Home", () => {
it('Have a page title with "Postwoman"', () => {
- cy.visit("/", { retryOnStatusCodeFailure: true })
- .get("title")
- .should("contain", "Postwoman")
+ cy.visit("/", { retryOnStatusCodeFailure: true }).get("title").should("contain", "Postwoman")
})
})
diff --git a/tests/e2e/integration/feature.url-queries.spec.js b/tests/e2e/integration/feature.url-queries.spec.js
index 3ce949a4c..295c2628d 100644
--- a/tests/e2e/integration/feature.url-queries.spec.js
+++ b/tests/e2e/integration/feature.url-queries.spec.js
@@ -3,13 +3,13 @@ describe("Authentication", () => {
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
.get('input[name="http_basic_user"]', { timeout: 500 })
.invoke("val")
- .then(user => {
+ .then((user) => {
expect(user === "foo").to.equal(true)
})
.get('input[name="http_basic_passwd"]')
.invoke("val")
- .then(pass => {
+ .then((pass) => {
expect(pass === "bar").to.equal(true)
})
})
diff --git a/tests/e2e/integration/proxy.spec.js b/tests/e2e/integration/proxy.spec.js
index c093656ae..71d816255 100644
--- a/tests/e2e/integration/proxy.spec.js
+++ b/tests/e2e/integration/proxy.spec.js
@@ -18,7 +18,7 @@ describe("Proxy enabled - external request", () => {
.click()
.get("#response-details-wrapper", { timeout: 24000 })
.should("be.visible")
- .should($wrapper => {
+ .should(($wrapper) => {
expect($wrapper).to.contain("Hello World")
})
})
diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js
index 519174757..7b80113c2 100644
--- a/tests/e2e/support/commands.js
+++ b/tests/e2e/support/commands.js
@@ -6,14 +6,9 @@
* @param { String } method The fake request method
*/
Cypress.Commands.add("seedAndVisit", (seedData, path = "/", method = "GET") => {
- cy.server()
- .route(method, "https://api.thecatapi.com/", `fixture:${seedData}`)
- .as("load")
+ cy.server().route(method, "https://api.thecatapi.com/", `fixture:${seedData}`).as("load")
- cy.visit(path)
- .get("#send")
- .click()
- .wait("@load")
+ cy.visit(path).get("#send").click().wait("@load")
})
/**
@@ -21,7 +16,7 @@ Cypress.Commands.add("seedAndVisit", (seedData, path = "/", method = "GET") => {
* This function will enable the proxy and navigate back to a given path
* @param { String } goBackPath The page go back
*/
-Cypress.Commands.add("enableProxy", goBackPath => {
+Cypress.Commands.add("enableProxy", (goBackPath) => {
cy.visit("/settings")
.get("#proxy")
.find(".toggle")