You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2021/07/14 20:23:42 UTC

[incubator-annotator] branch main updated (6475023 -> fc5474d)

This is an automated email from the ASF dual-hosted git repository.

gerben pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git.


    from 6475023  Add warning about issue #112.
     new 0071da0  Satisfy the Rat
     new 991ad5f  Please linter
     new fc5474d  Make clean command clean more stuff

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .eslintrc.js                                       |  1 -
 .gitignore                                         |  2 +-
 .ratignore                                         |  1 +
 package.json                                       |  2 +-
 packages/dom/@types/optimal-select/index.d.ts      | 20 +++++++++++++
 packages/dom/src/range/match.ts                    |  4 +--
 .../dom/test/highlight-text/highlight-text.test.ts | 10 ++-----
 packages/dom/test/text-quote/describe.test.ts      |  2 +-
 packages/dom/test/text-quote/match.test.ts         |  2 +-
 packages/dom/test/utils.ts                         | 35 ++++++++++------------
 10 files changed, 44 insertions(+), 35 deletions(-)

[incubator-annotator] 01/03: Satisfy the Rat

Posted by ge...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 0071da02ed85ff5b71616adbbb4bb9760d530c1c
Author: Gerben <ge...@treora.com>
AuthorDate: Wed Jul 14 21:30:16 2021 +0200

    Satisfy the Rat
---
 .ratignore                                    |  1 +
 packages/dom/@types/optimal-select/index.d.ts | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/.ratignore b/.ratignore
index 2d1dedc..05201d1 100644
--- a/.ratignore
+++ b/.ratignore
@@ -11,6 +11,7 @@ node_modules
 package\.json
 repolinter\.json
 tsconfig(\.\w+)?\.json
+typedoc\.json
 yarn\.lock
 CODE_OF_CONDUCT\.md
 DISCLAIMER-WIP
diff --git a/packages/dom/@types/optimal-select/index.d.ts b/packages/dom/@types/optimal-select/index.d.ts
index 90eb3f4..a5364fd 100644
--- a/packages/dom/@types/optimal-select/index.d.ts
+++ b/packages/dom/@types/optimal-select/index.d.ts
@@ -1,3 +1,23 @@
+/**
+ * @license
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 // Partial declaration, just to cover the pieces we need.
 declare module 'optimal-select' {
   export default function optimalSelect(

[incubator-annotator] 03/03: Make clean command clean more stuff

Posted by ge...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit fc5474d6f1775c00e1e3fd5fd502114ccae16141
Author: Gerben <ge...@treora.com>
AuthorDate: Wed Jul 14 22:19:27 2021 +0200

    Make clean command clean more stuff
    
    Using gitignore as reference.
    Is ‘/coverage’ still actually created by something?
    
    Also making a tiny nitpick in gitignore.
---
 .gitignore   | 2 +-
 package.json | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index f28d081..7ed21a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
 *.d.ts
-!/packages/**/@types/**/*.d.ts
+!/packages/**/src/**/*.d.ts
 *.d.ts.map
 .nyc_output
 coverage
diff --git a/package.json b/package.json
index 6ff42e2..85dfe58 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
     "build:js": "lerna exec --parallel -- babel -d lib -s -x .ts --env-name production --root-mode upward src",
     "build:misc": "lerna exec --parallel -- cp ../../DISCLAIMER-WIP ../../LICENSE ../../NOTICE ../../README.md .",
     "build:types": "tsc --build",
-    "clean": "tsc --build --clean && lerna exec -- rimraf DISCLAIMER-WIP LICENSE NOTICE README.md lib && rimraf docs",
+    "clean": "tsc --build --clean && lerna exec -- rimraf DISCLAIMER-WIP LICENSE NOTICE README.md lib && rimraf .nyc_output coverage docs web/dist *.tsbuildinfo",
     "docs": "tsc --build && typedoc",
     "lint": "eslint .",
     "prepublishOnly": "yarn run build",

[incubator-annotator] 02/03: Please linter

Posted by ge...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 991ad5f98d7d1c8bc4864d24558084b8b6761c10
Author: Gerben <ge...@treora.com>
AuthorDate: Wed Jul 14 22:10:16 2021 +0200

    Please linter
---
 .eslintrc.js                                       |  1 -
 packages/dom/src/range/match.ts                    |  4 +--
 .../dom/test/highlight-text/highlight-text.test.ts | 10 ++-----
 packages/dom/test/text-quote/describe.test.ts      |  2 +-
 packages/dom/test/text-quote/match.test.ts         |  2 +-
 packages/dom/test/utils.ts                         | 35 ++++++++++------------
 6 files changed, 21 insertions(+), 33 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index ec1ae7d..6bc3766 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -106,7 +106,6 @@ module.exports = {
         ecmaVersion: 2020,
         project: ['./tsconfig.test.json', './packages/*/tsconfig.json'],
         tsconfigRootDir: __dirname,
-        EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
       },
       plugins: ['@typescript-eslint'],
       rules: {
diff --git a/packages/dom/src/range/match.ts b/packages/dom/src/range/match.ts
index d6891c6..8bc535d 100644
--- a/packages/dom/src/range/match.ts
+++ b/packages/dom/src/range/match.ts
@@ -36,7 +36,7 @@ import { cartesian } from './cartesian';
  * The function is curried, taking first the `createMatcher` function, then the
  * selector, and then the scope.
  *
- * As there may be multiple matches for the start & end selectors, the resulting
+ * As there may be multiple matches for the start & end selectors, the resulting
  * matcher will return an (async) iterable, that produces a match for each
  * possible pair of matches of the nested selectors (except those where its end
  * would precede its start). *(Note that this behaviour is a rather free
@@ -114,7 +114,7 @@ export function makeCreateRangeSelectorMatcher(
         const result = ownerDocument(scope).createRange();
         result.setStart(start.startContainer, start.startOffset);
         // Note that a RangeSelector’s match *excludes* the endSelector’s match,
-        // hence we take the end’s startContainer & startOffset.
+        // hence we take the end’s startContainer & startOffset.
         result.setEnd(end.startContainer, end.startOffset);
 
         if (!result.collapsed) yield result;
diff --git a/packages/dom/test/highlight-text/highlight-text.test.ts b/packages/dom/test/highlight-text/highlight-text.test.ts
index b194419..6b42785 100644
--- a/packages/dom/test/highlight-text/highlight-text.test.ts
+++ b/packages/dom/test/highlight-text/highlight-text.test.ts
@@ -188,10 +188,7 @@ describe('highlightText', () => {
     const doc = domParser.parseFromString(inputHtml, 'text/html');
 
     const removeHighlights1 = highlightText(hydrateRange(range, doc));
-    const removeHighlights2 = highlightText(
-      hydrateRange(range2, doc),
-      'mark2',
-    );
+    const removeHighlights2 = highlightText(hydrateRange(range2, doc), 'mark2');
     assert.equal(doc.body.innerHTML, expectedHtml);
 
     removeHighlights1();
@@ -205,10 +202,7 @@ describe('highlightText', () => {
     const doc = domParser.parseFromString(inputHtml, 'text/html');
 
     const removeHighlights1 = highlightText(hydrateRange(range, doc));
-    const removeHighlights2 = highlightText(
-      hydrateRange(range2, doc),
-      'mark2',
-    );
+    const removeHighlights2 = highlightText(hydrateRange(range2, doc), 'mark2');
     assert.equal(doc.body.innerHTML, expectedHtml);
 
     removeHighlights2();
diff --git a/packages/dom/test/text-quote/describe.test.ts b/packages/dom/test/text-quote/describe.test.ts
index ac48ed2..97f21eb 100644
--- a/packages/dom/test/text-quote/describe.test.ts
+++ b/packages/dom/test/text-quote/describe.test.ts
@@ -119,7 +119,7 @@ describe('describeTextQuote', () => {
   });
 
   it('works if range does not contain Text nodes', async () => {
-    const html = `<b>Try quoting this image: <img/> — would that work?</b>`
+    const html = `<b>Try quoting this image: <img/> — would that work?</b>`;
     const doc = domParser.parseFromString(html, 'text/html');
     const range = document.createRange();
     range.selectNode(evaluateXPath(doc, '//img'));
diff --git a/packages/dom/test/text-quote/match.test.ts b/packages/dom/test/text-quote/match.test.ts
index c9429a4..69d827e 100644
--- a/packages/dom/test/text-quote/match.test.ts
+++ b/packages/dom/test/text-quote/match.test.ts
@@ -189,7 +189,7 @@ async function testMatcher(
   scope: Node | Range,
   selector: TextQuoteSelector,
   expected: RangeInfo[],
-  mutateDom: boolean = false,
+  mutateDom = false,
 ) {
   const matcher = createTextQuoteSelectorMatcher(selector);
   let count = 0;
diff --git a/packages/dom/test/utils.ts b/packages/dom/test/utils.ts
index 5a3f183..a391074 100644
--- a/packages/dom/test/utils.ts
+++ b/packages/dom/test/utils.ts
@@ -60,10 +60,7 @@ export function hydrateRange(rangeInfo: RangeInfo, doc: Document): Range {
   return range;
 }
 
-export function assertRangeEquals(
-  match: Range,
-  expected: RangeInfo,
-) {
+export function assertRangeEquals(match: Range, expected: RangeInfo): void {
   const doc = ownerDocument(match);
   if (expected === undefined) {
     assert.fail(`Unexpected match: ${prettyRange(match)}`);
@@ -72,10 +69,7 @@ export function assertRangeEquals(
     doc,
     expected.startContainerXPath,
   );
-  const expectedEndContainer = evaluateXPath(
-    doc,
-    expected.endContainerXPath,
-  );
+  const expectedEndContainer = evaluateXPath(doc, expected.endContainerXPath);
   assert(
     match.startContainer === expectedStartContainer,
     `unexpected start container: ${prettyNodeName(match.startContainer)}; ` +
@@ -83,8 +77,7 @@ export function assertRangeEquals(
   );
   assert.equal(match.startOffset, expected.startOffset);
   assert(
-    match.endContainer ===
-      evaluateXPath(doc, expected.endContainerXPath),
+    match.endContainer === evaluateXPath(doc, expected.endContainerXPath),
     `unexpected end container: ${prettyNodeName(match.endContainer)}; ` +
       `expected ${prettyNodeName(expectedEndContainer)}`,
   );
@@ -105,19 +98,21 @@ function prettyNodeName(node: Node) {
 }
 
 function prettyRange(range: Range): string {
-  let s = 'Range('
+  let s = 'Range(';
   if (
-    range.startContainer.nodeType === Node.TEXT_NODE
-    && range.startContainer.parentNode
-  ) s += prettyNodeName(range.startContainer.parentNode) + ' → ';
-  s += prettyNodeName(range.startContainer) + ' : ' + range.startOffset;
+    range.startContainer.nodeType === Node.TEXT_NODE &&
+    range.startContainer.parentNode
+  )
+    s += prettyNodeName(range.startContainer.parentNode) + ' → ';
+  s += prettyNodeName(range.startContainer) + `: ${range.startOffset}`;
   if (range.endContainer !== range.startContainer) {
-    s += ' … '
+    s += ' … ';
     if (
-      range.endContainer.nodeType === Node.TEXT_NODE
-      && range.endContainer.parentNode
-      && range.endContainer.parentNode !== range.startContainer.parentNode
-    ) s += prettyNodeName(range.endContainer.parentNode) + ' → ';
+      range.endContainer.nodeType === Node.TEXT_NODE &&
+      range.endContainer.parentNode &&
+      range.endContainer.parentNode !== range.startContainer.parentNode
+    )
+      s += prettyNodeName(range.endContainer.parentNode) + ' → ';
     s += prettyNodeName(range.endContainer) + ' : ';
   } else {
     s += '…';