]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
style: lint
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 9 Dec 2019 10:33:38 +0000 (11:33 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 9 Dec 2019 10:33:38 +0000 (11:33 +0100)
__tests__/matcher/ranking.spec.ts
e2e/browserstack-send-status.js
package.json
src/router.ts
src/types/index.ts

index c3600dd8122045ffc1891976177dba5c901a0e22..95665aeba7e73fad6fa69af87021b81be2ce78a3 100644 (file)
@@ -21,9 +21,9 @@ describe('createRouteRecordMatcher', () => {
       return [pathOrCombined, options]
     })
 
-    const matchers: Array<
-      RouteRecordMatcher & { _options: RegExpOptions }
-    > = normalizedPaths
+    const matchers: Array<RouteRecordMatcher & {
+      _options: RegExpOptions
+    }> = normalizedPaths
       .slice()
       // Because sorting order is conserved, allows to mismatch order on
       // routes with the same ranking
index bc45fd871614902057517fb085b1d33e9f9f58ad..0cb326fca02b7955382a70764e055e1ed7a8425b 100644 (file)
@@ -3,7 +3,7 @@ const axios = require('axios')
 const BS_USER = process.env.BS_USER
 const BS_KEY = process.env.BS_KEY
 
-function getKey (client) {
+function getKey(client) {
   // const { capabilities, currentTest } = client
   // originally i wanted to use this but it turns out the information changes
   // on the afterEach, making the key non valid. But because every environment
@@ -17,7 +17,7 @@ function getKey (client) {
   return `${client.currentTest.module}: ${client.currentTest.name}`
 }
 
-function shouldSkipBrowserstackReporting (client) {
+function shouldSkipBrowserstackReporting(client) {
   return !BS_USER || !BS_KEY || client.options.selenium_port !== 80
 }
 
@@ -26,11 +26,11 @@ function shouldSkipBrowserstackReporting (client) {
  * to every test suite. It cannot be added globably because these must be
  * executed before each test (instead of each test suite as it does in globalModules)
  */
-module.exports = function sendStatus () {
+module.exports = function sendStatus() {
   const sessionMap = Object.create(null)
 
   return {
-    beforeEach (browser, cb) {
+    beforeEach(browser, cb) {
       // avoid running if missing credentials
       if (shouldSkipBrowserstackReporting(this.client)) return cb()
       // retrieve the session and save it to the map
@@ -41,7 +41,7 @@ module.exports = function sendStatus () {
       })
     },
 
-    afterEach (browser, cb) {
+    afterEach(browser, cb) {
       // avoid running if missing credentials
       if (shouldSkipBrowserstackReporting(this.client)) return cb()
       const key = getKey(this.client)
@@ -63,13 +63,13 @@ module.exports = function sendStatus () {
               // change the name so it's easier to find
               name: key,
               status: 'failed',
-              reason
+              reason,
             },
             {
               auth: {
                 username: BS_USER,
-                password: BS_KEY
-              }
+                password: BS_KEY,
+              },
             }
           )
           .catch(err => {
@@ -82,6 +82,6 @@ module.exports = function sendStatus () {
       } else {
         cb()
       }
-    }
+    },
   }
 }
index ad0a517cb6689dae10b1d2f8634f33da995b698c..7bc7bfbe81f73bca43a1932d662319b203d91f89 100644 (file)
@@ -12,7 +12,8 @@
     "build": "yarn rollup -c rollup.config.js",
     "dev": "webpack-dev-server --mode=development",
     "dev:examples": "webpack-dev-server --mode=development --config examples/webpack.config.js",
-    "lint": "prettier --write --parser typescript \"src/**/*.ts?(x)\"",
+    "lint": "prettier -c --parser typescript \"{src,__tests__,e2e}/**/*.[jt]s?(x)\"",
+    "lint:fix": "yarn run lint --write",
     "test:types": "tsc --build tsconfig.json",
     "test:unit": "jest --coverage",
     "test": "yarn run test:types && yarn run test:unit && yarn build"
index 26366196ea8f1dd5b877c1f821597297dc8c5afc..8b7d9f0332a0220a821399ad0e24fe9e380437e7 100644 (file)
@@ -82,12 +82,8 @@ export function createRouter({
   )
   const beforeGuards: NavigationGuard[] = []
   const afterGuards: PostNavigationGuard[] = []
-  let currentRoute: Readonly<
-    RouteLocationNormalized
-  > = START_LOCATION_NORMALIZED
-  let pendingLocation: Readonly<
-    RouteLocationNormalized
-  > = START_LOCATION_NORMALIZED
+  let currentRoute: Readonly<RouteLocationNormalized> = START_LOCATION_NORMALIZED
+  let pendingLocation: Readonly<RouteLocationNormalized> = START_LOCATION_NORMALIZED
   let onReadyCbs: OnReadyCallback[] = []
   // TODO: should these be triggered before or after route.push().catch()
   let errorHandlers: ErrorHandler[] = []
index f0a8dc88cdf0ec462a3952b0e9b423959a7d43ca..51bf0e02f44cd398767ab2d968a9e8b68e83d355 100644 (file)
@@ -38,9 +38,9 @@ interface RouteLocationOptions {
 // User level location
 export type RouteLocation =
   | string
-  | RouteQueryAndHash & LocationAsPath & RouteLocationOptions
-  | RouteQueryAndHash & LocationAsName & RouteLocationOptions
-  | RouteQueryAndHash & LocationAsRelative & RouteLocationOptions
+  | (RouteQueryAndHash & LocationAsPath & RouteLocationOptions)
+  | (RouteQueryAndHash & LocationAsName & RouteLocationOptions)
+  | (RouteQueryAndHash & LocationAsRelative & RouteLocationOptions)
 
 // A matched record cannot be a redirection and must contain
 // a normalized version of components with { default: Component } instead of `component`