-
Notifications
You must be signed in to change notification settings - Fork 7
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
Prettify #216
base: master
Are you sure you want to change the base?
Prettify #216
Conversation
- Used es2016 stuff where applicable (`const`, arrow functions, etc.) - Ran it through `pretter` - IMHO, there was way too much whitespace before - 2111 lines => 1462 lines - `standard --fix` - Fixed cases where `.throws` was used with a promise - In chai, `.throws` needs to have parens - `.throws` is not to be used with a promise - `.be.rejected` was used instead - Needed `chai-as-promised` to do this - Used `()` on all chai functions (`.true`, `.false`, `.ok`, etc.) - This is cleaner because the way chai uses getters with side effects is pretty hacky - Needed `dirty-chai` to do this - Fixes the `standard` error of `Expected an assignment or function call and instead saw an expression`
Damn, this is amazing. Thank you for all the hard work here, very impressive. To be honest, I would be perfectly happy to switch this over to prettier entirely and forget standard. I typically use prettier with the Regardless, this is definitely getting merged 🙌 |
Prettier and eslint are different tools. Prettier is good for formatting your code. Eslint can do a little bit of formatting, but its value comes from pointing out errors with your code. For that reason, I think it is most valuable if both tools are used together. There are several options for integrating them. I think a good direction to take (and this applies to your other projects too) is to use I'm currently working on a cli which modifies your |
Hey sorry for the late followup here, very busy at work. So just out of curiosity, what kind of errors are caught by eslint that are not caught by prettier? It seems like, judging by the readme from the project, the eslint portion is basically just for changing some of the prettier formatting into different formatting. Prettier has pretty good options at this point. Personally, I use the single quotes and no semicolon options for all my projects locally, and it works great. If possible, I would prefer to use less tools rather than more, especially if it just means adhering to more of prettier's conventions, as this just makes the formatting more standard, familiar, and simple to deal with. If there are any specific cases that you use eslint for, I would love to hear them here though! |
I changed my mind, I think we don't need Because of prettier, the styling rules of eslint don't really matter, but the bug catching ones do.
For my personal projects, I'm using an eslint configuration based on standard with |
Ok, I can get down with that. I think the no unused vars one was probably the one I used most frequently. Are there any other rules you have come across that might help and not overlap at all with prettier in that way? All the ones above I agree with. |
You can look through here. There are quite a lot, just ignore the ones under the |
OK, I'm gonna start working on this. Do you have any ideas for a name? |
Yeah, I looked through all those ones listed and most look great, other than maybe the no console logs one. That would just be super annoying during development to always be getting linter warnings when you're working on stuff, and I prefer to have linters set up so that they are always running within your text editor. Also not a huge fan of no eval, sometimes you need it hah. Maybe we can start with just a list of the rules you want to include and we can take it from there? |
Ok, I'm gonna create a repo and upload what I have in a PR. Then you can go through and we can discuss in the reviews. |
Can you give me a use case for needing to disable |
OK, can you review this? calebeby/eslint-config-static-dev-core#1 I'm not done adding rules yet, but you can start looking them over while I continue to add more |
Sure, one example i ran into recently was this guy: https://github.com/pawelgrzybek/siema#installation There are a lot like this though, and I don't see this as an antipattern either. Create a new slider object, and if you need to access the API, save the instance to a variable, but if you don't, leave it as just the |
OK, that's fair |
const
, arrow functions, etc.)pretter
standard --fix
.throws
was used with a promise.throws
needs to have parens.throws
is not to be used with a promise.be.rejected
was used insteadchai-as-promised
to do this()
on all chai functions (.true
,.false
,.ok
, etc.)dirty-chai
to do thisstandard
error:Expected an assignment or function call and instead saw an expression