You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ra...@apache.org on 2020/07/26 23:54:17 UTC

[incubator-annotator] 06/09: Apply automatic lint fixes

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

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

commit 1b317268954d0e5a67a371aa9cc61d62ecb6e59f
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Fri Jul 24 18:29:10 2020 -0700

    Apply automatic lint fixes
---
 .eslintrc.js                                  | 2 +-
 babel.config.js                               | 2 +-
 packages/dom/src/highlight-range.ts           | 4 ++--
 packages/dom/src/range/cartesian.ts           | 8 +++++---
 packages/dom/src/text-quote/describe.ts       | 4 ++--
 packages/dom/test/text-quote/describe.test.ts | 2 +-
 packages/dom/test/text-quote/match.test.ts    | 2 +-
 test/data-model.test.ts                       | 6 +++---
 web/demo/index.js                             | 2 +-
 9 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index 47d6d4d..b1db4eb 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -26,7 +26,7 @@ const babel = require('@babel/core');
 // Relevant issue: tleunen/eslint-import-resolver-babel-module#89
 const babelConfig = babel.loadPartialConfig({ cwd: __dirname });
 const babelModuleResolver = babelConfig.options.plugins.find(
-  item => item.file.request === 'module-resolver',
+  (item) => item.file.request === 'module-resolver',
 );
 
 module.exports = {
diff --git a/babel.config.js b/babel.config.js
index e020409..0daad76 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -18,7 +18,7 @@
  * under the License.
  */
 
-module.exports = api => {
+module.exports = (api) => {
   const ENV = api.env();
   const DEV = ENV === 'development';
   const TEST = ENV === 'test';
diff --git a/packages/dom/src/highlight-range.ts b/packages/dom/src/highlight-range.ts
index c77a567..0dfa38f 100644
--- a/packages/dom/src/highlight-range.ts
+++ b/packages/dom/src/highlight-range.ts
@@ -79,7 +79,7 @@ function textNodesInRange(range: Range): Text[] {
     range.commonAncestorContainer,
     NodeFilter.SHOW_TEXT,
     {
-      acceptNode: node =>
+      acceptNode: (node) =>
         range.intersectsNode(node)
           ? NodeFilter.FILTER_ACCEPT
           : NodeFilter.FILTER_REJECT,
@@ -116,7 +116,7 @@ function wrapNodeInHighlight(
 ): HTMLElement {
   const document = node.ownerDocument as Document;
   const highlightElement = document.createElement(tagName);
-  Object.keys(attributes).forEach(key => {
+  Object.keys(attributes).forEach((key) => {
     highlightElement.setAttribute(key, attributes[key]);
   });
   const tempRange = document.createRange();
diff --git a/packages/dom/src/range/cartesian.ts b/packages/dom/src/range/cartesian.ts
index 439cd8b..04afad5 100644
--- a/packages/dom/src/range/cartesian.ts
+++ b/packages/dom/src/range/cartesian.ts
@@ -28,7 +28,9 @@ export async function* product<T>(
   // combinations of that value with the logged values from other iterators.
   // Every combination is thus made exactly once, and as soon as it is known.
 
-  const iterators = iterables.map(iterable => iterable[Symbol.asyncIterator]());
+  const iterators = iterables.map((iterable) =>
+    iterable[Symbol.asyncIterator](),
+  );
   // Initialise an empty log for each iterable.
   const logs: T[][] = iterables.map(() => []);
 
@@ -48,7 +50,7 @@ export async function* product<T>(
       iterator.next().then(
         // Label the result with iterableNr, to know which iterable produced
         // this value after Promise.race below.
-        nextResult => ({ nextResult, iterableNr }),
+        (nextResult) => ({ nextResult, iterableNr }),
       ),
   );
 
@@ -77,7 +79,7 @@ export async function* product<T>(
     // Start listening for the next value of this iterable.
     nextValuePromises[iterableNr] = iterators[iterableNr]
       .next()
-      .then(nextResult => ({ nextResult, iterableNr }));
+      .then((nextResult) => ({ nextResult, iterableNr }));
 
     // Yield each of the produced combinations separately.
     yield* combinations;
diff --git a/packages/dom/src/text-quote/describe.ts b/packages/dom/src/text-quote/describe.ts
index d690013..4fd2712 100644
--- a/packages/dom/src/text-quote/describe.ts
+++ b/packages/dom/src/text-quote/describe.ts
@@ -135,8 +135,8 @@ function minimalSolution(
   requirements.push([0, 0]);
 
   // Build all the pairs and order them by their sums.
-  const pairs = requirements.flatMap(l =>
-    requirements.map<[number, number]>(r => [l[0], r[1]]),
+  const pairs = requirements.flatMap((l) =>
+    requirements.map<[number, number]>((r) => [l[0], r[1]]),
   );
   pairs.sort((a, b) => a[0] + a[1] - (b[0] + b[1]));
 
diff --git a/packages/dom/test/text-quote/describe.test.ts b/packages/dom/test/text-quote/describe.test.ts
index efaa8c5..3fdf8f8 100644
--- a/packages/dom/test/text-quote/describe.test.ts
+++ b/packages/dom/test/text-quote/describe.test.ts
@@ -21,10 +21,10 @@
 import { assert } from 'chai';
 
 import { describeTextQuote } from '../../src/text-quote/describe';
+import { hydrateRange, evaluateXPath } from '../utils';
 
 import testCases from './describe-cases';
 import testMatchCases from './match-cases';
-import { hydrateRange, evaluateXPath } from '../utils';
 
 const domParser = new window.DOMParser();
 
diff --git a/packages/dom/test/text-quote/match.test.ts b/packages/dom/test/text-quote/match.test.ts
index 8bfcfb3..5930209 100644
--- a/packages/dom/test/text-quote/match.test.ts
+++ b/packages/dom/test/text-quote/match.test.ts
@@ -23,9 +23,9 @@ import { TextQuoteSelector } from '@annotator/selector';
 
 import { createTextQuoteSelectorMatcher } from '../../src/text-quote/match';
 import { DomScope } from '../../src/types';
+import { evaluateXPath, RangeInfo } from '../utils';
 
 import testCases from './match-cases';
-import { evaluateXPath, RangeInfo } from '../utils';
 
 const domParser = new window.DOMParser();
 
diff --git a/test/data-model.test.ts b/test/data-model.test.ts
index b5661a5..2082d3a 100644
--- a/test/data-model.test.ts
+++ b/test/data-model.test.ts
@@ -58,7 +58,7 @@ const DEFINITIONS = [
   'id',
   'otherProperties',
   'specificResource',
-].map(name => requireJSON(`web-annotation-tests/definitions/${name}.json`));
+].map((name) => requireJSON(`web-annotation-tests/definitions/${name}.json`));
 
 const MUSTS = requireJSON(
   'web-annotation-tests/annotations/annotationMusts.test',
@@ -68,12 +68,12 @@ const META_SCHEMA = requireJSON('ajv/lib/refs/json-schema-draft-04.json');
 
 const ajv = new Ajv({ schemaId: 'auto', meta: false });
 ajv.addMetaSchema(META_SCHEMA);
-DEFINITIONS.forEach(schema => ajv.addSchema(schema));
+DEFINITIONS.forEach((schema) => ajv.addSchema(schema));
 
 describe('Test JSON against Schemas', () => {
   let data: Record<string, unknown>;
 
-  before(async function() {
+  before(async function () {
     if (!found_url) {
       this.skip();
     } else {
diff --git a/web/demo/index.js b/web/demo/index.js
index 88b9a06..3880635 100644
--- a/web/demo/index.js
+++ b/web/demo/index.js
@@ -91,7 +91,7 @@ function cleanup() {
   target.normalize();
 }
 
-const createMatcher = makeRefinable(selector => {
+const createMatcher = makeRefinable((selector) => {
   const innerCreateMatcher = {
     TextQuoteSelector: createTextQuoteSelectorMatcher,
     RangeSelector: makeCreateRangeSelectorMatcher(createMatcher),