-
Notifications
You must be signed in to change notification settings - Fork 74
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
Fix: enforce style rules #99
base: master
Are you sure you want to change the base?
Changes from all commits
9a8358e
8e4da24
edcc4df
3374cde
8b3d4e5
62c994d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
end_of_line = lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use eslint + airbnb style for all JS packages. Shall we just move to eslint + prettier? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prettier is definitely the standard for JS. ESLint is more for TypeScript and ECMAScript and other JS derivatives. JSHint is for JS. ESLint can operate on JS, but it has a boatload of dependencies, very complex configuration, etc. I personally won't run That said, ESLint is better than nothing, but it's nowhere near as good as JSHint for JavaScript. JSHint is a single dependency, no plugins, no formatting, no rewrites, no style, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the most important here is a consistency. All JS repos in this org should follow the same code style. Then we should go with the same configuration for eslint what we in https://github.com/dashpay/platform/ and prettier should follow eslint config https://github.com/prettier/eslint-config-prettier There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why move from something that has just 2 dependencies to something that has hundreds of dependencies? There are just too many things that go wrong. Too many versions to track. Slower CI/CD times. If someone else wants to bring in the complexity and then make all the corresponding updates, then let them do that in another PR to transition the repository. But for now, let's just fix what's here. I don't use eslint because I value both security and ease of use. |
||
"esversion": 11, | ||
"bitwise": false, | ||
"browser": true, | ||
"camelcase": false, | ||
"curly": true, | ||
"devel": false, | ||
"eqeqeq": true, | ||
"esnext": true, | ||
"freeze": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": true, | ||
"latedef": "nofunc", | ||
"laxbreak": true, | ||
"newcap": false, | ||
"noarg": true, | ||
"node": true, | ||
"noempty": true, | ||
"nonew": true, | ||
"quotmark": "single", | ||
"regexp": true, | ||
"smarttabs": false, | ||
"strict": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
"maxparams": 5, | ||
"maxstatements": 17, | ||
"maxcomplexity": 10, | ||
"maxdepth": 3, | ||
"maxlen": 120, | ||
"multistr": true, | ||
"predef": [ | ||
"after", | ||
"afterEach", | ||
"before", | ||
"beforeEach", | ||
"describe", | ||
"exports", | ||
"it", | ||
"module", | ||
"require" | ||
"after", | ||
"afterEach", | ||
"before", | ||
"beforeEach", | ||
"describe", | ||
"exports", | ||
"it", | ||
"module", | ||
"require" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"printWidth": 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.
We probably shouldn't format here but make sure that formatting already is correct.
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 will cause it to fail if it's not correct. This enforces that the style is followed.
If you don't run this, you can't enforce that it was done before (unless you do something else that's effectively the same).
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.
So it doesn't format itself but only checking that the format is correct?
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.
That's correct. It will
exit 1
if there are any changes andexit 0
if there are no changes.