Introduce beautify-lint and reformat files automatically#102
Conversation
|
Mind fixing conflicts first? |
82d7586 to
0adcddf
Compare
|
@ev1stensberg lol you're too fast :) |
|
Unfortunately, I've encountered some inconsistencies between beautify-rewrite and eslint config. Even after I've updated eslint config to the webpack's one to reduce code style inconsistencies I still see some cases where Try running cc @sokra |
|
What is needed to fix the issue @okonet ? |
|
@ev1stensberg I guess the issue is with how beautify formats the code in some cases since I'm using same ESLint and jsbeautify configs as in webpack's repo. |
|
If the eslint and beautify code is the same, shouldn't it be no problem at all? @okonet |
|
Status on this? |
|
This would really help us to rebase with the main |
|
I'm not sure how I can help. I'd propose we switch both repos to prettier since it shouldn't have those issues AFAIK. |
992b251 to
87a5c49
Compare
| "eslint-plugin-node": "^5.1.0", | ||
| "eslint-plugin-prettier": "^2.1.2", | ||
| "jest": "^20.0.4", | ||
| "jest-cli": "^20.0.4", |
There was a problem hiding this comment.
I don't think this is needed if you already have jest as a dependency.
There was a problem hiding this comment.
Actually I added it because I ran the tests with npm test and node complained that jest-cli is not in the project
| "node/process-exit-as-throw": "error", | ||
| "prettier/prettier": ["error", { | ||
| "useTabs": true, | ||
| "bracketSpacing": false |
There was a problem hiding this comment.
Any reason for not including it? I believe it's much more readable with spaces.
There was a problem hiding this comment.
let me double check, I was getting crazy errors of compatibility between eslint and prettify, did some tests, this might have squeezed in.
|
Looking at all conflicts I think it would be easier to start over... |
|
+1 @okonet |
|
Totally! Will create a new branch and cherry-pick the changes. Afterwards will add a single commit with the style fixes. Will close this PR and open a new one |
|
I've been playing around and trying to get the automated code beatutifying work with prettier but has been quite complicated. Issues I've got:
At the moment, my conclusion is:
What you guys think? |
|
@DanielaValero I'm running prettier with eslint on all my code and never run into issue. I assume you're running into conflicting rules that needs to be disabled. See https://github.com/okonet/eslint-config-okonet/blob/master/index.js for my setup. The important thing is https://github.com/prettier/eslint-config-prettier that disables all styling rules of ESLint. |
What kind of change does this PR introduce?
refactoring + build related change
Did you add tests for your changes?
N/A
If relevant, did you update the documentation?
N/A
Summary
To ensure code style is consistent with the main webpack repo, I've added the
pretestcommand that will lint it on CI. Also I've added an additional step to lint-staged that will automatically reformat code according to code style rules in a pre-commit hook.Does this PR introduce a breaking change?
No