Skip to content

Commit

Permalink
[Misc] Code Cleanup (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljaltamirano authored Apr 5, 2021
1 parent 11e48c6 commit 003a1a3
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 160 deletions.
304 changes: 152 additions & 152 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,160 +1,160 @@
version: 2

aliases:
- &root ~/radiance-ui

- &defaults
working_directory: *root

- &prepare-environment
run:
name: Prepare Environment
command: mkdir test-results

- &cache-yarn-key-base yarn-packages-v2-{{ arch }}-
- &cache-yarn-key yarn-packages-v2-{{ arch }}-{{ checksum "yarn.lock" }}

- &yarn-cache-restore
restore_cache:
keys:
- *cache-yarn-key
- *cache-yarn-key-base

- &yarn-cache-save
save_cache:
key: *cache-yarn-key
paths:
- ~/.cache/yarn

- &yarn-install
run:
name: Install Node Dependencies
command: yarn install --frozen-lockfile --non-interactive

# Prospective merging against master.
- &prospective-merge
run:
name: Prospective Merge
command: |
if [[ ! -z "${CIRCLE_PULL_REQUEST}" ]]; then
git pull --ff-only origin "refs/pull/${CIRCLE_PULL_REQUEST//*pull\//}/merge"
fi
- &publish-to-chromatic
run:
name: Publish to Chromatic
command: |
if [ "${CIRCLE_BRANCH}" != "master" ]; then
yarn chromatic ${CHROMATIC_PROJECT_TOKEN}
else
yarn chromatic --auto-accept-changes ${CHROMATIC_PROJECT_TOKEN}
fi
- &root ~/radiance-ui

- &defaults
working_directory: *root

- &prepare-environment
run:
name: Prepare Environment
command: mkdir test-results

- &cache-yarn-key-base yarn-packages-v2-{{ arch }}-
- &cache-yarn-key yarn-packages-v2-{{ arch }}-{{ checksum "yarn.lock" }}

- &yarn-cache-restore
restore_cache:
keys:
- *cache-yarn-key
- *cache-yarn-key-base

- &yarn-cache-save
save_cache:
key: *cache-yarn-key
paths:
- ~/.cache/yarn

- &yarn-install
run:
name: Install Node Dependencies
command: yarn install --frozen-lockfile --non-interactive

# Prospective merging against master.
- &prospective-merge
run:
name: Prospective Merge
command: |
if [[ ! -z "${CIRCLE_PULL_REQUEST}" ]]; then
git pull --ff-only origin "refs/pull/${CIRCLE_PULL_REQUEST//*pull\//}/merge"
fi
- &publish-to-chromatic
run:
name: Publish to Chromatic
command: |
if [ "${CIRCLE_BRANCH}" != "master" ]; then
yarn chromatic ${CHROMATIC_PROJECT_TOKEN}
else
yarn chromatic --auto-accept-changes ${CHROMATIC_PROJECT_TOKEN}
fi
jobs:
build-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- <<: *yarn-cache-restore
- <<: *yarn-install
- <<: *yarn-cache-save
- persist_to_workspace:
root: *root
paths:
- node_modules
build:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Build
command: yarn build
- <<: *publish-to-chromatic

lint-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run ESLint
command: yarn run eslint src/**/*.{ts,tsx} stories/**/*.{ts,tsx}
- store_test_results:
path: test-results

test-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run Jest Tests
command: yarn run jest --ci --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT: test-results/jest/junit-${CIRCLE_NODE_INDEX}.xml
- store_test_results:
path: test-results

test-tsc:
<<: *defaults
docker:
- image: circleci/node:10-stretch

environment:
NODE_OPTIONS: --max_old_space_size=4096

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run TypeScript type-checking
command: yarn run tsc -p tsconfig.json
- store_test_results:
path: test-results
build-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- <<: *yarn-cache-restore
- <<: *yarn-install
- <<: *yarn-cache-save
- persist_to_workspace:
root: *root
paths:
- node_modules

build:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Build
command: yarn build
- <<: *publish-to-chromatic

lint-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run ESLint
command: yarn run eslint src/**/*.{ts,tsx} stories/**/*.{ts,tsx}
- store_test_results:
path: test-results

test-js:
<<: *defaults
docker:
- image: circleci/node:10-stretch

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run Jest Tests
command: yarn run jest --ci --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT: test-results/jest/junit-${CIRCLE_NODE_INDEX}.xml
- store_test_results:
path: test-results

test-tsc:
<<: *defaults
docker:
- image: circleci/node:10-stretch

environment:
NODE_OPTIONS: --max_old_space_size=4096

steps:
- checkout
- <<: *prospective-merge
- attach_workspace:
at: *root
- <<: *prepare-environment
- run:
name: Run TypeScript type-checking
command: yarn run tsc -p tsconfig.json
- store_test_results:
path: test-results

workflows:
version: 2

build-and-test:
jobs:
version: 2

build-and-test:
jobs:
- build-js
- lint-js:
requires:
- build-js
- test-js:
requires:
- build-js
- test-tsc:
requires:
- build-js
- lint-js:
requires:
- build-js
- test-js:
requires:
- build-js
- test-tsc:
requires:
- build-js
- build:
requires:
- test-js
- test-tsc
- build:
requires:
- test-js
- test-tsc
2 changes: 1 addition & 1 deletion .eslint.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"baseUrl": "./",
"noEmit": true
},
"include": ["**/*.js", "**/*.ts", "**/*.tsx"]
"include": ["**/*.ts", "**/*.tsx"]
}
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
'src/**/*.{js,ts,tsx}': [
'src/**/*.{ts,tsx}': [
'eslint --fix',
() => 'tsc -p tsconfig.json --noEmit --emitDeclarationOnly false',
],
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
collectCoverageFrom: [
'src/shared-components/**',
'/src/utils/**',
'!src/**/__snapshots__/*.js.snap',
'!src/**/__snapshots__/*.tsx.snap',
],
coverageThreshold: {
Expand Down
5 changes: 1 addition & 4 deletions stories/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
},
"include": [
"../src/**/*.ts",
"../src/**/*.js",
"../src/**/*.tsx",
"../stories/**/*.ts",
"../stories/**/*.js",
"../stories/**/*.tsx",
"../tests/**/*.ts",
"../tests/**/*.tsx",
"../types/**/*.ts"
"../tests/**/*.tsx"
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
// Setting the `rootDir` to `src` will guarantee this behavior, and raise compilation errors if violated.
"rootDir": "src"
},
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.tsx"]
"include": ["src/**/*.ts", "src/**/*.tsx"]
}

0 comments on commit 003a1a3

Please sign in to comment.