Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanleung committed Jan 1, 2020
0 parents commit 79c8188
Show file tree
Hide file tree
Showing 69 changed files with 19,595 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"env": {
"production": {
"plugins": ["babel-plugin-jsx-remove-data-test-id"]
},
// Jest needs @emotion/babel-preset-css-prop
// Gatsby enables css-prop with gatsby-plugin-emotion
// Storybook enables css-prop in /.storybook/webpack.config.js
"test": {
"presets": ["@emotion/babel-preset-css-prop"]
}
},
"plugins": [
[
"module-resolver",
{
"root": ["./src"],
"alias": {
"~": "./src",
"@theme/styled": "./src/styled"
}
}
]
],
"presets": [
[
"babel-preset-gatsby",
{
"targets": {
"browsers": [">0.25%", "not dead"]
}
}
]
]
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
tab_width = 2
indent_size = 2
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
6 changes: 6 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# General
GATSBY_SITE_URL = 'http://localhost:8000' # The base site URL that the application runs on, used for some compile time tasks
GATSBY_ENVIRONMENT = 'development'

# Profiling
ENABLE_BUNDLE_ANALYZER = 0
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache
public
194 changes: 194 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
const {
rules: baseImportsRules,
} = require('eslint-config-airbnb-base/rules/imports');

module.exports = {
globals: {
// Gatsby Config
__PATH_PREFIX__: true,
},
env: {
// Allow `window` global
browser: true,
},
// Global ESLint Settings
// =================================
settings: {
'import/resolver': {
node: {
paths: ['./', 'src'],
extensions: ['.js', '.jsx', '.ts', '.tsx', 'json'],
},
// Resolve Aliases
// =================================
alias: {
map: [
['~', './src'],
['@theme/styled', './src/styled'],
],
extensions: ['.js', '.jsx', '.ts', '.tsx', 'json', '.d.ts'],
},
},
},

// ===========================================
// Set up ESLint for .js / .jsx files
// ===========================================
// .js / .jsx uses babel-eslint
parser: 'babel-eslint',

// Plugins
// =================================
plugins: ['no-only-tests'],

// Extend Other Configs
// =================================
extends: [
'eslint:recommended',
'airbnb',
// Disable rules that conflict with Prettier
// !!! Prettier must be last to override other configs
'prettier/react',
'plugin:prettier/recommended',
],
rules: {
// This project uses TS. Disable prop-types check
'react/prop-types': 0,
// Allow snake_case due to inconsistent APIs
camelcase: 0,
// Prevents exclusion of tests from passing lint check
'no-only-tests/no-only-tests': 'error',
},

// https://eslint.org/docs/user-guide/configuring#report-unused-eslint-disable-comments
reportUnusedDisableDirectives: true,

// =================================
// Overrides for Specific Files
// =================================
overrides: [
// =================================
// TypeScript Files
// =================================
{
files: ['**/*.{ts,tsx}'],
// allow ESLint to understand TypeScript syntax
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js#L10
parserOptions: {
// Lint with Type Information
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},

extends: [
// ESLint's inbuilt 'recommended' config
'eslint:recommended',
// Disables rules from the 'eslint:recommended' that are already covered by TypeScript's typechecker
'plugin:@typescript-eslint/eslint-recommended',
// Turns on rules from @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended',
// Lint with Type Information
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'airbnb-typescript',
// Disable rules that conflict with Prettier
// !!! Prettier must be last to override other configs
'prettier/react',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
rules: {
// This project uses TS. Disable prop-types check
'react/prop-types': 'off',
// Allow snake_case due to inconsistent APIs
'@typescript-eslint/camelcase': 0,
// Makes no sense to allow type inferrence for expression parameters, but require typing the response
'@typescript-eslint/explicit-function-return-type': 0,
// Reduce props spreading rule to a warning, not an error
'react/jsx-props-no-spreading': 1,
'no-restricted-imports': [
'warn',
{
paths: [
{
name: '@emotion/css',
message:
'Import from "@emotion/core" instead. import { css } from "@emotion/core"',
},
],
},
],
},
},
// =================================
// index.ts Files (Re-exporting a directory's files)
// =================================
{
files: ['**/index.{js,ts,tsx}'],
rules: {
// Allow named exports in a directory's index files
'import/prefer-default-export': 0,
},
},
// =================================
// Gatsby Files
// =================================
{
files: ['**/**/gatsby-*.js'],
rules: {
'no-console': 0,
// Allow import devDependencies in Gatsby files.
'import/no-extraneous-dependencies': [
2,
{
devDependencies: true,
// Tells ESLint where the path to the folder containing package.json is for nested files like /plugin/**/gatsby-*.js
packageDir: './',
},
],
'react/no-danger': 0,
'react/jsx-props-no-spreading': 0,
// Allow 'jsx' in .js files
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'import/prefer-default-export': 0,
// Append 'ts' and 'tsx' when importing files from a folder/index.ts
'import/extensions': [
baseImportsRules['import/extensions'][0],
baseImportsRules['import/extensions'][1],
{
...baseImportsRules['import/extensions'][2],
ts: 'never',
tsx: 'never',
},
],
},
},
// =================================
// Test Files
// =================================
{
files: ['**/test-utils/*.{js,ts,tsx}', '**/**/*.test.{js,ts,tsx}'],
// Allow `jest` global
extends: ['plugin:jest/recommended'],
rules: {
// Allow import devDependencies in tests
'import/no-extraneous-dependencies': 0,
'react/jsx-props-no-spreading': 0,
'jsx-a11y/alt-text': 0,
},
},
// =================================
// Storybook Files
// =================================
{
files: ['**/*.stories.{js,ts,tsx}'],
rules: {
// Allow import devDependencies in stories
'import/no-extraneous-dependencies': 0,
'react/jsx-props-no-spreading': 0,
'jsx-a11y/alt-text': 0,
},
},
],
};
76 changes: 76 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# dotenv environment variables file
.env*
!.env.sample

# gatsby files
.cache/
public

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

# Storybook
.out

# Ensure automated processes do not mix package manager artifacts
package-lock.json
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache
public
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"singleQuote": true,
"trailingComma": "es5"
}
3 changes: 3 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-viewport/register';
import 'storybook-addon-intl/register';
Loading

0 comments on commit 79c8188

Please sign in to comment.