Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppConfig]: lint & husky #273

Merged
merged 13 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
};
41 changes: 41 additions & 0 deletions .github/workflows/ci-genetics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI Genetics

on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Build genetics
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install yarn
run: |-
curl -fsSL --create-dirs -o $HOME/bin/yarn \
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js
chmod +x $HOME/bin/yarn
echo "$HOME/bin" >> $GITHUB_PATH

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "18.17.1"
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Build
run: yarn build:genetics
41 changes: 41 additions & 0 deletions .github/workflows/ci-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI Platform

on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Build platform
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install yarn
run: |-
curl -fsSL --create-dirs -o $HOME/bin/yarn \
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js
chmod +x $HOME/bin/yarn
echo "$HOME/bin" >> $GITHUB_PATH

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "18.17.1"
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Build
run: yarn build:platform
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/bundle-genetics
**/bundle-platform
**/node_modules
**/.github
**/.husky
**/public
**/__generated__
packages/eslint-config-custom
packages/tsconfig
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"semi": true,
"trailingComma": "es5",
"arrowParens": "avoid",
"tabWidth": 2,
"bracketSpacing": true
}
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ deploy:
skip_cleanup: true
on:
tags: true
all_branches: true
6 changes: 0 additions & 6 deletions apps/genetics/.prettierrc

This file was deleted.

13 changes: 0 additions & 13 deletions apps/genetics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^4.0.4",
"browserstack-local": "^1.4.5",
"cross-fetch": "^3.1.4",
"husky": ">=4",
"lint-staged": ">=10",
"nanoid-cli": "^1.1.0",
"nightwatch": "^1.1.13",
"prettier": "^2.7.1",
"rollup-plugin-polyfill-node": "^0.9.0",
"sass": "^1.49.10",
"source-map-explorer": "^2.0.0",
Expand All @@ -93,13 +88,5 @@
"vite": "^4.1.4",
"vite-plugin-simple-gql": "^0.5.0",
"vite-plugin-svgr": "^2.4.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,css,md}": "prettier --write"
}
}
2 changes: 1 addition & 1 deletion apps/platform/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ['eslint-config-custom-vite'],
extends: ['custom'],
};
6 changes: 0 additions & 6 deletions apps/platform/.prettierrc

This file was deleted.

24 changes: 4 additions & 20 deletions apps/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"preview": "vite preview",
"serve": "vite preview",
"prettier": "prettier --write",
"lint": "eslint \"src/**/*.{js,jsx,mjs,cjs,ts,tsx}\"",
"lint": "eslint --quiet \"src/**/*.{js,jsx,mjs,cjs,ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{js,jsx,mjs,cjs,ts,tsx}\" --fix",
"lint:quiet": "eslint --quiet \"src/**/*.{js,jsx,mjs,cjs,ts,tsx}\"",
"prettier:all": "prettier --write 'src/**/*.js'",
Expand All @@ -71,32 +71,16 @@
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-react": "^4.0.4",
"browserstack-local": "^1.4.5",
"cross-fetch": "^3.1.4",
"eslint": "^8.49.0",
"eslint-config-custom-vite": "*",
"husky": ">=4",
"lint-staged": ">=10",
"nanoid-cli": "^1.1.0",
"nightwatch": "^1.1.13",
"prettier": "^2.7.1",
"eslint": "7.32.0",
"eslint-config-custom": "*",
"sass": "^1.49.10",
"source-map-explorer": "^2.0.0",
"tsconfig": "*",
"typescript": "^5.0.4",
"typescript": "^5.2.2",
"vite": "^4.1.4",
"vite-plugin-simple-gql": "^0.5.0",
"vite-plugin-svgr": "^2.4.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts,tsx,jsx,css,md}": "prettier --write"
}
}
6 changes: 6 additions & 0 deletions apps/platform/src/documentNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.gql' {
import { DocumentNode } from 'graphql';

const value: DocumentNode;
export = value;
}
2 changes: 1 addition & 1 deletion apps/platform/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"rootDir": "src",
"outDir": "bundle-platform"
},
"include": ["src"]
"include": ["src", "./**/*.gql"]
}
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@
"build:platform:ppp": "turbo run build-ppp --filter=platform",
"lint": "turbo run lint",
"lint:platform": "turbo run lint --filter=platform",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md}\"",
"prepare": "husky install"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-custom": "*",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^2.5.1",
"turbo": "^1.10.13"
},
"engines": {
"npm": ">=7.0.0",
"node": ">=18.0.0"
},
"packageManager": "yarn@1.22.18"
"packageManager": "yarn@1.22.18",
"lint-staged": {
"*.{ts,tsx,js,jsx}": "eslint --cache --fix",
"*.{ts,tsx,js,jsx,md}": "prettier --write"
}
}
20 changes: 0 additions & 20 deletions packages/eslint-config-custom-vite/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
/* eslint-disable */
const project = require("tsconfig/vite.json");

module.exports = {
env: {
node: true,
browser: true,
es6: true,
jest: true,
},
parser: "@typescript-eslint/parser",
extends: [
"airbnb",
"eslint:recommended",
"plugin:import/recommended",
"plugin:react/jsx-runtime",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"turbo",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
ecmaVersion: 2020,
project,
},
plugins: ["react", "import", "@typescript-eslint", "react-hooks", "prettier"],
overrides: [
{
files: ["**/__tests__/**/*"],
env: {
jest: true,
},
plugins: ["@typescript-eslint", "jsx-a11y"],
settings: {
react: {
version: "detect",
},
],
},
rules: {
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/no-non-null-assertion": "off",
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"no-restricted-exports": "off",
"no-underscore-dangle": "warn",
"no-await-in-loop": "warn",
"no-param-reassign": ["error", { props: false }],
"import/prefer-default-export": "warn",
"no-empty-function": "off",

"react/prop-types": 0,
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { extensions: [".tsx", ".jsx"] }],

"jsx-a11y/no-static-element-interactions": "warn",
"jsx-a11y/click-events-have-key-events": "warn",
"jsx-a11y/no-static-element-interactions": "warn",
"jsx-a11y/no-autofocus": "warn",
"jsx-a11y/img-redundant-alt": "warn",
},
};
26 changes: 26 additions & 0 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "eslint-config-custom",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-config-turbo": "^1.10.15",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"eslint": "7.32.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsconfig": "*",
"typescript": "^5.2.2"
}
}
Loading
Loading