LogoLogo
  • Technical Direction
  • Technical overview
    • Technical Implementation
    • API Design Guide
      • Data Definitions and Standards
      • Data Transfer Objects
      • Documentation
      • Environments
      • Error Handling
      • Example API Service
      • GraphQL Naming Conventions
      • Methods
      • Naming Conventions
      • Once Only Principle
      • Pagination
      • Resource Oriented Design
      • REST Request
      • REST Response
      • Security
      • Versioning
    • Ísland.is Public Web Data Flow
    • Code Reviews
    • Code Standards
    • Monorepo
    • Project Management
    • Teamwork
    • Architectural Decision Records
      • Use Markdown Architectural Decision Records
      • Use NX
      • Continuous Integration
      • CSS
      • Branching and Release Strategy
      • Error Tracking and Monitoring
      • What API Management Tool to Consider
      • Viskuausan Static Site Generator
      • Use OAuth 2.0 and OpenID Connect As Protocols for Authentication and Authorization
      • Unified Naming Strategy for Files and Directories
      • CMS
      • Open Source License
      • What Chart Library Should We Use Across Island.is?
      • What Feature Flag Service/application Should We Use at Island.is?
      • Logging, Monitoring and APM Platform
      • ADR Template
    • Log Management Policy
  • Products
    • Island.is Authentication Service
      • Terminology
      • Integration Options
      • Authentication Flows
      • Authorising API Endpoints
      • Session Lifecycle
      • Scopes and Tokens
      • Delegations
      • Configuration
      • Tools and Examples
      • Environments
      • Test IAS with Postman
      • Using the IAS admin portal
    • Notifications / Hnipp
      • New Notification Setup Guide
      • Notifications service workflow overview
      • Email notifications
    • Pósthólfið
      • Security Checklist
      • Introduction
      • Skjalatilkynning API
      • Skjalaveita API
      • Sequence Diagram
      • Interfaces
    • Straumurinn (X-Road)
      • Architecture Guidelines for Service Providers and Consumers
      • Setting up an X-Road Security Server
        • Network Configuration
      • X-Road - Uppfærsla á öryggisþjónum
      • Straumurinn - Notkun og umsýsla
      • X-Road Central - current version
  • Development
    • Getting Started
    • Generating a New Project
    • Definition of done
    • Devops
      • Continuous Delivery
      • Database
      • Dockerizing
      • Environment Setup
      • Logging
      • Metrics
      • NextJS Custom Server
      • Observability
      • Operations Base Principles
      • Security
      • Service Configuration
      • Support
    • AWS Secrets
    • Feature Flags
    • Documentation Contributions
    • Defining Monorepo Boundaries With Tags
    • OpenAPI
    • Code Generation
    • Workspace Settings (Deprecated)
    • External Contributions
  • REFERENCE
    • Problems
      • 400 Validation Failed
      • 400 Attempt Failed
      • 403 Bad Subject
      • 400 500 Template API Error
    • Glossary
  • Misc
    • Guide: Adding a Payment Step to an Application
    • Guide: Enable Organisations to Make Requests to an Application
    • README Template
Powered by GitBook
On this page
  • Usage
  • Language
  • Fail
  • Pass

Was this helpful?

  1. Technical overview

Code Standards

PreviousCode ReviewsNextMonorepo

Last updated 1 year ago

Was this helpful?

We use and to automatically enforce most of our Code Standards. Most of our rules follow recommendations from both project with these additions and changes:

  • Prettier is configured with single quotes, no semicolons, arrow parens and all trailing commas.

  • ESLint is configured to catch likely errors but otherwise provide warnings to encourage best practices without stopping the developer.The base configuration comes from .

Code standard changes can be proposed to the larger team in discipline meetings. For any new rule, we should try to enforce it automatically, even if it means creating a new ESLint rule from scratch.

Usage

We have commands available to run your code against theses code standard:

  • To your code.

  • To your code.

Language

All code, documentation and API interfaces should be written in British English. This makes the project more inclusive, and reduces awkward mixing of languages.

This can be challenging when dealing with government domain words. However, the goal is to provide all of our services in English as well as Icelandic, so we need to find good translations anyways.

When in doubt, check out the . If something is missing from it, you can ask for suggestions in the team. Just remember to add any new translations to the Glossary.

When integrating with a web service that has its interface in Icelandic, all endpoints and fields should be translated to and from English in the integration layer, so other parts of the system can use English-language objects and functions.

Fail

const kennitala = '...'

const typeDefs = gql`
  Mutation {
    applyForVegabref: VegabrefPayload!
  }
`

Pass

const nationalId = '...'

const typeDefs = gql`
  Mutation {
    applyForPassport: PassportPayload!
  }
`
Prettier
ESLint
NX
Glossary
format
lint