Skip to content

Latest commit

 

History

History
65 lines (41 loc) · 2.29 KB

CONTRIBUTING.md

File metadata and controls

65 lines (41 loc) · 2.29 KB

Contributing

Getting Started

  1. Navigate to the root of your local clone of aws-amplify/amplify-ui
  2. Run yarn setup
  3. Run yarn react dev

This will start building @aws-amplify/ui-react in watch mode. To test your changes, you can utilize examples/next to run examples on next.js. Please see examples README and e2e README to get started.

Dependencies

@aws-amplify/ui-react depends on @aws-amplify/ui for theming, state management, and translation logic. If you're looking for change in these, please refer to @aws-amplify/ui README.

Code Standards

Imports

Separate all imports into organized, alphabetical blocks of third_party → internal → local for easier reading.

import { isEmpty } from 'lodash/isEmpty';
import * as React from 'react';

import { Auth } from 'aws-amplify';

import { Button } from './primitives/Button';
import { THIS_ENUM } from './utils/types';

Do NOT use implicit paths like below. This can lead to circular dependencies unintentionally which is bad for tree shaking.

import { Flex, Heading } from '../../..';

Use explicit import paths instead, the more specific the better.

import { Flex } from '../../../primitives/Flex';
import { Heading } from '../../../primitives/Heading';

Variable Naming

  1. Component names should be capitalized.
  2. Boolean props should be prefixed with is and default to false.

Others

Do NOT introduce any side effects unless you have to with rational reasons. A "side effect" is defined as code that performs a special behavior when imported, other than exposing one or more exports. An example of this are polyfills, which affect the global scope and usually do not provide an export. For example:

import './polyfill';

Any imported file is subject to tree shaking, that means CSS file needs to be added to the side effect list so it will not be unintentionally dropped:

import './style.css';

Testing for Production

After you tested your change, you can run yarn react build from monorepo to run build for production.