Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDSC-3846: Updates eslint config #76

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
82 changes: 1 addition & 81 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,6 @@
"jest": true,
"cypress/globals": true
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"requireConfigFile": false
}
},
"plugins": [
"react",
"cypress"
],
"ignorePatterns": ["dist"],
"rules": {
// Setting a max line-length
"max-len": [1, 100, 2, {
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}],

// Disallow all semicolons on line endings
"semi": ["error", "never"],

// Allow both .js and .jsx extensions
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],

// Allow shadow declarations
"no-shadow": "off",

// Disallow dangling commas
"comma-dangle": ["error", "never"],

// Require spacing in object literals
"object-curly-spacing": ["error", "always"],

// Allow class methods that dont use 'this'
"class-methods-use-this": "off",

// Allow console log messages
"no-console": "off",

// Allow extranious dependencies
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],

// Allow named default exports
"import/no-named-as-default": "off",

// Allow files with no default export
"import/prefer-default-export": "off",

// Disable the depricated label-has-for rule
"jsx-a11y/label-has-for": "off",

// Use the correct version of this rule, rather than label-has-for
"jsx-a11y/label-has-associated-control": [
2,
{
"labelComponents": [
"label"
],
"labelAttributes": [
"htmlFor"
],
"controlComponents": [
"input"
]
}
],

// Allowing cyclic dependancies
"import/no-cycle": "off",

"react/jsx-props-no-spreading": ["error", {
"custom": "ignore"
}],

"react/function-component-definition": "off"
},

"overrides": [
{
Expand All @@ -98,9 +20,7 @@

// Use AirBnb settings as a base
"extends": [
"airbnb",
"plugin:react/recommended",
"plugin:cypress/recommended"
"@edsc"
],

// Define version settings
Expand Down
22 changes: 18 additions & 4 deletions cypress/e2e/callbacks.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@ describe('Callbacks', () => {
it('calls onTemporalSet', () => {
// Create a temporal range
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

cy.window().then((win) => {
Expand All @@ -67,8 +75,14 @@ describe('Callbacks', () => {
it('calls onDragPan', () => {
// Drag the timeline
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 500 })
.trigger('pointermove', { pointerId: 1, clientX: 550 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 500
})
.trigger('pointermove', {
pointerId: 1,
clientX: 550
})
.trigger('pointerup', { pointerId: 1 })

cy.window().then((win) => {
Expand Down
149 changes: 124 additions & 25 deletions cypress/e2e/temporal_dragging.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ describe('Temporal dragging', () => {
describe('when hovering outside the temporal range area', () => {
it('does not display the indicator', () => {
getByTestId('timeline')
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 250 })
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 250
})

getByTestId('temporalRangeMouseoverMarker').should('not.exist')
})
Expand All @@ -25,7 +29,11 @@ describe('Temporal dragging', () => {
describe('when hovering inside the temporal range area', () => {
it('display the indicator', () => {
getByTestId('timeline')
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 100 })
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 100
})

getByTestId('temporalRangeMouseoverMarker').should('exist')
})
Expand All @@ -34,8 +42,16 @@ describe('Temporal dragging', () => {
describe('when hovering inside and then outside the temporal range area', () => {
it('remove the indicator', () => {
getByTestId('timeline')
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 100 })
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 500 })
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 100
})
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 500
})

getByTestId('temporalRangeMouseoverMarker').should('not.exist')
})
Expand All @@ -44,10 +60,22 @@ describe('Temporal dragging', () => {
describe('when dragging backwards', () => {
it('the temporal range is updated', () => {
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })
.trigger('pointermove', { pointerId: 1, clientX: 755, clientY: 10 })
.trigger('pointermove', {
pointerId: 1,
clientX: 755,
clientY: 10
})

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[650]}`)
getByTestId('temporalEnd').should('have.text', `Temporal End: ${timeAtPx[750]}`)
Expand All @@ -56,8 +84,16 @@ describe('Temporal dragging', () => {
it('when mousing out of a temporal marker does not hover the marker ', () => {
// Set the temporal range
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 100 })
.trigger('pointermove', { pointerId: 1, clientX: 750, clientY: 100 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 100
})
.trigger('pointermove', {
pointerId: 1,
clientX: 750,
clientY: 100
})
.trigger('pointerup', { pointerId: 1 })

// Hover over and out of the start marker
Expand All @@ -73,8 +109,16 @@ describe('Temporal dragging', () => {
describe('when dragging forwards', () => {
it('the temporal range is updated', () => {
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 550, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 550,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[550]}`)
Expand All @@ -92,7 +136,11 @@ describe('Temporal dragging', () => {

it('clicking on the top of the timeline removes the temporal range', () => {
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', 'Temporal Start: null')
Expand All @@ -101,7 +149,10 @@ describe('Temporal dragging', () => {

it('clicking on the middle of the timeline does not removes the temporal range', () => {
getByTestId('timelineList')
.trigger('pointerdown', { pointerId: 1, clientX: 650 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[650]}`)
Expand All @@ -119,8 +170,16 @@ describe('Temporal dragging', () => {
it('dragging the start marker changes the temporal range', () => {
// Grab the start marker, move it to the left
getByTestId('startMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 550, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 550,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[550]}`)
Expand All @@ -130,8 +189,16 @@ describe('Temporal dragging', () => {
it('dragging the start marker past the end marker changes the temporal range', () => {
// Grab the start marker, move it to the right past the end marker
getByTestId('startMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 850, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 850,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[750]}`)
Expand All @@ -141,8 +208,16 @@ describe('Temporal dragging', () => {
it('dragging the end marker changes the temporal range', () => {
// Grab the end marker, move it to the right
getByTestId('endMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 750, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 850, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 750,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 850,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[650]}`)
Expand All @@ -152,8 +227,16 @@ describe('Temporal dragging', () => {
it('dragging the end marker past the start marker changes the temporal range', () => {
// Grab the end marker, move it to the left past the start marker
getByTestId('endMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 750, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 550, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 750,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 550,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[550]}`)
Expand All @@ -169,8 +252,16 @@ describe('Temporal dragging', () => {

// Grab the start marker, move it to the left
getByTestId('startMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 650, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 550, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 650,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 550,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalStart').should('have.text', `Temporal Start: ${timeAtPx[550]}`)
Expand All @@ -183,8 +274,16 @@ describe('Temporal dragging', () => {

// Grab the end marker, move it to the right
getByTestId('endMarker')
.trigger('pointerdown', { pointerId: 1, clientX: 750, clientY: 10 })
.trigger('pointermove', { pointerId: 1, clientX: 850, clientY: 10 })
.trigger('pointerdown', {
pointerId: 1,
clientX: 750,
clientY: 10
})
.trigger('pointermove', {
pointerId: 1,
clientX: 850,
clientY: 10
})
.trigger('pointerup', { pointerId: 1 })

getByTestId('temporalEnd').should('have.text', `Temporal End: ${timeAtPx[850]}`)
Expand Down
Loading