netsells / code-standards Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://netsells.github.io/code-standards/
Home Page: https://netsells.github.io/code-standards/
{!! Form::open() !!}
<input>
{!! Form::close() !!}
vs
{!! Form::open() !!}
<input>
{!! Form::close() !!}
There are multiple ways of defining a route, we need to decide on a convention.
Originally posted by jackcolley December 15, 2021
Similar to the section on recommended packages. Should we also add a section for recommended services.
E.G RevenueCat for IAP, Stripe for real world payments,
{{$foo}} vs {{ $foo }}
Continuous
<div
id="my-div"
class="my-class"
v-else
>
...children
</div>
vs
<div
id="my-div"
class="my-class"
v-else
>
...children
</div>
vs
<div
id="my-div"
class="my-class"
v-else>
...children
</div>
vs
<div
id="my-div"
class="my-class"
v-else>
...children
</div>
Laravel gives us many ways to pass data to views. Which do we prefer?
$user = User::first();
$groups = Groups::all();
$permissions = Permissions::all();
return view('groups', compact('user', 'groups', 'permissions'));
return view('groups')
->with([
'user' => User::first(),
'groups' => Groups::all(),
'permissions' => Permission::all(),
]);
return view('groups')
->with('user', User::first())
->with('groups', Groups::all())
->with('permissions', Permission::all());
Manually creating validator with Validator::make()
Using the ValidatesRequests
trait and validating within Controller.
Creating FormRequest
classes to store validation logic before it hits the Controller.
Add a page with our preferred tech stack. Will make it easier for potential applicants to understand the tech we use.
Worried it might turn some people away, but probably just worth noting on technical tests that we are open to other tech?
Always use @endsection
over @stop
I'd like to consistently break up Vue components so that they are more readable and each tag is easily distinguishable from the rest.
<template>
...
</template>
<script>
...
</script>
<style>
...
</style>
vs
<template>
...
</template>
<script>
...
</script>
<style>
...
</style>
We need to decide if we use brackets in control statements
if(someCondition) {
vs
if someCondition {
data
property (not for nested relations)snake_case
, as we are often exposing database attributesDataArraySerializer
These are defined by Laravel's default error formatting
@craigsansam could you please comment the work you have done in this area and I'll write up
๐ "Changed registration validation"
โค๏ธ "Changes registration validation"
๐ "Changing registration validation"
We need to agree on a format of spacing before Blade Directive parenthesis.
My usual approach is, any structural directives have no space before the parenthesis, e.g.:
@extends('frontend.layout.app')
@section('body')
But any Control Structures use a space as they would in other programming languages, e.g.:
@if ($foo === $bar)
@foreach ($items as $item)
This is a bit of an inconsistency, but it makes sense. Would like to get an agreement on either:
๐ Always space
๐ Never space
๐ Space for control structures
Preferred ordering within a Laravel model:
$table, $guarded, $fillable
snake_case
snake_case
snake_case
: e.g. /user/2/show?include_extra_info=true
slug-case
slug-case
slug-case
<img src="{{ $image->public_url }}" alt="{{ $image->name }}">
๐ Route::post()
, Route::get()
, Route::delete()
etc
๐ Route::resource()
โค๏ธ $router->post()
, $router->get()
, $router->delete()
etc
๐ $router->resource()
I prefer โค๏ธbecause it's easy to read and allows for autocompletion in IDEs
We need a spacing format for when using 'logical not operators' within Blade files.
My usual approach is !$variable
without a space. But it would be good to get an agreement on whether to include a space or not;
๐ No space !$variable
๐ With space ! $variable
๐ "YPS-6000 - Foo bar commit"
๐ "Foo bar commit"
With the IoC container, we're not restricted to the order in which we define parameters for controller functions - meaning we can have a function like this
public function update($id, UpdateUserRequest $request, Vehicle $vehicle) { ... }
I feel we should have a defined order for URL Parameters, the request class and resolved IoC classes...
So please comment (or vote on if it's already been posted) your desired order :)
๐$router->get('some-url', 'SomeController@someFunction')->name('some-name');
๐
$router->get('airport/{airportSlug}', [
'as' => 'airport.show',
'uses' => 'AirportController@show',
]);
https://eslint.org/docs/rules/arrow-parens
Enforce parenthesis around arguments in arrow functions
๐ - Yay
๐ - Nay
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.