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 c5963bb9f5707094937f9b2dc21b7e84de027ccc Author: Randall Leeds <[email protected]> AuthorDate: Sat Sep 19 20:28:09 2020 -0700 Update the import order rules Update the import order rules to alphabetize imports, group the annotator imports, and remove the newlines between groups. - Alphabetize imports just makes things tidy and ensures no one ever has to care about how to order them. - Define the groups so that the annotator modules, classified as internal packages by the resolver, group together below external packages. - Remove the newlines because they are excessive. --- .eslintrc.js | 19 +++++++++++++++++-- packages/dom/src/css.ts | 1 - packages/dom/src/range/match.ts | 2 -- packages/dom/src/text-quote/describe.ts | 1 - packages/dom/src/text-quote/match.ts | 3 +-- .../dom/test/highlight-range/highlight-range.test.ts | 1 - packages/dom/test/range/cartesian.test.ts | 1 - packages/dom/test/text-quote/describe-cases.ts | 1 - packages/dom/test/text-quote/describe.test.ts | 2 -- packages/dom/test/text-quote/match-cases.ts | 1 - packages/dom/test/text-quote/match.test.ts | 4 +--- test/data-model.test.ts | 1 - 12 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 787e984..e21fd31 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,7 +19,6 @@ */ const path = require('path'); - const babel = require('@babel/core'); // Use the root babel.config.js for module resolution. @@ -46,7 +45,23 @@ module.exports = { 'import/no-absolute-path': 'error', 'import/no-default-export': 'error', 'import/no-internal-modules': 'error', - 'import/order': ['error', { 'newlines-between': 'always' }], + 'import/order': [ + 'error', + { + alphabetize: { + order: 'asc', + }, + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + ], + 'newlines-between': 'never', + }, + ], 'import/unambiguous': 'error', 'prettier/prettier': [ 'error', diff --git a/packages/dom/src/css.ts b/packages/dom/src/css.ts index c1950cf..be9ff3e 100644 --- a/packages/dom/src/css.ts +++ b/packages/dom/src/css.ts @@ -19,7 +19,6 @@ */ import type { CssSelector, Matcher } from '@annotator/selector'; - import { ownerDocument } from './owner-document'; export function createCssSelectorMatcher( diff --git a/packages/dom/src/range/match.ts b/packages/dom/src/range/match.ts index c7e138a..30990ee 100644 --- a/packages/dom/src/range/match.ts +++ b/packages/dom/src/range/match.ts @@ -19,9 +19,7 @@ */ import type { Matcher, RangeSelector, Selector } from '@annotator/selector'; - import { ownerDocument } from '../owner-document'; - import { product } from './cartesian'; export function makeCreateRangeSelectorMatcher( diff --git a/packages/dom/src/text-quote/describe.ts b/packages/dom/src/text-quote/describe.ts index e6275b5..4e0e976 100644 --- a/packages/dom/src/text-quote/describe.ts +++ b/packages/dom/src/text-quote/describe.ts @@ -20,7 +20,6 @@ import seek from 'dom-seek'; import type { TextQuoteSelector } from '@annotator/selector'; - import { ownerDocument } from '../owner-document'; export async function describeTextQuote( diff --git a/packages/dom/src/text-quote/match.ts b/packages/dom/src/text-quote/match.ts index a4a216f..d076f76 100644 --- a/packages/dom/src/text-quote/match.ts +++ b/packages/dom/src/text-quote/match.ts @@ -18,9 +18,8 @@ * under the License. */ -import type { Matcher, TextQuoteSelector } from '@annotator/selector'; import seek from 'dom-seek'; - +import type { Matcher, TextQuoteSelector } from '@annotator/selector'; import { ownerDocument } from '../owner-document'; export function createTextQuoteSelectorMatcher( diff --git a/packages/dom/test/highlight-range/highlight-range.test.ts b/packages/dom/test/highlight-range/highlight-range.test.ts index 85a0988..aa81c46 100644 --- a/packages/dom/test/highlight-range/highlight-range.test.ts +++ b/packages/dom/test/highlight-range/highlight-range.test.ts @@ -19,7 +19,6 @@ */ import { assert } from 'chai'; - import { highlightRange } from '../../src/highlight-range'; import { RangeInfo, hydrateRange, evaluateXPath } from '../utils'; diff --git a/packages/dom/test/range/cartesian.test.ts b/packages/dom/test/range/cartesian.test.ts index bae6027..1b794dd 100644 --- a/packages/dom/test/range/cartesian.test.ts +++ b/packages/dom/test/range/cartesian.test.ts @@ -19,7 +19,6 @@ */ import { assert } from 'chai'; - import { product } from '../../src/range/cartesian'; async function* gen1() { diff --git a/packages/dom/test/text-quote/describe-cases.ts b/packages/dom/test/text-quote/describe-cases.ts index 142437d..a88732f 100644 --- a/packages/dom/test/text-quote/describe-cases.ts +++ b/packages/dom/test/text-quote/describe-cases.ts @@ -19,7 +19,6 @@ */ import type { TextQuoteSelector } from '@annotator/selector'; - import { RangeInfo } from '../utils'; export const testCases: { diff --git a/packages/dom/test/text-quote/describe.test.ts b/packages/dom/test/text-quote/describe.test.ts index 3d36c4e..25bfd0f 100644 --- a/packages/dom/test/text-quote/describe.test.ts +++ b/packages/dom/test/text-quote/describe.test.ts @@ -19,10 +19,8 @@ */ import { assert } from 'chai'; - import { describeTextQuote } from '../../src/text-quote/describe'; import { hydrateRange, evaluateXPath } from '../utils'; - import { testCases } from './describe-cases'; import { testCases as testMatchCases } from './match-cases'; diff --git a/packages/dom/test/text-quote/match-cases.ts b/packages/dom/test/text-quote/match-cases.ts index 099802c..46ab803 100644 --- a/packages/dom/test/text-quote/match-cases.ts +++ b/packages/dom/test/text-quote/match-cases.ts @@ -19,7 +19,6 @@ */ import type { TextQuoteSelector } from '@annotator/selector'; - import { RangeInfo } from '../utils'; export const testCases: { diff --git a/packages/dom/test/text-quote/match.test.ts b/packages/dom/test/text-quote/match.test.ts index 7d52e15..baba70b 100644 --- a/packages/dom/test/text-quote/match.test.ts +++ b/packages/dom/test/text-quote/match.test.ts @@ -19,11 +19,9 @@ */ import { assert } from 'chai'; -import type { TextQuoteSelector } from '@annotator/selector'; - +import { TextQuoteSelector } from '@annotator/selector'; import { createTextQuoteSelectorMatcher } from '../../src/text-quote/match'; import { evaluateXPath, RangeInfo } from '../utils'; - import { testCases } from './match-cases'; const domParser = new window.DOMParser(); diff --git a/test/data-model.test.ts b/test/data-model.test.ts index 2082d3a..b7fb794 100644 --- a/test/data-model.test.ts +++ b/test/data-model.test.ts @@ -22,7 +22,6 @@ import fs from 'fs'; import { URL } from 'url'; - import Ajv from 'ajv'; import { assert } from 'chai'; import fetch from 'node-fetch';
