The Australian Government coat of Arms

Communities of practice

Communities of practice

Coding style standards

Do you have, or are there plans to have, a set of coding style rules that are applied throughout the Design System code?

Have you considered using the airbnb styles?

Good question @rooby!

I don’t have a good answer for you unfortunately. I’m mostly replying just to let you know we haven’t forgotten about you! I’ll make sure that sees your message when he’s back from his holiday and replies.

What do you see as the benefit of having a set of style rules?

Consistency in code makes developers’ lives much easier. It helps with readability and comprehension of code and can make for more efficient debugging and refactoring.
It is especially important when using automated code linting and formatting tools.

The more people that work on the same code base the more impact these things have over all, so this is especially important for open source, because you have so many different people writing code.
It also benefits you as the maintainers, because if you have a set of rules then people know what they have to do to get a PR in and you don’t have to tweak code style to your liking when merging PRs.

In terms of using something pre-existing or making your own, I think that it matters less what your coding standards are than that you have them at all. Having said that, I think it makes sense to base it on something that is already widely used, so that there is lower bar to entry for the most possible people, which was why I used airbnb as an example.

1 Like

I think the DTA could play an important role in getting this kind of consistency into Government in a broader sense.

For example you could have ESLint configurations that you recommend departments use for different kinds of projects.

1 Like

I have some that I use personally, I don’t know how easy it would be to enforce linting across multiple projects. I find that I use a default lint then have to add some differences for packages using babel, ones using vanilla js and others using react.

I see massive benefits in this and would love to continue the discussion. You can view my personal one here:

It is trying to be as human readable as possible with an emphasis on whitespace. It also uses airbnb as a base.


Isn’t the whole purpose of linting to be able to easily keep consistency across multiple projects (and within a single project)?

Although if you were referring to my previous comment about a standard for government, you probably can’t enforce it, just recommend it. Some people will use it and some people won’t.

You can start small, it could just be for for the design system components repo for now. Even if it was just lint rules to match the code style that is currently being used.
A bonus would be if the design system repo used the same rules :slight_smile:

I completely agree!

I meant that it would be hard to have a linter that would work perfectly for angular, react, sass, less, nodejs, webpack bundled, version of node etc. There are lots of linting rules that can changed based on those variables.

I think it would be beneficial to have a javascript linter for the design system components repo for javascript and sass. This would also work by default on design system repo aswell. It would be few days of work to set it up properly and right tests. I’ll add a backlog item and see what I can do.


Here is a ticket:

1 Like

Definitely. I guess if you do one that suits your environment then people can either use that, if theirs matches, or use yours as a guide to making their own that suits their project.
People look to the DTA for direction, so I think it will help that they can see how you do it to help them do it themselves.

1 Like