-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Integrate eslint & precommit to codebase #815
Conversation
Deploy preview for docusaurus-preview ready! Built with commit 417efda |
6906482
to
1f7df7f
Compare
60dcad8
to
249fc7d
Compare
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.
Looks great! What are the next steps you're planning for the ESLint integration? Are we enabling more rules?
.eslintrc.json
Outdated
@@ -0,0 +1,16 @@ | |||
{ |
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.
Let's use .js
extension. It's much more flexible than JSON and we can add comments.
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.
ok
"eslint": "^5.0.1", | ||
"eslint-config-fbjs": "^2.0.1", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-babel": "^5.1.0", |
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.
Are we using them yet? I don't see them in eslintrc
. Maybe we should add them later if we're not using yet.
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.
eslint-config-fbjs requires it as peer dependencies
https://github.com/facebook/fbjs/blob/d308fa83c99c93e8e588de3396cf55b31e56b14e/packages/eslint-config-fbjs/package.json#L21-L28
I've only added eslint-config-prettier
so far to remove eslint-prettier conflict.
Edit: So for now we're effectively using eslint-config-fbjs & eslint-config-prettier
.eslintrc.json
Outdated
} | ||
} | ||
] | ||
} |
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.
Add newline.
.eslintrc.json
Outdated
@@ -0,0 +1,16 @@ | |||
{ | |||
"extends": ["fbjs", "prettier"], |
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.
Are we adding more of them later?
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 not so soon. fbjs config is quite ok for now. We can always overrides their rules later on
@@ -56,9 +56,9 @@ beforeAll(() => { | |||
}); | |||
}); | |||
|
|||
function afterAll() { | |||
afterAll(() => { |
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.
This changes the meaning - It was declaring a function before, now it's executing it. The after version looks more correct though.
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.
yup. it's actually caught by the linter. Otherwise the function is never used
Feel free to merge this when you feel it's ready. We could add more rules later on/fix more issues. |
I'm going to add some more specific rules for libs that can cause bugs. Lot of linting errors are turned off at fbjs. |
Hmm in that case I wonder if fbjs is the right one to use. Let's get @JoelMarcey's opinion on this when he's available. But in the meanwhile we can merge this. |
I'm changing it to |
I approve of the |
Motivation
P.S Our ESLint config is based on Facebook ESLint configuration (https://github.com/facebook/fbjs/tree/master/packages/eslint-config-fbjs)
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
ESLint
Precommit hook