Skip to content

Conversation

rostyk-kanafotskyy
Copy link
Contributor

@rostyk-kanafotskyy rostyk-kanafotskyy commented Feb 24, 2020

Description:

Linting:

  • No linting errors

Component Updates:

Tests:

  • E2E tests (npm test run with e2e)
  • Manual tests

Documentation:

  • Requires documentation updates

@rostyk-kanafotskyy rostyk-kanafotskyy self-assigned this Feb 24, 2020
@rostyk-kanafotskyy rostyk-kanafotskyy changed the title Added max-lines-per-function linting rule to project [WIP] Added max-lines-per-function linting rule to project Feb 24, 2020
@rostyk-kanafotskyy rostyk-kanafotskyy requested review from shaunmaharaj and aChanEP and removed request for aChanEP and shaunmaharaj February 24, 2020 09:57
Copy link
Contributor

@aChanEP aChanEP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works! Just need to fix up the ep.config.json. And just opened up a discussion about how we want to organize things going forward. I'm good with merging this though! still lots of improvement with seperating concerns, self contained logic and ultimately readability! :D.

EDIT: Might want to look into linting the components directory before merging! for example there are functions in productdisplayitem.main.tsx that far exceed 120 but are not being linted.


import * as Config from '../ep.config.json';

function getErrorMessages(data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! more functions pls!

.eslintrc.json Outdated
{
"files": ["src/components/**", "src/containers/**"],
"rules": {
"max-lines-per-function": ["error", 120]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use the recommended 50 lines max per function. But omit any functions having to do with rendering. Thoughts? @shaunmaharaj @rostyk-kanafotskyy

Use this exemption here.
// eslint-disable-next-line max-lines-per-function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aChanEP That's a good point, but I believe we have functions with more than 50 lines too and it could be a pain to refactor them all due to the multiple conditions we support.

I'm good with 120 as max lines for now, and we can clean up more once the time comes to integrate Cortex JS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me! could be wasted work once the CortexJs comes in.

@aChanEP aChanEP self-requested a review March 4, 2020 19:42
.eslintrc.json Outdated
},
"overrides": [
{
"files": ["src/components/**", "src/containers/**"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this line is working for components as there are functions in there that are larger than 120 lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, fixing it 🙂
Thank you @aChanEP

@rostyk-kanafotskyy rostyk-kanafotskyy force-pushed the RS-667-add-linting-rule branch from 3599ead to 1d7ef56 Compare March 5, 2020 09:01
remove conflicting .eslintrc file
@aChanEP
Copy link
Contributor

aChanEP commented Mar 13, 2020

FYI i will be taking over this task!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants