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 2019/05/23 18:26:02 UTC
[incubator-annotator] branch master updated (baca907 -> dc34afb)
This is an automated email from the ASF dual-hosted git repository.
randall pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git.
from baca907 Bump ECMAScript version in ESLint config
new d2d0913 Turn on trailing commas everywhere
new 5b1262b Require extensions for non-package imports
new 459685b Forbid deep imports
new f5d8b63 Lint blank lines after imports and between groups
new dc34afb Lint for imports first
The 5 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 | 16 ++++++++++++++--
demo/index.js | 1 +
demo/mark.js | 1 +
packages/dom/src/text/quote.js | 8 ++++----
packages/fragment-identifier/src/index.js | 2 +-
packages/range/src/cartesian.js | 6 +++---
packages/range/src/index.js | 2 +-
7 files changed, 25 insertions(+), 11 deletions(-)
[incubator-annotator] 03/05: Forbid deep imports
Posted by ra...@apache.org.
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 459685b8601198a6cf1bae4bbe2592c271a7c12b
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 13:29:01 2019 -0400
Forbid deep imports
Consider the top-level exports of a package module to be the public API
and forbid importing a package's internal modules.
---
.eslintrc.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/.eslintrc.js b/.eslintrc.js
index 1c99acd..1df57d4 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -16,6 +16,7 @@ module.exports = {
rules: {
'import/extensions': ['error', 'always', { ignorePackages: true }],
'import/no-default-export': 'error',
+ 'import/no-internal-modules': 'error',
'import/order': 'error',
'import/unambiguous': 'error',
'no-restricted-syntax': [
@@ -76,6 +77,14 @@ module.exports = {
globals: {
assert: true,
},
+ rules: {
+ 'import/no-internal-modules': [
+ 'error',
+ {
+ allow: ['ajv/lib/refs/json-schema-draft-04.json', 'src/**'],
+ },
+ ],
+ },
},
],
};
[incubator-annotator] 04/05: Lint blank lines after imports and
between groups
Posted by ra...@apache.org.
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 f5d8b6318f5243453d982a8591d068c04b78cab8
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 14:22:42 2019 -0400
Lint blank lines after imports and between groups
---
.eslintrc.js | 3 ++-
demo/index.js | 1 +
demo/mark.js | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 1df57d4..bc7bd7d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -15,9 +15,10 @@ module.exports = {
plugins: ['import', 'prettier'],
rules: {
'import/extensions': ['error', 'always', { ignorePackages: true }],
+ 'import/newline-after-import': 'error',
'import/no-default-export': 'error',
'import/no-internal-modules': 'error',
- 'import/order': 'error',
+ 'import/order': ['error', { 'newlines-between': 'always' }],
'import/unambiguous': 'error',
'no-restricted-syntax': [
'error',
diff --git a/demo/index.js b/demo/index.js
index e672d96..63d2b1d 100644
--- a/demo/index.js
+++ b/demo/index.js
@@ -17,6 +17,7 @@
import * as fragment from '@annotator/fragment-identifier';
import { describeTextQuoteByRange as describeRange } from '@annotator/dom';
+
import { mark } from './mark.js';
import { search } from './search.js';
diff --git a/demo/mark.js b/demo/mark.js
index 330e5c0..5ffbc2d 100644
--- a/demo/mark.js
+++ b/demo/mark.js
@@ -19,6 +19,7 @@
*/
import highlightRange from 'dom-highlight-range';
+
export function mark(range) {
highlightRange(range, 'highlighted');
}
[incubator-annotator] 02/05: Require extensions for non-package
imports
Posted by ra...@apache.org.
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 5b1262be621649e987635dd9ab20a721fcf4dc42
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 12:20:18 2019 -0400
Require extensions for non-package imports
---
.eslintrc.js | 1 +
packages/fragment-identifier/src/index.js | 2 +-
packages/range/src/index.js | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 414bb5c..1c99acd 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -14,6 +14,7 @@ module.exports = {
},
plugins: ['import', 'prettier'],
rules: {
+ 'import/extensions': ['error', 'always', { ignorePackages: true }],
'import/no-default-export': 'error',
'import/order': 'error',
'import/unambiguous': 'error',
diff --git a/packages/fragment-identifier/src/index.js b/packages/fragment-identifier/src/index.js
index fd4f317..c7d85ea 100644
--- a/packages/fragment-identifier/src/index.js
+++ b/packages/fragment-identifier/src/index.js
@@ -13,7 +13,7 @@
* the License.
*/
-export { SyntaxError, parse } from './fragment';
+export { SyntaxError, parse } from './fragment.js';
/**
* Convert a Selector or State into a fragment identifier string.
diff --git a/packages/range/src/index.js b/packages/range/src/index.js
index f2af25d..f1fc4d7 100644
--- a/packages/range/src/index.js
+++ b/packages/range/src/index.js
@@ -13,7 +13,7 @@
* the License.
*/
-import { product } from './cartesian';
+import { product } from './cartesian.js';
export function createRangeSelector({ createAnySelector }) {
const startSelector = createAnySelector();
[incubator-annotator] 05/05: Lint for imports first
Posted by ra...@apache.org.
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 dc34afb5c4e1e9ff032c91442f77ad0fef11ed34
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 14:25:51 2019 -0400
Lint for imports first
---
.eslintrc.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/.eslintrc.js b/.eslintrc.js
index bc7bd7d..1fe2690 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -15,6 +15,7 @@ module.exports = {
plugins: ['import', 'prettier'],
rules: {
'import/extensions': ['error', 'always', { ignorePackages: true }],
+ 'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-default-export': 'error',
'import/no-internal-modules': 'error',
[incubator-annotator] 01/05: Turn on trailing commas everywhere
Posted by ra...@apache.org.
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 d2d0913bc7de4631f3f6fc8c0514b07bc1e4ffc2
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 12:17:31 2019 -0400
Turn on trailing commas everywhere
---
.eslintrc.js | 2 +-
packages/dom/src/text/quote.js | 8 ++++----
packages/range/src/cartesian.js | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 8baadfb..414bb5c 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -32,7 +32,7 @@ module.exports = {
'error',
{
singleQuote: true,
- trailingComma: 'es5',
+ trailingComma: 'all',
},
],
},
diff --git a/packages/dom/src/text/quote.js b/packages/dom/src/text/quote.js
index 56dec3b..ac13d71 100644
--- a/packages/dom/src/text/quote.js
+++ b/packages/dom/src/text/quote.js
@@ -60,12 +60,12 @@ export async function describeTextQuoteByRange({ range, context }) {
const matchEndIndex = match.index + match[0].length;
const suffixOverlap = overlap(
contextText.substring(matchEndIndex),
- contextText.substring(rangeEndIndex)
+ contextText.substring(rangeEndIndex),
);
minSuffixes.push(suffixOverlap + 1);
const prefixOverlap = overlapRight(
contextText.substring(0, match.index),
- contextText.substring(0, rangeIndex)
+ contextText.substring(0, rangeIndex),
);
minPrefixes.push(prefixOverlap + 1);
}
@@ -74,13 +74,13 @@ export async function describeTextQuoteByRange({ range, context }) {
if (minSuffix > 0) {
descriptor.suffix = contextText.substring(
rangeEndIndex,
- rangeEndIndex + minSuffix
+ rangeEndIndex + minSuffix,
);
}
if (minPrefix > 0) {
descriptor.prefix = contextText.substring(
rangeIndex - minPrefix,
- rangeIndex
+ rangeIndex,
);
}
return descriptor;
diff --git a/packages/range/src/cartesian.js b/packages/range/src/cartesian.js
index 3d15b19..8aa3727 100644
--- a/packages/range/src/cartesian.js
+++ b/packages/range/src/cartesian.js
@@ -32,15 +32,15 @@ export async function* product(...iterables) {
.then(
// Label the result with iterableNr, to know which iterable produced
// this value after Promise.race below.
- ({ value, done }) => ({ value, done, iterableNr })
- )
+ ({ value, done }) => ({ value, done, iterableNr }),
+ ),
);
// Keep listening as long as any of the iterables is not yet exhausted.
while (nextValuePromises.some(p => p !== null)) {
// Wait until any of the active iterators has produced a new value.
const { value, done, iterableNr } = await Promise.race(
- nextValuePromises.filter(p => p !== null)
+ nextValuePromises.filter(p => p !== null),
);
// If this iterable was exhausted, stop listening to it and move on.