Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add eslint-plugin-import and extensions to import paths #376

Merged
merged 9 commits into from
Jun 27, 2022
1,777 changes: 1,114 additions & 663 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/configurations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can override/use your own files to meet project requirements.

## TypeScript support

Below configurations are used with TypeScript (Element Framework v5).
Below configurations are used with TypeScript (Element Framework v6).

### .eslintrc

Expand Down
13 changes: 7 additions & 6 deletions packages/configurations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"keywords": [
"Element Framework",
"v5",
"v6",
"configurations",
"eslint",
"tsconfig",
Expand All @@ -22,13 +22,14 @@
"author": "Refinitiv",
"license": "Apache-2.0",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"eslint": "^8.18.0",
"eslint-plugin-html": "^6.2.0",
"typescript": "^4.6.2"
"eslint-plugin-import": "^2.26.0",
"typescript": "~4.6.4"
},
"publishConfig": {
"access": "public"
}
}
}
46 changes: 24 additions & 22 deletions packages/configurations/typescript.eslint-config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
module.exports = {
extends: [
"./eslint-config.js"
],
"overrides": [
extends: ['./eslint-config.js'],
overrides: [
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
extends: [
"./eslint-config.js",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
'./eslint-config.js',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
"parserOptions": {
"extraFileExtensions": [".html"]
parserOptions: {
extraFileExtensions: ['.html'],
},
rules: {
'import/extensions': ['error', 'always'],
'@typescript-eslint/unbound-method': 0,
'valid-jsdoc': [
2,
{
requireReturnType: false,
requireParamType: false,
},
],
},
"rules": {
"@typescript-eslint/unbound-method": 0,
"valid-jsdoc": [2, {
"requireReturnType": false,
"requireParamType": false
}]
}
}
]
},
],
};
8 changes: 4 additions & 4 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export { DeprecationNotice } from './notices/DeprecationNotice.js';
* Export events
*/
export { TapEvent } from './events/TapEvent.js';
export type { FocusedChangedEvent } from './types/events';
export type { FocusedChangedEvent } from './types/events.js';

/**
* Export common interfaces
*/
export type { MultiValue } from './interfaces/MultiValue';
export type { StyleMap } from './interfaces/StyleMap';
export type { StyleInfo } from './interfaces/StyleInfo';
wsuwt marked this conversation as resolved.
Show resolved Hide resolved
export type { MultiValue } from './interfaces/MultiValue.js';
export type { StyleMap } from './interfaces/StyleMap.js';
export type { StyleInfo } from './interfaces/StyleInfo.js';

/**
* Export useful utils
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-block/src/demo-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ themeLabel.style.textTransform = 'uppercase';
themeLabel.innerHTML = removePrefixName(currentTheme);

const versionTag = document.createElement('span');
versionTag.innerHTML = 'V5';
versionTag.innerHTML = 'V6';
versionTag.style.marginLeft = '8px';
versionTag.style.color = '#334BFF';
themeLabel.appendChild(versionTag);
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/autosuggest/helpers/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { uuid } from '@refinitiv-ui/utils/uuid.js';
import { updateElementContent } from './utils.js';
import { AutosuggestQuery, AutosuggestRenderer, Suggestion, AutosuggestItem } from './types';
import { AutosuggestQuery, AutosuggestRenderer, Suggestion, AutosuggestItem } from './types.js';

/**
* Build item element from data object
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/autosuggest/helpers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Item } from '../../item';
import { AutosuggestHighlightable, AutosuggestItem } from './types';
import { AutosuggestHighlightable, AutosuggestItem } from './types.js';

/**
* Check whether item can be highlighted
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/src/autosuggest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
TranslateDirective,
TranslatePropertyKey
} from '@refinitiv-ui/translate';
import { TapEvent } from '../events';
import { TapEvent } from '../events.js';
import type {
AutosuggestTargetElement,
AutosuggestHighlightable,
Expand Down Expand Up @@ -55,7 +55,7 @@ export type {
SuggestionsClearRequestedEvent,
SuggestionsQueryEvent,
SuggestionsChangedEvent
} from './helpers/types';
} from './helpers/types.js';
export { updateElementContent } from './helpers/utils.js';
export {
itemHighlightable,
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import {
DateButtonElement,
NavigationDirection,
WeekdayName
} from './types';
} from './types.js';
import type { TapEvent } from '../events';
import type { Button } from '../button';
import './locales.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/src/combo-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js'
import { AnimationTaskRunner, TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
import { registerOverflowTooltip } from '../tooltip/index.js';
import { isElementOverflown } from '@refinitiv-ui/utils/element.js';
import { ItemData } from '../item';
import { ComboBoxData, ComboBoxFilter } from './helpers/types';
import { ItemData } from '../item/index.js';
import { ComboBoxData, ComboBoxFilter } from './helpers/types.js';
import type { List } from '../list/index.js';
import { ComboBoxRenderer } from './helpers/renderer.js';
import { defaultFilter } from './helpers/filter.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/datetime-field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
NavigationKeys,
DateTimeFormatPart,
InputSelection
} from './types';
} from './types.js';
import { TextField } from '../text-field/index.js';
import {
getSelectedPartIndex,
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/datetime-field/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DateTimeFormatPart, DateTimeFormatPartTypes, InputSelection } from './types';
import { DateTimeFormatPart, DateTimeFormatPartTypes, InputSelection } from './types.js';
import { Direction } from './constants.js';

const IterablePartTypes: DateTimeFormatPartTypes[] = ['year', 'day', 'month', 'hour', 'minute', 'second', 'weekday', 'dayPeriod', 'fractionalSecond'];
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/heatmap/helpers/text.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HeatmapCell } from './types';
import type { HeatmapCell } from './types.js';

const MIN_FONT_SIZE = 10;
const MAX_FONT_SIZE = 16;
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/heatmap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { getResponsiveFontSize, getMaximumTextWidth, MIN_FONT_SIZE } from './hel
const MAX_CELL_WIDTH_RATIO = 0.85;
const DEFAULT_CANVAS_RATIO = 0.75; // ratio — 4:3

export type { HeatmapCell, HeatmapXAxis, HeatmapYAxis, HeatmapConfig, HeatmapTooltipCallback, HeatmapRenderCallback, HeatmapCustomisableProperties } from './helpers/types';
export type { HeatmapCell, HeatmapXAxis, HeatmapYAxis, HeatmapConfig, HeatmapTooltipCallback, HeatmapRenderCallback, HeatmapCustomisableProperties } from './helpers/types.js';

/**
* A graphical representation of data where the individual
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { VERSION } from './version.js';
export * from './events';
export * from './events.js';
export * from '@refinitiv-ui/core';
2 changes: 1 addition & 1 deletion packages/elements/src/item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ItemType } from './helpers/types';
import '../icon/index.js';
import '../checkbox/index.js';

export * from './helpers/types';
export * from './helpers/types.js';

const isAllWhitespaceTextNode = (node: Node): boolean =>
node.nodeType === document.TEXT_NODE
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/overlay-menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import '../item/index.js';
import { Item, ItemData } from '../item/index.js';
import { Overlay, OverlayPosition, OverlayPositionTarget } from '../overlay/index.js';
import { applyLock } from '../overlay/managers/interaction-lock-manager.js';
import { OverlayMenuData, Navigation } from './helpers/types';
import { OverlayMenuData, Navigation } from './helpers/types.js';
import { OpenedMenusManager } from './managers/menu-manager.js';

export type { OverlayMenuData };
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/overlay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type {
Position as OverlayPosition,
PositionTarget as OverlayPositionTarget,
TransitionStyle as OverlayTransitionStyle
} from './helpers/types';
} from './helpers/types.js';

export {
Overlay
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/time-picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
import { property } from '@refinitiv-ui/core/decorators/property.js';
import { state } from '@refinitiv-ui/core/decorators/state.js';
import { query } from '@refinitiv-ui/core/decorators/query.js';
import { ValueChangedEvent, FocusedChangedEvent } from '../events';
import { ValueChangedEvent, FocusedChangedEvent } from '../events.js';
import { VERSION } from '../version.js';
import {
isValidTime,
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/src/tree/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './elements/tree.js';
export * from './elements/tree-item.js';
export { TreeRenderer } from './helpers/renderer.js';
export type { TreeData, TreeDataItem } from './helpers/types';
export type { TreeData, TreeDataItem } from './helpers/types.js';
2 changes: 1 addition & 1 deletion packages/i18n/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type {
UnicodeExtensions,
MessageFormats,
MessageOptions
} from './types';
} from './types.js';

export {
LangObserverCallback,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type {
Translations
} from './types';
} from './types.js';

export {
Phrasebook,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/de/color-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import dialogTranslations from './dialog';
import dialogTranslations from './dialog.js';

const translations = {
...dialogTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/de/tree-select.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import comboboxTranslations from './combo-box';
import comboboxTranslations from './combo-box.js';

const translations = {
...comboboxTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/en/color-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import dialogTranslations from './dialog';
import dialogTranslations from './dialog.js';

const translations = {
...dialogTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/en/tree-select.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import comboboxTranslations from './combo-box';
import comboboxTranslations from './combo-box.js';

const translations = {
...comboboxTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/ja/color-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import dialogTranslations from './dialog';
import dialogTranslations from './dialog.js';

const translations = {
...dialogTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/ja/tree-select.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import comboboxTranslations from './combo-box';
import comboboxTranslations from './combo-box.js';

const translations = {
...comboboxTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/zh-hant/color-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import dialogTranslations from './dialog';
import dialogTranslations from './dialog.js';

const translations = {
...dialogTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/zh-hant/tree-select.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import comboboxTranslations from './combo-box';
import comboboxTranslations from './combo-box.js';

const translations = {
...comboboxTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/zh/color-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import dialogTranslations from './dialog';
import dialogTranslations from './dialog.js';

const translations = {
...dialogTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/src/locale/zh/tree-select.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
import { Phrasebook } from '../../translation.js';
import './shared.js';
import comboboxTranslations from './combo-box';
import comboboxTranslations from './combo-box.js';

const translations = {
...comboboxTranslations,
Expand Down
2 changes: 1 addition & 1 deletion packages/translate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It is used in conjunction with `@refinitiv-ui/phrasebook` and `@refinitiv-ui/i18

## Usage

`@refinitiv-ui/translate` is designed for Element Framework v5 and Lit Element.
`@refinitiv-ui/translate` is designed for Element Framework v6 and Lit Element.

```cli
npm install @refinitiv-ui/translate
Expand Down
4 changes: 2 additions & 2 deletions packages/translate/src/test/test-inherited.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { query } from '@refinitiv-ui/core/decorators/query.js';
import {
translate,
TranslateDirective
} from '../translate';
} from '../translate.js';

import { TestTranslate } from './test-translate';
import { TestTranslate } from './test-translate.js';

@customElement('test-inherited', { theme: false })
export class TestInherited extends TestTranslate {
Expand Down
6 changes: 3 additions & 3 deletions packages/translate/src/test/test-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
import {
translate,
TranslatePromise
} from '../translate';
} from '../translate.js';

import './test-nested-translate';
import './phrasebook';
import './test-nested-translate.js';
import './phrasebook.js';

@customElement('test-promise', { theme: false })
export class TestPromise extends BasicElement {
Expand Down
Loading