Skip to content

Commit 5626c72

Browse files
committed
Update eslint config for e2e tests
1 parent 619d7f6 commit 5626c72

7 files changed

Lines changed: 18 additions & 14 deletions

File tree

e2e/testcafe-devextreme/docker/run-testcafe.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const matrix = [
3030
];
3131
(async() => {
3232

33+
// eslint-disable-next-line no-undef
3334
const parsedArgs = parseArgs(process.argv);
3435
const componentFolderName = parsedArgs.componentFolder;
3536
let testParts = matrix;
@@ -45,7 +46,7 @@ const matrix = [
4546

4647
// eslint-disable-next-line no-restricted-syntax
4748
for (const { name, ...args } of testParts) {
48-
// eslint-disable-next-line no-console
49+
// eslint-disable-next-line no-console,no-undef
4950
console.log(`Started test: ${name}`);
5051

5152
const startupParams = Object.entries(args).map(([key, value]) => `--${key}=${value}`);

e2e/testcafe-devextreme/eslint.config.mjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import js from '@eslint/js';
99
import { FlatCompat as FlatCompatibility } from '@eslint/eslintrc';
1010
import stylistic from '@stylistic/eslint-plugin';
1111
import { changeRulesToStylistic } from 'eslint-migration-utils';
12+
import spellCheckConfig from 'eslint-config-devextreme/spell-check';
13+
import typescriptConfig from 'eslint-config-devextreme/typescript';
14+
import testcafeConfig from 'eslint-config-devextreme/testcafe';
1215

1316
const __filename = fileURLToPath(import.meta.url);
1417
const __dirname = path.dirname(__filename);
@@ -24,8 +27,8 @@ export default [
2427
'node_modules/**',
2528
],
2629
},
27-
...compatibility.extends('devextreme/spell-check'),
28-
...compatibility.extends('devextreme/testcafe'),
30+
...spellCheckConfig,
31+
...testcafeConfig,
2932
{
3033
plugins: {
3134
'no-only-tests': noOnlyTests,
@@ -128,7 +131,6 @@ export default [
128131
'space-before-function-paren': ['error', 'never'],
129132
'space-in-parens': 'error',
130133
'space-infix-ops': 'error',
131-
'space-unary-ops': 'error',
132134
'@stylistic/space-infix-ops': 'error',
133135
'space-unary-ops': 'error',
134136
'spaced-comment': ['error', 'always', {
@@ -155,7 +157,7 @@ export default [
155157
'import/no-duplicates': 2,
156158
}
157159
},
158-
...compatibility.extends('devextreme/typescript').map(config => {
160+
...typescriptConfig.map(config => {
159161
const newConfig = {
160162
...config,
161163
files: ['**/*.ts?(x)'],
@@ -216,10 +218,11 @@ export default [
216218
'no-await-in-loop': 'off',
217219
'@stylistic/no-extra-parens': 'off',
218220
'@typescript-eslint/require-await': 'off',
219-
'@typescript-eslint/no-base-to-string': 'off'
221+
'@typescript-eslint/no-base-to-string': 'off',
222+
'require-await': 'off',
220223
},
221224
},
222-
...compatibility.extends('devextreme/typescript').map(config => {
225+
...typescriptConfig.map(config => {
223226
const newConfig = {
224227
...config,
225228
files: ['**/*.d.ts'],

e2e/testcafe-devextreme/helpers/domUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const getStyleAttribute = ClientFunction((selector) => {
3535
export const setStyleAttribute = ClientFunction((selector, styleValue) => {
3636
const element = selector();
3737

38-
const styles = element.getAttribute('style') || '';
38+
const styles = element.getAttribute('style') ?? '';
3939
const updatedStyles = `${styles} ${styleValue}`;
4040

4141
element.setAttribute('style', updatedStyles);
@@ -44,7 +44,7 @@ export const setStyleAttribute = ClientFunction((selector, styleValue) => {
4444
export const setClassAttribute = ClientFunction((selector, styleValue) => {
4545
const element = selector();
4646

47-
const styles = element.getAttribute('class') || '';
47+
const styles = element.getAttribute('class') ?? '';
4848
const updatedClasses = `${styles} ${styleValue}`;
4949

5050
element.setAttribute('class', updatedClasses);
@@ -53,7 +53,7 @@ export const setClassAttribute = ClientFunction((selector, styleValue) => {
5353
export const removeClassAttribute = ClientFunction((selector, styleValue) => {
5454
const element = selector();
5555

56-
const styles = element.getAttribute('class') || '';
56+
const styles = element.getAttribute('class') ?? '';
5757
const updatedClasses = `${styles.replace(styleValue, '')}`;
5858

5959
element.setAttribute('class', updatedClasses);

e2e/testcafe-devextreme/helpers/shadowDom/shadowDomExtension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* eslint-disable no-undef */
22
function getRoot() {
33
return document.querySelector('#parentContainer').shadowRoot;
44
}

e2e/testcafe-devextreme/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ async function main() {
274274

275275
await t.hover('html');
276276

277-
const [width, height] = meta?.browserSize || DEFAULT_BROWSER_SIZE;
277+
const [width, height] = meta?.browserSize ?? DEFAULT_BROWSER_SIZE;
278278
await t.resizeWindow(width, height);
279279
} else {
280280
await loadAxeCore(t);

e2e/testcafe-devextreme/tests/common/pivotGrid/contextMenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test.meta({ themes: [Themes.genericLight] })('ContextMenu width should be adjust
3838
visible: true,
3939
},
4040
onContextMenuPreparing(e) {
41-
if (e.field && e.field.dataField === 'amount') {
41+
if (e.field?.dataField === 'amount') {
4242
const menuItems = [] as any;
4343

4444
e.items.push({ text: 'Summary Type', items: menuItems });

e2e/testcafe-devextreme/tests/dataGrid/common/columnReordering.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getVisibleColumns = (dataGrid: DataGrid): Promise<string[]> => {
1515
return ClientFunction(
1616
() => (getInstance() as any)
1717
.getVisibleColumns()
18-
.map((column: any) => column.dataField || column.name),
18+
.map((column: any) => column.dataField ?? column.name),
1919
{ dependencies: { getInstance } },
2020
)();
2121
};

0 commit comments

Comments
 (0)