From 41c6728528384fdf8dd322eb18ebc9bf80b34bd7 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 24 Jan 2023 09:39:07 +0300 Subject: [PATCH] Fix more ESLint errors (#5619) --- .eslintrc.js | 2 +- cvat-core/tests/api/projects.js | 4 ++-- cvat-core/tests/api/tasks.js | 6 +++--- .../move-task-modal/label-mapper-item.tsx | 18 ++++++++---------- .../src/components/project-page/details.tsx | 2 +- .../opencv-wrapper/histogram-equalization.ts | 4 ++-- .../case_113_new_organization_pipeline.js | 6 +++--- .../case_57_project_label_deleting_feature.js | 2 +- .../base_actions_project_task_user.js | 2 +- .../case_19_all_image_rotate_features.js | 2 +- .../issue_1882_polygon_interpolation.js | 4 ++-- ...ue_1886_point_coordinates_not_duplicated.js | 2 +- tests/cypress/support/const.js | 2 +- 13 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 152821a7..f698f363 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -39,7 +39,7 @@ module.exports = { 'func-names': 0, 'valid-typeof': 0, 'no-useless-constructor': 0, // sometimes constructor is necessary to generate right documentation in cvat-core - 'quotes': ['error', 'single'], + 'quotes': ['error', 'single', { "avoidEscape": true }], 'lines-between-class-members': 0, 'class-methods-use-this': 0, 'no-underscore-dangle': ['error', { allowAfterThis: true }], diff --git a/cvat-core/tests/api/projects.js b/cvat-core/tests/api/projects.js index 082cd034..da5d61d1 100644 --- a/cvat-core/tests/api/projects.js +++ b/cvat-core/tests/api/projects.js @@ -97,7 +97,7 @@ describe('Feature: save a project', () => { const labelsLength = result[0].labels.length; const newLabel = new window.cvat.classes.Label({ - name: 'My boss\'s car', + name: "My boss's car", attributes: [ { default_value: 'false', @@ -117,7 +117,7 @@ describe('Feature: save a project', () => { }); expect(result[0].labels).toHaveLength(labelsLength + 1); - const appendedLabel = result[0].labels.filter((el) => el.name === 'My boss\'s car'); + const appendedLabel = result[0].labels.filter((el) => el.name === "My boss's car"); expect(appendedLabel).toHaveLength(1); expect(appendedLabel[0].attributes).toHaveLength(1); expect(appendedLabel[0].attributes[0].name).toBe('parked'); diff --git a/cvat-core/tests/api/tasks.js b/cvat-core/tests/api/tasks.js index 96ccd95e..9b4d343d 100644 --- a/cvat-core/tests/api/tasks.js +++ b/cvat-core/tests/api/tasks.js @@ -124,7 +124,7 @@ describe('Feature: save a task', () => { const labelsLength = result[0].labels.length; const newLabel = new window.cvat.classes.Label({ - name: 'My boss\'s car', + name: "My boss's car", attributes: [ { default_value: 'false', @@ -144,7 +144,7 @@ describe('Feature: save a task', () => { }); expect(result[0].labels).toHaveLength(labelsLength + 1); - const appendedLabel = result[0].labels.filter((el) => el.name === 'My boss\'s car'); + const appendedLabel = result[0].labels.filter((el) => el.name === "My boss's car"); expect(appendedLabel).toHaveLength(1); expect(appendedLabel[0].attributes).toHaveLength(1); expect(appendedLabel[0].attributes[0].name).toBe('parked'); @@ -158,7 +158,7 @@ describe('Feature: save a task', () => { name: 'New Task', labels: [ { - name: 'My boss\'s car', + name: "My boss's car", attributes: [ { default_value: 'false', diff --git a/cvat-ui/src/components/move-task-modal/label-mapper-item.tsx b/cvat-ui/src/components/move-task-modal/label-mapper-item.tsx index 9fdc6063..ad78c90f 100644 --- a/cvat-ui/src/components/move-task-modal/label-mapper-item.tsx +++ b/cvat-ui/src/components/move-task-modal/label-mapper-item.tsx @@ -48,11 +48,10 @@ export default function LabelMapperItem(props: LabelMapperItemProps): JSX.Elemen className='cvat-move-task-label-mapper-item-select' disabled={typeof projectLabels === 'undefined'} value={value.newLabelName || ''} - onChange={(_value) => - onChange({ - ...value, - newLabelName: _value as string, - })} + onChange={(_value) => onChange({ + ...value, + newLabelName: _value as string, + })} > {projectLabels ?.filter((_label) => !labelNames.includes(_label.name)) @@ -67,11 +66,10 @@ export default function LabelMapperItem(props: LabelMapperItemProps): JSX.Elemen - onChange({ - ...value, - clearAttributes: _value.target.checked, - })} + onChange={(_value) => onChange({ + ...value, + clearAttributes: _value.target.checked, + })} > Clear attributes diff --git a/cvat-ui/src/components/project-page/details.tsx b/cvat-ui/src/components/project-page/details.tsx index d502f645..d89e13c8 100644 --- a/cvat-ui/src/components/project-page/details.tsx +++ b/cvat-ui/src/components/project-page/details.tsx @@ -28,7 +28,7 @@ export default function DetailsComponent(props: DetailsComponentProps): JSX.Elem const [projectName, setProjectName] = useState(project.name); return ( -
+
_hashed.frameNumber === frameNumber); if (hashed) { hashed.timestamp = Date.now(); @@ -84,7 +84,7 @@ export default class HistogramEqualizationImplementation implements HistogramEqu return hashed?.frameData || null; } - private hashFrame(frameData:ImageData, frameNumber:number):void{ + private hashFrame(frameData: ImageData, frameNumber: number): void { if (this.histHash.length >= this.bufferSize) { const leastRecentlyUsed = this.histHash[0]; const currentTimestamp = Date.now(); diff --git a/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js b/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js index df2f6e5e..93a9df86 100644 --- a/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js +++ b/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js @@ -189,14 +189,14 @@ context('New organization pipeline.', () => { cy.closeNotification('.cvat-notification-notice-leave-organization-failed'); }); - it('The second user login. The user is able to see the organization, can\'t see the task.', () => { + it("The second user login. The user is able to see the organization, can't see the task.", () => { cy.logout(); cy.login(secondUserName, secondUser.password); cy.checkOrganizationExists(organizationParams.shortName); cy.contains('.cvat-item-task-name', taskName).should('not.exist'); }); - it('The second user activates the organization, can\'t see the project because it is not assigned to him.', () => { + it("The second user activates the organization, can't see the project because it is not assigned to him.", () => { cy.activateOrganization(organizationParams.shortName); cy.goToProjectsList(); cy.contains('.cvat-projects-project-item-title', project.name).should('not.exist'); @@ -232,7 +232,7 @@ context('New organization pipeline.', () => { }); }); - it('Logout, the third user login. The user does not see the project, the task. The user can\'t open the job using direct link.', () => { + it("Logout, the third user login. The user does not see the project, the task. The user can't open the job using direct link.", () => { cy.logout(secondUserName); cy.login(thirdUserName, thirdUser.password); cy.contains('.cvat-item-task-name', taskName).should('not.exist'); diff --git a/tests/cypress/integration/actions_projects_models/case_57_project_label_deleting_feature.js b/tests/cypress/integration/actions_projects_models/case_57_project_label_deleting_feature.js index 00a95df1..3d332dd0 100644 --- a/tests/cypress/integration/actions_projects_models/case_57_project_label_deleting_feature.js +++ b/tests/cypress/integration/actions_projects_models/case_57_project_label_deleting_feature.js @@ -31,7 +31,7 @@ context('Delete a label from a project.', () => { function getProjectID() { cy.contains('.cvat-project-name', projectName) .parents('.cvat-project-details') - .should('have.attr', 'cvat-project-id') + .should('have.attr', 'data-cvat-project-id') .then(($projectID) => { projectID = $projectID; }); diff --git a/tests/cypress/integration/actions_projects_models/registration_involved/base_actions_project_task_user.js b/tests/cypress/integration/actions_projects_models/registration_involved/base_actions_project_task_user.js index bea86be6..26a7a42c 100644 --- a/tests/cypress/integration/actions_projects_models/registration_involved/base_actions_project_task_user.js +++ b/tests/cypress/integration/actions_projects_models/registration_involved/base_actions_project_task_user.js @@ -47,7 +47,7 @@ context('Base actions on the project', () => { function getProjectID(myProjectName) { cy.contains('.cvat-project-name', myProjectName) .parents('.cvat-project-details') - .should('have.attr', 'cvat-project-id') + .should('have.attr', 'data-cvat-project-id') .then(($projectID) => { projectID = $projectID; }); diff --git a/tests/cypress/integration/actions_tasks3/case_19_all_image_rotate_features.js b/tests/cypress/integration/actions_tasks3/case_19_all_image_rotate_features.js index 7de491f5..34222292 100644 --- a/tests/cypress/integration/actions_tasks3/case_19_all_image_rotate_features.js +++ b/tests/cypress/integration/actions_tasks3/case_19_all_image_rotate_features.js @@ -40,7 +40,7 @@ context('Rotate all images feature.', () => { imageRotate('anticlockwise', 270); }); - it('Go to the next frame. It wasn\'t rotated.', () => { + it("Go to the next frame. It wasn't rotated.", () => { cy.get('.cvat-player-next-button').click(); checkFrameNum(1); checkDegRotate(0); diff --git a/tests/cypress/integration/issues_prs/issue_1882_polygon_interpolation.js b/tests/cypress/integration/issues_prs/issue_1882_polygon_interpolation.js index 72e48ed5..3d17a8c9 100644 --- a/tests/cypress/integration/issues_prs/issue_1882_polygon_interpolation.js +++ b/tests/cypress/integration/issues_prs/issue_1882_polygon_interpolation.js @@ -6,7 +6,7 @@ import { taskName, labelName } from '../../support/const'; -context('The points of the previous polygon mustn\'t appear while polygon\'s interpolation.', () => { +context("The points of the previous polygon mustn't appear while polygon's interpolation.", () => { const issueId = '1882'; const createPolygonTrack = { reDraw: false, @@ -48,7 +48,7 @@ context('The points of the previous polygon mustn\'t appear while polygon\'s int .trigger('mousemove', { force: true }) .trigger('keydown', { keyCode: keyCodeN, code: 'KeyN', shiftKey: true }) .trigger('keyup', { - force: true, keyCode: keyCodeN, code: 'KeyN', shiftKey: true + force: true, keyCode: keyCodeN, code: 'KeyN', shiftKey: true, }); cy.createPolygon(reDrawPolygonTrack); }); diff --git a/tests/cypress/integration/issues_prs/issue_1886_point_coordinates_not_duplicated.js b/tests/cypress/integration/issues_prs/issue_1886_point_coordinates_not_duplicated.js index d7b4ae36..c7b8fd60 100644 --- a/tests/cypress/integration/issues_prs/issue_1886_point_coordinates_not_duplicated.js +++ b/tests/cypress/integration/issues_prs/issue_1886_point_coordinates_not_duplicated.js @@ -6,7 +6,7 @@ import { taskName, advancedConfigurationParams, labelName } from '../../support/const'; -context('Point coordinates are not duplicated while polygon\'s interpolation.', () => { +context("Point coordinates are not duplicated while polygon's interpolation.", () => { const issueId = '1886'; const pointsCoordinates = []; const createPolygonTrack = { diff --git a/tests/cypress/support/const.js b/tests/cypress/support/const.js index 7661f954..dc2c1770 100644 --- a/tests/cypress/support/const.js +++ b/tests/cypress/support/const.js @@ -44,7 +44,7 @@ it('Prepare to testing', () => { listItems.push(collection[i].innerText); } if (listItems.indexOf(taskName) === -1) { - cy.task('log', 'A task doesn\'t exist. Creating.'); + cy.task('log', "A task doesn't exist. Creating."); cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); cy.createZipArchive(directoryToArchive, archivePath); cy.createAnnotationTask(