-
Notifications
You must be signed in to change notification settings - Fork 22
[WIP] Added max-lines-per-function linting rule to project #601
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
.eslintrc.json
Outdated
}, | ||
"overrides": [ | ||
{ | ||
"files": ["src/components/**", "src/containers/**"], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
3599ead
to
1d7ef56
Compare
remove conflicting .eslintrc file
FYI i will be taking over this task! |
Description:
Linting:
Component Updates:
Tests:
e2e
)Documentation: