Skip to content

Commit

Permalink
Fix more ESLint errors (#5619)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecLad authored Jan 24, 2023
1 parent 54e3198 commit 41c6728
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }],
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/tests/api/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions cvat-core/tests/api/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
Expand All @@ -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',
Expand Down
18 changes: 8 additions & 10 deletions cvat-ui/src/components/move-task-modal/label-mapper-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -67,11 +66,10 @@ export default function LabelMapperItem(props: LabelMapperItemProps): JSX.Elemen
<Checkbox
disabled
checked={value.clearAttributes}
onChange={(_value) =>
onChange({
...value,
clearAttributes: _value.target.checked,
})}
onChange={(_value) => onChange({
...value,
clearAttributes: _value.target.checked,
})}
>
Clear attributes
</Checkbox>
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/project-page/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function DetailsComponent(props: DetailsComponentProps): JSX.Elem
const [projectName, setProjectName] = useState(project.name);

return (
<div cvat-project-id={project.id} className='cvat-project-details'>
<div data-cvat-project-id={project.id} className='cvat-project-details'>
<Row>
<Col>
<Title
Expand Down
4 changes: 2 additions & 2 deletions cvat-ui/src/utils/opencv-wrapper/histogram-equalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ export default class HistogramEqualizationImplementation implements HistogramEqu
}
}

private hashedFrame(frameNumber: number): ImageData|null {
private hashedFrame(frameNumber: number): ImageData | null {
const hashed = this.histHash.find((_hashed) => _hashed.frameNumber === frameNumber);
if (hashed) {
hashed.timestamp = Date.now();
}
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/support/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 41c6728

Please sign in to comment.