From 5295d2dd557b0d39024dde87180007674448ac6c Mon Sep 17 00:00:00 2001 From: jedtan Date: Mon, 29 Mar 2021 23:24:58 -0700 Subject: [PATCH] TFAC-292 Lint on Pre-Commit --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ package.json | 6 ++++-- yarn.lock | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..5cb52601a --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn run lint && yarn test diff --git a/package.json b/package.json index 0b0503d55..f818ad9e9 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,15 @@ "dev": "echo \"Use the 'yarn go' command to develop locally.\"", "build": "NODE_ENV=test yarn run test && NODE_ENV=production yarn run relay && next build", "start": "NODE_ENV=production next start --port 3001", - "test": "yarn run lint && yarn run relay && jest", + "test": "yarn run relay && jest", "test:watch": "yarn run relay && jest --watch", "test:coverage": "yarn run test --coverage", "format": "prettier \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\"", "format:fix": "yarn run format --write", "lint": "eslint \"**/*.{js,jsx}\" --ignore-pattern \"next.config.*js\"", "relay": "relay-compiler --src ./src/ --artifactDirectory ./src/relay/__generated__ --exclude '**/__test__/**' '**/__generated__/**' --schema ./src/schema/schema.graphql", - "find-unused": "echo \"This will find unused files. However, note that it ignores mocks, tests, and utils in the testHelpers directory.\n\" && next-unused" + "find-unused": "echo \"This will find unused files. However, note that it ignores mocks, tests, and utils in the testHelpers directory.\n\" && next-unused", + "prepare": "husky install" }, "dependencies": { "@material-ui/core": "^4.11.2", @@ -66,6 +67,7 @@ "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "graphql": "^15.4.0", + "husky": "^6.0.0", "identity-obj-proxy": "^3.0.0", "jest": "^26.6.3", "jest-next-dynamic": "^1.0.1", diff --git a/yarn.lock b/yarn.lock index 582da73f4..a095a3281 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5966,6 +5966,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +husky@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" + integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== + hyphenate-style-name@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz"