Comments (4)
Hi again @oyeanuj. Hope you're doing great. Thanks a lot for your interest on Righteous. Righteous is designed to handle my custom coding style. This is just a random example. You can read a bit about this coding style here
Before you run it on any serious code please be warned that righteous is designed for my own specific projects and DEFINITELY EXPERIMENTAL AND NOT READY FOR ANY KIND OF REAL WORLD PROJECTS.
TypeScript / JavaScript it will look like this:
But formatters scan the code and then rewrite it with from the AST level so in TypeScript / JavaScript only whitespace and indentations are being formatted. In CSS almost everything get's formatted, the lines are sorted and formatted in table views, extra lines are removed and similar stuff.
from righteous.
@pmkary Thank you for the detailed response, it definitely looks clean and readable! Since it isn't ready for real-world use yet, I will try to use it some test project. Looking forward to it being ready for real world use :)
PS. How much flexibility do you foresee providing? Would it be like Eslint/Prettier that there would be some opt-in/opt-out rules for formatting?
from righteous.
You're welcome! Righteous is not a good thing to be used for any projects. It is stable on TypeScript / JavaScript because it uses TypeScript's internal formatting engine so it is stable. The only place it breaks apart is identifying my comments.
Also when it comes to CSS the whole thing happens by rewriting the code from the tree. The problem is I develop them as I progress in my other projects so there are so many CSS stuff that I haven't used and so I haven't wrote the formatter for them (just recently I found it cann't format @font-face
). This problem happens as formatter replaces the unsupported part by writing empty strings (which is a bug by the way) and that's why it's not suitable for any kind of programming. For me it's no problem because just as I find a problem I fix it in the main branch and then I resume my job, but if you want to format your code with Righteous I think you should take that into consideration and apply the same approach.
To your question. In typescript spaces are formatted but the rest of the stuff are still optional by many means. In CSS however almost everything is formatted expect for the property values. Because in CSS there are no grammars for them and I have to develop another parser for them which is really time consuming so I have left them manul
from righteous.
Got it, that makes sense! Thanks for the context!
from righteous.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from righteous.