All Projects β†’ formium β†’ Typescript

formium / Typescript

Licence: mit
TypeScript coding guidelines & configs for Formik

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Labels

Projects that are alternatives of or similar to Typescript

Tslint No Circular Imports
TSLint plugin to detect and warn about circular imports
Stars: ✭ 89 (-58.6%)
Mutual labels:  tslint
Express Webpack React Redux Typescript Boilerplate
πŸŽ‰ A full-stack boilerplate that using express with webpack, react and typescirpt!
Stars: ✭ 156 (-27.44%)
Mutual labels:  tslint
Sonartsplugin
SonarQube plugin for TypeScript files
Stars: ✭ 182 (-15.35%)
Mutual labels:  tslint
Typescript Node Starter
A reference example for TypeScript and Node with a detailed README describing how to use the two together.
Stars: ✭ 10,111 (+4602.79%)
Mutual labels:  tslint
Workflow
δΈ€δΈͺε·₯作桁平台
Stars: ✭ 1,888 (+778.14%)
Mutual labels:  tslint
Express Graphql Typescript Boilerplate
A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch
Stars: ✭ 163 (-24.19%)
Mutual labels:  tslint
Tslint Xo
TSLint shareable config for XO
Stars: ✭ 64 (-70.23%)
Mutual labels:  tslint
Tslint Consistent Codestyle
Collection of awesome rules to extend TSLint
Stars: ✭ 203 (-5.58%)
Mutual labels:  tslint
React Native Typescript Boilerplate
React Native Typescript starter kit / template (Redux Thunk + React Native Navigation v7 + TSLint)
Stars: ✭ 155 (-27.91%)
Mutual labels:  tslint
Typescript Webpack React Redux Boilerplate
React and Redux with TypeScript
Stars: ✭ 182 (-15.35%)
Mutual labels:  tslint
Typescript Eslint
✨ Monorepo for all the tooling which enables ESLint to support TypeScript
Stars: ✭ 10,831 (+4937.67%)
Mutual labels:  tslint
Electron React Typescript Webpack Boilerplate
Pre-configured boilerplate for Electron + React + TypeScript + Webpack
Stars: ✭ 146 (-32.09%)
Mutual labels:  tslint
Angular Tslint Rules
Shared TSLint & codelyzer rules to enforce a consistent code style for Angular development
Stars: ✭ 181 (-15.81%)
Mutual labels:  tslint
Typescript Restful Starter
Node.js + ExpressJS + Joi + Typeorm + Typescript + JWT + ES2015 + Clustering + Tslint + Mocha + Chai
Stars: ✭ 97 (-54.88%)
Mutual labels:  tslint
Tslint Language Service
TypeScript 2.2.1 plugin for tslint
Stars: ✭ 190 (-11.63%)
Mutual labels:  tslint
Tslint Config Security
TSLint security rules
Stars: ✭ 71 (-66.98%)
Mutual labels:  tslint
Tslint Angular
Recommended tslint configuration for Angular applications.
Stars: ✭ 159 (-26.05%)
Mutual labels:  tslint
Codestyle
JavaScript and TypeScript Style Guide
Stars: ✭ 207 (-3.72%)
Mutual labels:  tslint
Angular2 Express Mongoose Gulp Node Typescript
AngularJS 2 (Updated to 4.2.0) Mean Stack application which uses Angular2, Gulp, Express, Node, MongoDB (Mongoose) with Repository Pattern Business Layer
Stars: ✭ 201 (-6.51%)
Mutual labels:  tslint
Typestrict
ESLint config focused on maximizing type safety πŸ’ͺ
Stars: ✭ 182 (-15.35%)
Mutual labels:  tslint

TypeScript

These guidelines are adapted from the TypeScript core's contributor coding guidelines.

Table of Contents

Names

  1. Use PascalCase for type names.
  2. Do not use "I" as a prefix for interface names.
  3. Use PascalCase for enum values.
  4. Use camelCase for function names.
  5. Use camelCase for property names and local variables.
  6. Do not use "_" as a prefix for private properties.
  7. Use whole words in names when possible.
  8. Use isXXXing or hasXXXXed for variables representing states of things (e.g. isLoading, hasCompletedOnboarding).
  9. Give folders/files/components/functions unique names.

Exports

  1. Only use named exports. The only exceptions are a tool requires default exports (e.g React.lazy(), Gatsby and Next.js pages, typography.js)

Components

  1. 1 file per logical component (e.g. parser, scanner, emitter, checker).
  2. If not kept in a separate folder, files with ".generated.*" suffix are auto-generated, do not hand-edit them.
  3. Tests should be kept in the same directory with ".test.*" suffix
  4. Filename should match the component name. Interfaces for React components should be called <ComponentName>Props and <ComponentName>State. The only exception is when writing a render prop. In this situation, you, the author, should call the interface for your component's props <ComponentName>Config and then the render prop interface <ComponentName>Props so it is easy for everyone else to use.

Types

  1. Do not export types/functions unless you need to share it across multiple components.
  2. Do not introduce new types/values to the global namespace.
  3. Shared types should be defined in 'types.ts'.
  4. Within a file, type definitions should come first (after the imports).

null and undefined

  1. Use undefined. Do not use null. EVER. If null is used (like in legacy Redux code), it should be kept isolated from other code with selectors.

General Assumptions

  1. Consider objects like Nodes, Symbols, etc. as immutable outside the component that created them. Do not change them.
  2. Consider arrays as immutable by default after creation.

Flags

  1. More than 2 related Boolean properties on a type should be turned into a flag.

Comments

  1. Use JSDoc style comments for functions, interfaces, enums, and classes.
  2. Document crazy stuff. Always add @see <url> and the current date when referencing external resources, blog posts, tweets, snippets, gists, issues etc.
  3. Make note conditions upon which hacks and smelly code can be removed.

Strings

  1. Use single quotes for strings. Double quotes around JSX string props.
  2. All strings visible to the user need to be localized (make an entry in diagnosticMessages.json).

When to use any

  1. If something takes you longer than 10 minutes to type or you feel the need to read through TS Advanced Types docs, you should take a step back and ask for help, or use any.
  2. Custom typings of 3rd-party modules should be added to a .d.ts file in a typings directory. Document the date and version of the module you are typing at the top of the file.
  3. Consider rewriting tiny modules in typescript if types are too hard to think through.

Diagnostic Messages

  1. Use a period at the end of a sentence.
  2. Use indefinite articles for indefinite entities.
  3. Definite entities should be named (this is for a variable name, type name, etc..).
  4. When stating a rule, the subject should be in the singular (e.g. "An external module cannot..." instead of "External modules cannot...").
  5. Use present tense.
  6. Use active voice.

General Constructs

For a variety of reasons, we avoid certain constructs, and use some of our own. Among them:

  1. Do not use for..in statements; instead, use ts.forEach, ts.forEachKey and ts.forEachValue. Be aware of their slightly different semantics.
  2. Try to use ts.forEach, ts.map, and ts.filter instead of loops when it is not strongly inconvenient.

Style

  1. Use prettier and tslint/eslint.
  2. Use arrow functions over anonymous function expressions.
  3. Only surround arrow function parameters when necessary.
    For example, (x) => x + x is wrong but the following are correct:
    1. x => x + x
    2. (x,y) => x + y
    3. <T>(x: T, y: T) => x === y
  4. Always surround loop and conditional bodies with curly braces. Statements on the same line are allowed to omit braces.
  5. Open curly braces always go on the same line as whatever necessitates them.
  6. Parenthesized constructs should have no surrounding whitespace.
    A single space follows commas, colons, and semicolons in those constructs. For example:
    1. for (var i = 0, n = str.length; i < 10; i++) { }
    2. if (x < 10) { }
    3. function f(x: number, y: string): void { }
  7. Use a single declaration per variable statement
    (i.e. use var x = 1; var y = 2; over var x = 1, y = 2;).
  8. Use 2 spaces per indentation.

MIT LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].