Skip to content

Commit

Permalink
feat(linter): fix lint errors on text component
Browse files Browse the repository at this point in the history
  • Loading branch information
manoncarbonnel authored and dpellier committed Oct 26, 2023
1 parent a722500 commit e0f3c92
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 165 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "h" }],
"@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
"array-bracket-spacing": ["error", "never"],
"arrow-parens": ["error", "always"],
"arrow-spacing": ["error", { "before": true, "after": true }],
Expand Down
5 changes: 3 additions & 2 deletions packages/components/text/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getStencilJestConfig } from '@ovhcloud/ods-common-testing';
import {getStencilJestConfig} from '@ovhcloud/ods-common-testing';

const start = 2;
const config = getStencilJestConfig({
args: process.argv.slice(2),
args: process.argv.slice(start),
});

export default config;
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { OdsTextAttribute } from '../interfaces/attributes';
import { ODS_TEXT_COLOR_HUE, ODS_TEXT_COLOR_INTENT } from './text-color';
import { ODS_TEXT_LEVEL } from './text-level';
import { ODS_TEXT_SIZE } from './text-size';
import {ODS_TEXT_COLOR_HUE, ODS_TEXT_COLOR_INTENT} from './text-color';
import {ODS_TEXT_LEVEL} from './text-level';
import {ODS_TEXT_SIZE} from './text-size';
import type {OdsTextAttribute} from '../interfaces/attributes';

const DEFAULT_ATTRIBUTE: OdsTextAttribute = Object.freeze({
breakSpaces: false,
color: ODS_TEXT_COLOR_INTENT.default,
contrasted: false,
hue: ODS_TEXT_COLOR_HUE._500,
level: ODS_TEXT_LEVEL.body,
size: ODS_TEXT_SIZE._100,
hue: ODS_TEXT_COLOR_HUE._500,
});

export {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ODS_THEME_COLOR_INTENT, ODS_THEME_COLOR_INTENTS, ODS_THEME_COLOR_HUE, ODS_THEME_COLOR_HUES } from '@ovhcloud/ods-common-theming';
import {ODS_THEME_COLOR_HUE, ODS_THEME_COLOR_HUES, ODS_THEME_COLOR_INTENT, ODS_THEME_COLOR_INTENTS} from '@ovhcloud/ods-common-theming';

export {
ODS_THEME_COLOR_INTENT as ODS_TEXT_COLOR_INTENT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ODS_THEME_TYPOGRAPHY_LEVEL, ODS_THEME_TYPOGRAPHY_LEVELS } from '@ovhcloud/ods-common-theming';
import {ODS_THEME_TYPOGRAPHY_LEVEL, ODS_THEME_TYPOGRAPHY_LEVELS} from '@ovhcloud/ods-common-theming';

export {
ODS_THEME_TYPOGRAPHY_LEVEL as ODS_TEXT_LEVEL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ODS_THEME_TYPOGRAPHY_SIZE, ODS_THEME_TYPOGRAPHY_SIZES } from '@ovhcloud/ods-common-theming';
import {ODS_THEME_TYPOGRAPHY_SIZE, ODS_THEME_TYPOGRAPHY_SIZES} from '@ovhcloud/ods-common-theming';

export {
ODS_THEME_TYPOGRAPHY_SIZE as ODS_TEXT_SIZE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ODS_TEXT_COLOR_HUE, ODS_TEXT_COLOR_INTENT } from '../constants/text-color';
import type { ODS_TEXT_LEVEL } from '../constants/text-level';
import type { ODS_TEXT_SIZE } from '../constants/text-size';
import type {ODS_TEXT_COLOR_HUE, ODS_TEXT_COLOR_INTENT} from '../constants/text-color';
import type {ODS_TEXT_LEVEL} from '../constants/text-level';
import type {ODS_TEXT_SIZE} from '../constants/text-size';

interface OdsTextAttribute {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import type { E2EPage } from '@stencil/core/testing';
import type { OdsTextAttribute } from './interfaces/attributes';
import { odsComponentAttributes2StringAttributes, odsStringAttributes2Str } from '@ovhcloud/ods-common-testing';
import { ODS_TEXT_COLOR_HUES, ODS_TEXT_COLOR_INTENTS } from './constants/text-color';
import { newE2EPage } from '@stencil/core/testing';
import { ODS_TEXT_LEVELS } from './constants/text-level';
import { ODS_TEXT_SIZES } from './constants/text-size';
import { DEFAULT_ATTRIBUTE } from './constants/default-attributes';
import {ODS_TEXT_COLOR_HUES, ODS_TEXT_COLOR_INTENTS} from './constants/text-color';
import {odsComponentAttributes2StringAttributes, odsStringAttributes2Str} from '@ovhcloud/ods-common-testing';
import {DEFAULT_ATTRIBUTE} from './constants/default-attributes';
import type {E2EPage} from '@stencil/core/testing';
import {ODS_TEXT_LEVELS} from './constants/text-level';
import {ODS_TEXT_SIZES} from './constants/text-size';
import type {OdsTextAttribute} from './interfaces/attributes';
import {newE2EPage} from '@stencil/core/testing';

const slotContent = 'Text';

describe('e2e:osds-text', () => {
let page: E2EPage;
let variations: Array<string>;

async function setup(content: string) {
async function setup(content: string): Promise<void> {
page = await newE2EPage();

await page.setContent(content);
Expand All @@ -28,17 +28,17 @@ describe('e2e:osds-text', () => {
variations = [];
});

it('should take screenshots of all attributes variations', async () => {
it('should take screenshots of all attributes variations', async() => {
ODS_TEXT_COLOR_HUES.forEach((hue) => {
ODS_TEXT_COLOR_INTENTS.forEach((color) => {
ODS_TEXT_SIZES.forEach((size) => {
ODS_TEXT_LEVELS.forEach((level) => {
variations.push(`
<osds-text ${odsStringAttributes2Str(
odsComponentAttributes2StringAttributes<OdsTextAttribute>(
{ color, level, size, hue }, DEFAULT_ATTRIBUTE
)
)}>
odsComponentAttributes2StringAttributes<OdsTextAttribute>(
{color, hue, level, size}, DEFAULT_ATTRIBUTE,
),
)}>
${slotContent}
</osds-text>`);
});
Expand All @@ -51,12 +51,12 @@ describe('e2e:osds-text', () => {
ODS_TEXT_LEVELS.forEach((level) => {
variations.push(`
<osds-text ${odsStringAttributes2Str(
odsComponentAttributes2StringAttributes<OdsTextAttribute>(
{ level, size, contrasted }, DEFAULT_ATTRIBUTE
)
)}>
odsComponentAttributes2StringAttributes<OdsTextAttribute>(
{contrasted, level, size}, DEFAULT_ATTRIBUTE,
),
)}>
${slotContent}
</osds-text>`
</osds-text>`,
);
});
});
Expand All @@ -65,8 +65,8 @@ describe('e2e:osds-text', () => {
await setup(variations.join(''));
await page.waitForChanges();

const results = await page.compareScreenshot('text', { fullPage: true });
expect(results).toMatchScreenshot({ allowableMismatchedRatio: 0 });
const results = await page.compareScreenshot('text', {fullPage: true});
expect(results).toMatchScreenshot({allowableMismatchedRatio: 0});
});
});
});
Loading

0 comments on commit e0f3c92

Please sign in to comment.