Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions apps/demos/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
import spellcheckDevextreme from 'eslint-config-devextreme/spell-check.js';
import spellcheckDevextreme from 'eslint-config-devextreme/spell-check';
import testcafeConfig from 'eslint-config-devextreme/testcafe';
import typescriptConfig from 'eslint-config-devextreme/typescript';
import javascriptConfig from 'eslint-config-devextreme/javascript';
import spellcheckPlugin from 'eslint-plugin-spellcheck';
import noOnlyTests from 'eslint-plugin-no-only-tests';
import deprecation from 'eslint-plugin-deprecation';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactPerf from 'eslint-plugin-react-perf';
import jest from 'eslint-plugin-jest';
import vuePlugin from 'eslint-plugin-vue';
import vueParser from 'vue-eslint-parser';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
Expand All @@ -28,7 +32,7 @@ const compat = new FlatCompat({
allConfig: js.configs.all
});

const spellcheckRule = spellcheckDevextreme.rules['spellcheck/spell-checker'];
const spellcheckRule = spellcheckDevextreme[0].rules['spellcheck/spell-checker'];

export default [
{
Expand Down Expand Up @@ -76,13 +80,13 @@ export default [
},
},

...compat.extends('eslint:recommended', 'devextreme/spell-check'),

...compat.extends('devextreme/javascript').map(config => ({
js.configs.recommended,
...spellcheckDevextreme,
...javascriptConfig.map(config => ({
...config,
rules: changeRulesToStylistic(config.rules || {}),
})),
...compat.extends('devextreme/typescript').map(config => ({
...typescriptConfig.map(config => ({
...config,
files: ['**/*.ts', '**/*.tsx'],
rules: changeRulesToStylistic(config.rules || {}),
Expand Down Expand Up @@ -369,7 +373,7 @@ export default [
},

// Vue demos
...compat.extends('plugin:vue/vue3-recommended').map(config => ({
...vuePlugin.configs['flat/recommended'].map(config => ({
...config,
files: [
'Demos/**/Vue/*.vue',
Expand Down Expand Up @@ -466,9 +470,13 @@ export default [
},

// testcafe tests
...compat.extends('devextreme/testcafe').map(config => ({
...testcafeConfig.map(config => ({
...config,
rules: changeRulesToStylistic(config.rules || {}),
rules: {
...changeRulesToStylistic(config.rules || {}),
'require-await': 'warn',

},
files: ['testing/**/*.{js,ts}', 'utils/visual-tests/**/*.*'],
})),

Expand Down Expand Up @@ -501,7 +509,25 @@ export default [
// utils directory
{
files: [
'utils/**/*.{js,ts}',
'utils/**/*.js',
],
ignores: [
'utils/testing/',
'utils/visual-tests/',
'utils/templates/',
],
rules: {
'no-console': 0,
'no-await-in-loop': 0,
'no-restricted-syntax': 0,
'@typescript-eslint/await-thenable': 0,
'spellcheck/spell-checker': 0,
'consistent-return': 0,
},
},
{
files: [
'utils/**/*.ts',
],
ignores: [
'utils/testing/',
Expand All @@ -510,7 +536,7 @@ export default [
],
languageOptions: {
parserOptions: {
projectService: true,
project: './tsconfig.json',
},
},
rules: {
Expand Down
4 changes: 3 additions & 1 deletion apps/demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
"eslint-plugin-no-only-tests": "catalog:",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-perf": "3.3.2",
"eslint-plugin-react-perf": "3.3.3",
"eslint-plugin-vue": "catalog:",
"express": "4.22.0",
"glob": "11.1.0",
"globals": "catalog:",
Expand All @@ -152,6 +153,7 @@
"testcafe": "3.7.2",
"testcafe-reporter-spec-time": "4.0.0",
"ts-node": "10.9.2",
"vue-eslint-parser": "catalog:",
"vue-tsc": "3.0.8"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ runManualTest('FileUploader', 'CustomDropzone', (test) => {
const triggerDragEnter = async (dropZoneSelector, items) => {
await ClientFunction(() => {
// @ts-expect-error $ is not typed
// eslint-disable-next-line no-undef
const $dropZone = $(dropZoneSelector);
const { left, top } = $dropZone.offset();
// @ts-expect-error $ is not typed
// eslint-disable-next-line no-undef
$dropZone.trigger($.Event('dragenter', {
// @ts-expect-error $ is not typed
// eslint-disable-next-line no-undef
originalEvent: $.Event('dragenter', {
dataTransfer: {
items,
Expand Down
1 change: 1 addition & 0 deletions apps/demos/utils/create-bundles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ async function processBatch(bundler: ESBundler, demos: Demo[]) {
await Promise.all(promises);
}

// eslint-disable-next-line require-await
async function processDemo(bundler: ESBundler, demo: Demo) {
return new Promise((res) => {
bundler.buildDemo(demo, res);
Expand Down
2 changes: 2 additions & 0 deletions apps/demos/utils/ts-to-js-converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const pipeSource = async (
}));
};

// eslint-disable-next-line require-await
const execTsc = async (directory: string, args: string): Promise<string> => new Promise((resolve, reject) => {
cps.exec(`tsc ${args}`, (error, stdout, stderr) => {
if (error != null) {
Expand Down Expand Up @@ -140,6 +141,7 @@ const strip = async (resolve: PathResolvers, log: Logger) => {
});
};

// eslint-disable-next-line require-await
const replaceInFiles = async (filenamePatterns: string[], replacementCallback: (string) => string, resolvePath: (string) => string, log: Logger) => (
Promise.all(
filenamePatterns.map(async (pattern) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/bundlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@eslint/eslintrc": "catalog:",
"@stylistic/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"eslint-config-devextreme": "1.1.6",
"eslint-config-devextreme": "catalog:",
"eslint-plugin-i18n": "catalog:",
"eslint-plugin-import": "catalog:",
"eslint-plugin-no-only-tests": "catalog:",
Expand Down
2 changes: 1 addition & 1 deletion e2e/compilation-cases/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@stylistic/eslint-plugin": "catalog:",
"@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"eslint-config-devextreme": "1.1.6",
"eslint-config-devextreme": "catalog:",
"eslint-migration-utils": "workspace:*",
"eslint-plugin-i18n": "catalog:",
"eslint-plugin-import": "catalog:",
Expand Down
3 changes: 2 additions & 1 deletion e2e/testcafe-devextreme/docker/run-testcafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const matrix = [
];
(async() => {

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

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

const startupParams = Object.entries(args).map(([key, value]) => `--${key}=${value}`);
Expand Down
15 changes: 9 additions & 6 deletions e2e/testcafe-devextreme/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import js from '@eslint/js';
import { FlatCompat as FlatCompatibility } from '@eslint/eslintrc';
import stylistic from '@stylistic/eslint-plugin';
import { changeRulesToStylistic } from 'eslint-migration-utils';
import spellCheckConfig from 'eslint-config-devextreme/spell-check';
import typescriptConfig from 'eslint-config-devextreme/typescript';
import testcafeConfig from 'eslint-config-devextreme/testcafe';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -24,8 +27,8 @@ export default [
'node_modules/**',
],
},
...compatibility.extends('devextreme/spell-check'),
...compatibility.extends('devextreme/testcafe'),
...spellCheckConfig,
...testcafeConfig,
{
plugins: {
'no-only-tests': noOnlyTests,
Expand Down Expand Up @@ -128,7 +131,6 @@ export default [
'space-before-function-paren': ['error', 'never'],
'space-in-parens': 'error',
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'@stylistic/space-infix-ops': 'error',
'space-unary-ops': 'error',
'spaced-comment': ['error', 'always', {
Expand All @@ -155,7 +157,7 @@ export default [
'import/no-duplicates': 2,
}
},
...compatibility.extends('devextreme/typescript').map(config => {
...typescriptConfig.map(config => {
const newConfig = {
...config,
files: ['**/*.ts?(x)'],
Expand Down Expand Up @@ -216,10 +218,11 @@ export default [
'no-await-in-loop': 'off',
'@stylistic/no-extra-parens': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-base-to-string': 'off'
'@typescript-eslint/no-base-to-string': 'off',
'require-await': 'off',
},
},
...compatibility.extends('devextreme/typescript').map(config => {
...typescriptConfig.map(config => {
const newConfig = {
...config,
files: ['**/*.d.ts'],
Expand Down
3 changes: 1 addition & 2 deletions e2e/testcafe-devextreme/helpers/callbackTestHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ClientFunction } from 'testcafe';

type WindowCallbackExtended =
Window
type WindowCallbackExtended = Window
& typeof globalThis
& {
clientTesting?: {
Expand Down
4 changes: 2 additions & 2 deletions e2e/testcafe-devextreme/helpers/createWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export const createWidget = async<TWidgetName extends WidgetName>(
widgetName: TWidgetName,
widgetOptions: TWidgetName extends keyof WidgetOptions
? (
WidgetOptions[TWidgetName] |
WidgetOptions[TWidgetName]
// NOTE: Promise is only for ClientFunction typing
(() => (WidgetOptions[TWidgetName]) | Promise<WidgetOptions[TWidgetName]>)
| (() => (WidgetOptions[TWidgetName]) | Promise<WidgetOptions[TWidgetName]>)
) : unknown,
selector = DEFAULT_SELECTOR,
{ disableFxAnimation } = DEFAULT_OPTIONS,
Expand Down
6 changes: 3 additions & 3 deletions e2e/testcafe-devextreme/helpers/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getStyleAttribute = ClientFunction((selector) => {
export const setStyleAttribute = ClientFunction((selector, styleValue) => {
const element = selector();

const styles = element.getAttribute('style') || '';
const styles = element.getAttribute('style') ?? '';
const updatedStyles = `${styles} ${styleValue}`;

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

const styles = element.getAttribute('class') || '';
const styles = element.getAttribute('class') ?? '';
const updatedClasses = `${styles} ${styleValue}`;

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

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

element.setAttribute('class', updatedClasses);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* eslint-disable no-undef */
function getRoot() {
return document.querySelector('#parentContainer').shadowRoot;
}
Expand Down
3 changes: 1 addition & 2 deletions e2e/testcafe-devextreme/helpers/widgetTypings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Properties as DataGridProperties } from 'devextreme/ui/data_grid';
import type { Properties as FilterBuilderProperties } from 'devextreme/ui/filter_builder';

export type WidgetName =
'dxAccordion'
export type WidgetName = 'dxAccordion'
| 'dxAutocomplete'
| 'dxGallery'
| 'dxButtonGroup'
Expand Down
2 changes: 1 addition & 1 deletion e2e/testcafe-devextreme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@stylistic/eslint-plugin": "catalog:",
"@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"eslint-config-devextreme": "1.1.6",
"eslint-config-devextreme": "catalog:",
"eslint-migration-utils": "workspace:*",
"eslint-plugin-i18n": "catalog:",
"eslint-plugin-import": "catalog:",
Expand Down
2 changes: 1 addition & 1 deletion e2e/testcafe-devextreme/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ async function main() {

await t.hover('html');

const [width, height] = meta?.browserSize || DEFAULT_BROWSER_SIZE;
const [width, height] = meta?.browserSize ?? DEFAULT_BROWSER_SIZE;
await t.resizeWindow(width, height);
} else {
await loadAxeCore(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.meta({ themes: [Themes.genericLight] })('ContextMenu width should be adjust
visible: true,
},
onContextMenuPreparing(e) {
if (e.field && e.field.dataField === 'amount') {
if (e.field?.dataField === 'amount') {
const menuItems = [] as any;

e.items.push({ text: 'Summary Type', items: menuItems });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getVisibleColumns = (dataGrid: DataGrid): Promise<string[]> => {
return ClientFunction(
() => (getInstance() as any)
.getVisibleColumns()
.map((column: any) => column.dataField || column.name),
.map((column: any) => column.dataField ?? column.name),
{ dependencies: { getInstance } },
)();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import { CallbackTestHelper, WindowCallbackExtended } from '../../../../../helpe
fixture`Focused row - new rows T1162227`
.page(url(__dirname, '../../../../container.html'));

type FocusCellChangingData =
[[prevRowIdx: number, prevColumnIdx: number], [rowIdx: number, columnIdx: number]];
type FocusCellChangingData = [
[prevRowIdx: number, prevColumnIdx: number],
[rowIdx: number, columnIdx: number],
];
type FocusCellChangedData = [rowIdx: number, columnIdx: number];
type FocusRowChangingData = [prevRowIdx: number, rowIdx: number];
type FocusRowChangedData = [rowIdx: number];
Expand Down
Loading
Loading