]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: spelling fixes in doc blocks (#1495)
authornandi95 <41805560+nandi95@users.noreply.github.com>
Wed, 3 Aug 2022 08:03:12 +0000 (09:03 +0100)
committerGitHub <noreply@github.com>
Wed, 3 Aug 2022 08:03:12 +0000 (10:03 +0200)
15 files changed:
packages/router/src/RouterLink.ts
packages/router/src/RouterView.ts
packages/router/src/encoding.ts
packages/router/src/errors.ts
packages/router/src/globalExtensions.ts
packages/router/src/history/common.ts
packages/router/src/history/html5.ts
packages/router/src/history/memory.ts
packages/router/src/location.ts
packages/router/src/matcher/index.ts
packages/router/src/matcher/pathParserRanker.ts
packages/router/src/matcher/types.ts
packages/router/src/navigationGuards.ts
packages/router/src/router.ts
packages/router/src/types/index.ts

index 9bd9568f1c2d2a2cd42c559484ffcd60523560b6..702efa142641055e05f46ac59dacaa23d9ebecf2 100644 (file)
@@ -65,7 +65,9 @@ export interface RouterLinkProps extends RouterLinkOptions {
    */
   exactActiveClass?: string
   /**
-   * Value passed to the attribute `aria-current` when the link is exact active. Defaults to "page"
+   * Value passed to the attribute `aria-current` when the link is exact active.
+   *
+   * @defaultValue 'page'
    */
   ariaCurrentValue?:
     | 'page'
@@ -236,7 +238,7 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
                 : null,
               href: link.href,
               // this would override user added attrs but Vue will still add
-              // the listener so we end up triggering both
+              // the listener, so we end up triggering both
               onClick: link.navigate,
               class: elClass.value,
             },
@@ -254,7 +256,7 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
 export const RouterLink: _RouterLinkI = RouterLinkImpl as any
 
 /**
- * Typed version of the `RouterLink` component. Its generic defaults to the typed router so it can be inferred
+ * Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
  * automatically for JSX.
  *
  * @internal
index d107e231a5cf23a7b81197f646b26eb800e3f2d1..ad136f60218213ffad5f828e871fa4d6540eb959 100644 (file)
@@ -102,7 +102,7 @@ export const RouterViewImpl = /*#__PURE__*/ defineComponent({
           // this will update the instance for new instances as well as reused
           // instances when navigating to a new route
           to.instances[name] = instance
-          // the component instance is reused for a different route or name so
+          // the component instance is reused for a different route or name, so
           // we copy any saved update or leave guards. With async setup, the
           // mounting component will mount before the matchedRoute changes,
           // making instance === oldInstance, so we check if guards have been
index 248a7506398df87333ebbe76ad1204e566ec499a..e46707080556528b6de5ba835a7d1038ee7141ca 100644 (file)
@@ -7,7 +7,7 @@ import { warn } from './warning'
  * On top of that, the RFC3986 (https://tools.ietf.org/html/rfc3986#section-2.2)
  * defines some extra characters to be encoded. Most browsers do not encode them
  * in encodeURI https://github.com/whatwg/url/issues/369, so it may be safer to
- * also encode `!'()*`. Leaving unencoded only ASCII alphanumeric(`a-zA-Z0-9`)
+ * also encode `!'()*`. Leaving un-encoded only ASCII alphanumeric(`a-zA-Z0-9`)
  * plus `-._~`. This extra safety should be applied to query by patching the
  * string returned by encodeURIComponent encodeURI also encodes `[\]^`. `\`
  * should be encoded to avoid ambiguity. Browsers (IE, FF, C) transform a `\`
@@ -32,7 +32,7 @@ export const PLUS_RE = /\+/g // %2B
  * application/x-www-form-urlencoded
  * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo
  * leave the plus character as is in queries. To be more flexible, we allow the
- * plus character on the query but it can also be manually encoded by the user.
+ * plus character on the query, but it can also be manually encoded by the user.
  *
  * Resources:
  * - https://url.spec.whatwg.org/#urlencoded-parsing
index afae094a50f8a8b6896559411566f0d327e7d541..5f7aa995ee6922ccf9185159317b2203b4367733 100644 (file)
@@ -13,7 +13,7 @@ import { assign } from './utils'
  * @internal
  */
 export const enum ErrorTypes {
-  // they must be literals to be used as values so we can't write
+  // they must be literals to be used as values, so we can't write
   // 1 << 2
   MATCHER_NOT_FOUND = 1,
   NAVIGATION_GUARD_REDIRECT = 2,
index ae9121c48b3d94c56610bad02683fd7154e4a2e3..a9391b2e39495abab43b69734970bba5ffc72ec5 100644 (file)
@@ -27,7 +27,7 @@ declare module '@vue/runtime-core' {
       : NavigationGuardWithThis<undefined>
 
     /**
-     * Guard called whenever the route that renders this component has changed but
+     * Guard called whenever the route that renders this component has changed, but
      * it is reused for the new route. This allows you to guard for changes in
      * params, the query or the hash.
      *
index 3476777a8dd8cfcfb2f22d43b28af3d55c0b6340..0abf4815008c6975d27a8d806e9892365939d848 100644 (file)
@@ -4,7 +4,7 @@ import { removeTrailingSlash } from '../location'
 export type HistoryLocation = string
 /**
  * Allowed variables in HTML5 history state. Note that pushState clones the state
- * passed and does not accept everything: e.g it doesn't accept symbols, nor
+ * passed and does not accept everything: e.g.: it doesn't accept symbols, nor
  * functions as values. It also ignores Symbols as keys.
  *
  * @internal
@@ -74,8 +74,8 @@ export type ValueContainer<T> = { value: T }
 export interface RouterHistory {
   /**
    * Base path that is prepended to every url. This allows hosting an SPA at a
-   * subfolder of a domain like `example.com/subfolder` by having a `base` of
-   * `/subfolder`
+   * sub-folder of a domain like `example.com/sub-folder` by having a `base` of
+   * `/sub-folder`
    */
   readonly base: string
   /**
index 5949ce9c7f1be0319c251462cd9bcb0f673728ec..bc4531f957c024780ee240d81aa6ba4e85f515ba 100644 (file)
@@ -114,7 +114,7 @@ function useHistoryListeners(
   }
 
   function listen(callback: NavigationCallback) {
-    // setup the listener and prepare teardown callbacks
+    // set up the listener and prepare teardown callbacks
     listeners.push(callback)
 
     const teardown = () => {
@@ -142,7 +142,7 @@ function useHistoryListeners(
     window.removeEventListener('beforeunload', beforeUnloadListener)
   }
 
-  // setup the listeners and prepare teardown callbacks
+  // set up the listeners and prepare teardown callbacks
   window.addEventListener('popstate', popStateHandler)
   window.addEventListener('beforeunload', beforeUnloadListener)
 
@@ -192,7 +192,7 @@ function useHistoryStateNavigation(base: string) {
         // the length is off by one, we need to decrease it
         position: history.length - 1,
         replaced: true,
-        // don't add a scroll as the user may have an anchor and we want
+        // don't add a scroll as the user may have an anchor, and we want
         // scrollBehavior to be triggered without a saved position
         scroll: null,
       },
@@ -206,7 +206,7 @@ function useHistoryStateNavigation(base: string) {
     replace: boolean
   ): void {
     /**
-     * if a base tag is provided and we are on a normal domain, we have to
+     * if a base tag is provided, and we are on a normal domain, we have to
      * respect the provided `base` attribute because pushState() will use it and
      * potentially erase anything before the `#` like at
      * https://github.com/vuejs/router/issues/685 where a base of
index c4d07eef8f259edc17107bbacd8bb43575e1d598..c2ec8194c2be60baca706c2ef1594aad6e84e692 100644 (file)
@@ -12,7 +12,7 @@ import {
 } from './common'
 
 /**
- * Creates a in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.
+ * Creates an in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.
  * It's up to the user to replace that location with the starter location by either calling `router.push` or `router.replace`.
  *
  * @param base - Base applied to all urls, defaults to '/'
index 18ca533957a5ea19b5e0c45bce1e037a065bfc18..24fa764a944cfeed124c781f4f94575ca9ce74af 100644 (file)
@@ -34,7 +34,7 @@ export const removeTrailingSlash = (path: string) =>
   path.replace(TRAILING_SLASH_RE, '')
 
 /**
- * Transforms an URI into a normalized history location
+ * Transforms a URI into a normalized history location
  *
  * @param parseQuery
  * @param location - URI to normalize
@@ -104,8 +104,7 @@ export function stringifyURL(
 }
 
 /**
- * Strips off the base from the beginning of a location.pathname in a non
- * case-sensitive way.
+ * Strips off the base from the beginning of a location.pathname in a non-case-sensitive way.
  *
  * @param pathname - location.pathname
  * @param base - base to strip off
@@ -225,11 +224,11 @@ export function resolveRelativePath(to: string, from: string): string {
     if (segment === '.') continue
     // go up in the from array
     if (segment === '..') {
-      // we can't go below zero but we still need to increment toPosition
+      // we can't go below zero, but we still need to increment toPosition
       if (position > 1) position--
       // continue
     }
-    // we reached a non relative path, we stop here
+    // we reached a non-relative path, we stop here
     else break
   }
 
index fc39dec227556977d1ffc7110a6afdf7b75b4ca5..a1f584e868b0053c1fb4bbbec5c6206d8632fb8c 100644 (file)
@@ -134,13 +134,13 @@ export function createRouterMatcher(
         )
       }
 
-      // create the object before hand so it can be passed to children
+      // create the object beforehand, so it can be passed to children
       matcher = createRouteRecordMatcher(normalizedRecord, parent, options)
 
       if (__DEV__ && parent && path[0] === '/')
         checkMissingParamsInAbsolutePath(matcher, parent)
 
-      // if we are an alias we must tell the original record that we exist
+      // if we are an alias we must tell the original record that we exist,
       // so we can be removed
       if (originalRecord) {
         originalRecord.alias.push(matcher)
@@ -170,7 +170,7 @@ export function createRouterMatcher(
       }
 
       // if there was no original record, then the first one was not an alias and all
-      // other alias (if any) need to reference this record when adding children
+      // other aliases (if any) need to reference this record when adding children
       originalRecord = originalRecord || matcher
 
       // TODO: add normalized records for more flexibility
@@ -373,7 +373,7 @@ function normalizeRecordProps(
   record: RouteRecordRaw
 ): Record<string, _RouteRecordProps> {
   const propsObject = {} as Record<string, _RouteRecordProps>
-  // props does not exist on redirect records but we can set false directly
+  // props does not exist on redirect records, but we can set false directly
   const props = record.props || false
   if ('component' in record) {
     propsObject.default = props
index ed99c6133fc62890f6b868c65588ed3a67582adc..5c8e0757902a256cdc3da343b79f447afe4af837 100644 (file)
@@ -52,23 +52,31 @@ export interface PathParser {
  */
 export interface _PathParserOptions {
   /**
-   * Makes the RegExp case sensitive. Defaults to false
+   * Makes the RegExp case-sensitive.
+   *
+   * @defaultValue false
    */
   sensitive?: boolean
 
   /**
-   * Should we disallow a trailing slash. Defaults to false
+   * Whether to disallow a trailing slash or not.
+   *
+   * @defaultValue false
    */
   strict?: boolean
 
   /**
-   * Should the RegExp match from the beginning by prepending a `^` to it. Defaults to true
+   * Should the RegExp match from the beginning by prepending a `^` to it.
    * @internal
+   *
+   * @defaultValue true
    */
   start?: boolean
 
   /**
-   * Should the RegExp match until the end by appending a `$` to it. Defaults to true
+   * Should the RegExp match until the end by appending a `$` to it.
+   *
+   * @defaultValue true
    */
   end?: boolean
 }
@@ -78,7 +86,7 @@ export type PathParserOptions = Pick<
   'end' | 'sensitive' | 'strict'
 >
 
-// default pattern for a param: non greedy everything but /
+// default pattern for a param: non-greedy everything but /
 const BASE_PARAM_PATTERN = '[^/]+?'
 
 const BASE_PATH_PARSER_OPTIONS: Required<_PathParserOptions> = {
@@ -136,7 +144,7 @@ export function tokensToParser(
     if (options.strict && !segment.length) pattern += '/'
     for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
       const token = segment[tokenIndex]
-      // resets the score if we are inside a sub segment /:a-other-:b
+      // resets the score if we are inside a sub-segment /:a-other-:b
       let subSegmentScore: number =
         PathScore.Segment +
         (options.sensitive ? PathScore.BonusCaseSensitive : 0)
index a4288610ea419e5ca100ec169d80d755ef26c6e2..6693a3d75f31f53b63ad0c1b7da6de6b2d13e049 100644 (file)
@@ -73,7 +73,7 @@ export interface RouteRecordNormalized {
    * views.
    */
   instances: Record<string, ComponentPublicInstance | undefined | null>
-  // can only be of of the same type as this record
+  // can only be of the same type as this record
   /**
    * Defines if this record is the alias of another one. This property is
    * `undefined` if the record is the original one.
index 4f8b519f31609c7231eb363b2da40a1291af66c9..148a51f277da0cb146b7ff5b26877fb09635a214 100644 (file)
@@ -67,7 +67,7 @@ export function onBeforeRouteLeave(leaveGuard: NavigationGuard) {
   if (!activeRecord) {
     __DEV__ &&
       warn(
-        'No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside of a component child of <router-view>. Maybe you called it inside of App.vue?'
+        'No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?'
       )
     return
   }
@@ -99,7 +99,7 @@ export function onBeforeRouteUpdate(updateGuard: NavigationGuard) {
   if (!activeRecord) {
     __DEV__ &&
       warn(
-        'No active route record was found when calling `onBeforeRouteUpdate()`. Make sure you call this function inside of a component child of <router-view>. Maybe you called it inside of App.vue?'
+        'No active route record was found when calling `onBeforeRouteUpdate()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?'
       )
     return
   }
@@ -352,7 +352,7 @@ export function isRouteComponent(
 }
 
 /**
- * Ensures a route is loaded so it can be passed as o prop to `<RouterView>`.
+ * Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
  *
  * @param route - resolved route to load
  */
index 430dd840e9c61ae8a5ac557826a88a400cb012a5..e2d392cd9e141727a55f09d806155c405e570f2f 100644 (file)
@@ -174,7 +174,7 @@ export interface RouterOptions extends PathParserOptions {
    */
   linkExactActiveClass?: string
   /**
-   * Default class applied to non active {@link RouterLink}. If none is provided,
+   * Default class applied to non-active {@link RouterLink}. If none is provided,
    * `router-link-inactive` will be applied.
    */
   // linkInactiveClass?: string
@@ -235,7 +235,7 @@ export interface Router {
   /**
    * Returns the {@link RouteLocation | normalized version} of a
    * {@link RouteLocationRaw | route location}. Also includes an `href` property
-   * that includes any existing `base`. By default the `currentLocation` used is
+   * that includes any existing `base`. By default, the `currentLocation` used is
    * `route.currentRoute` and should only be overridden in advanced use cases.
    *
    * @param to - Raw route location to resolve
@@ -492,7 +492,7 @@ export function createRouter(options: RouterOptions): Router {
           delete targetParams[key]
         }
       }
-      // pass encoded values to the matcher so it can produce encoded path and fullPath
+      // pass encoded values to the matcher, so it can produce encoded path and fullPath
       matcherLocation = assign({}, rawLocation, {
         params: encodeParams(rawLocation.params),
       })
@@ -510,7 +510,7 @@ export function createRouter(options: RouterOptions): Router {
       )
     }
 
-    // decoding them) the matcher might have merged current location params so
+    // the matcher might have merged current location params, so
     // we need to run the decoding again
     matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params))
 
@@ -730,7 +730,7 @@ export function createRouter(options: RouterOptions): Router {
               // keep options
               assign(
                 {
-                  // preserve an existing replace but allow the redirect to override it
+                  // preserve an existing replacement but allow the redirect to override it
                   replace,
                 },
                 locationAsObject(failure.to),
@@ -1001,7 +1001,7 @@ export function createRouter(options: RouterOptions): Router {
             // Here we could call if (info.delta) routerHistory.go(-info.delta,
             // false) but this is bug prone as we have no way to wait the
             // navigation to be finished before calling pushWithRedirect. Using
-            // a setTimeout of 16ms seems to work but there is not guarantee for
+            // a setTimeout of 16ms seems to work but there is no guarantee for
             // it to work on every browser. So instead we do not restore the
             // history entry and trigger a new navigation as requested by the
             // navigation guard.
@@ -1015,7 +1015,7 @@ export function createRouter(options: RouterOptions): Router {
             )
               .then(failure => {
                 // manual change in hash history #916 ending up in the URL not
-                // changing but it was changed by the manual url change, so we
+                // changing, but it was changed by the manual url change, so we
                 // need to manually change it ourselves
                 if (
                   isNavigationFailure(
index b92bb3389bd9368b67f0c2f1407ea9fca231ebc2..ef5b7f1d60ec944e2cd3a16e2867d8f38a5398f8 100644 (file)
@@ -165,7 +165,7 @@ export interface _RouteLocationBase
 export interface RouteLocationNormalizedLoaded extends _RouteLocationBase {
   /**
    * Array of {@link RouteLocationMatched} containing only plain components (any
-   * lazy-loaded components have been loaded and were replaced inside of the
+   * lazy-loaded components have been loaded and were replaced inside the
    * `components` object) so it can be directly used to display routes. It
    * cannot contain redirect records either
    */
@@ -420,7 +420,7 @@ export const START_LOCATION_NORMALIZED: RouteLocationNormalizedLoaded = {
   redirectedFrom: undefined,
 }
 
-// make matched non enumerable for easy printing
+// make matched non-enumerable for easy printing
 // NOTE: commented for tests at RouterView.spec
 // Object.defineProperty(START_LOCATION_NORMALIZED, 'matched', {
 //   enumerable: false,
@@ -456,7 +456,7 @@ export interface MatcherLocation {
   params: RouteParams
 
   /**
-   * Merged `meta` properties from all of the matched route records.
+   * Merged `meta` properties from all the matched route records.
    */
   meta: RouteMeta