Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Linting (#2083)
* Runs yarn format

* Update website

* Web lint is failing

* Formatting

* Adds cache for dependency install

* Adds linting reports for GH

* Fixes artifact upload

* Caching tests

* Merge reports on GH actions

* Linting

* Fix prettier plugin conflicts

* Dep fixes

* Moves tailwind to monorepo package (#2091)

* New Crowdin translations by Github Action (#2077)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>

* fix redirection to 404 page on login (#2086)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>

* fix: update contributing (#2084)

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>

* Formatting

* Update website

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Louis <48682663+louis-27@users.noreply.github.com>
Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
  • Loading branch information
8 people committed Mar 9, 2022
1 parent 9da761b commit e53648d
Show file tree
Hide file tree
Showing 16 changed files with 412 additions and 245 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/lint.yml
Expand Up @@ -15,10 +15,30 @@ jobs:
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
version: 14.x
node-version: 14.x
cache: "yarn"
cache-dependency-path: yarn.lock

- name: Install deps
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn

- name: Lint
run: yarn lint
run: yarn lint:report
continue-on-error: true

- name: Merge lint reports
run: jq -s '[.[]]|flatten' lint-results/*.json &> lint-results/eslint_report.json

- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@1.2.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "lint-results/eslint_report.json"

- name: Upload ESLint report
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: lint-results
path: lint-results
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -68,3 +68,6 @@ packages/prisma/zod/*.ts

# Builds
dist

# Linting
lint-results
14 changes: 1 addition & 13 deletions .prettierrc.js
@@ -1,13 +1 @@
module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: false,
jsxSingleQuote: false,
trailingComma: "es5",
semi: true,
printWidth: 110,
arrowParens: "always",
importOrder: ["^@(calcom|ee)/(.*)$", "^@lib/(.*)$", "^@components/(.*)$", "^@(server|trpc)/(.*)$", "^[./]"],
importOrderSeparation: true,
plugins: [require("./merged-prettier-plugin")],
};
module.exports = require("./packages/config/prettier-preset");
3 changes: 2 additions & 1 deletion apps/docs/package.json
Expand Up @@ -7,6 +7,7 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
"dev": "PORT=4000 next",
"lint": "next lint",
"lint:report": "eslint . --format json --output-file ../../lint-results/docs.json",
"start": "PORT=4000 next start",
"build": "next build"
},
Expand All @@ -21,6 +22,6 @@
},
"devDependencies": {
"@calcom/config": "*",
"eslint": "^8.9.0"
"eslint": "^8.10.0"
}
}
44 changes: 13 additions & 31 deletions apps/docs/theme.config.js
@@ -1,12 +1,8 @@
export default {
github: 'https://github.com/calcom/cal.com',
docsRepositoryBase: 'https://github.com/calcom/cal.com/blob/main/apps/docs/pages',
titleSuffix: ' | Cal.com',
logo: (
<h4 className="m-0">
Cal.com
</h4>
),
const themeConfig = {
github: "https://github.com/calcom/cal.com",
docsRepositoryBase: "https://github.com/calcom/cal.com/blob/main/apps/docs/pages",
titleSuffix: " | Cal.com",
logo: <h4 className="m-0">Cal.com</h4>,
head: (
<>
<meta name="msapplication-TileColor" content="#ffffff" />
Expand All @@ -29,23 +25,9 @@ export default {
<meta name="og:image" content="https://cal.com/og-image.png" />
<meta name="apple-mobile-web-app-title" content="Cal.com Docs" />

<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000" />
<meta name="msapplication-TileColor" content="#ff0000" />
Expand All @@ -56,8 +38,8 @@ export default {
prevLinks: true,
nextLinks: true,
footer: true,
footerEditLink: 'Edit this page on GitHub',
footerText: (
<>© {new Date().getFullYear()} Cal.com, Inc. All rights reserved.</>
),
}
footerEditLink: "Edit this page on GitHub",
footerText: <>© {new Date().getFullYear()} Cal.com, Inc. All rights reserved.</>,
};

export default themeConfig;
2 changes: 1 addition & 1 deletion apps/web/next-i18next.config.js
Expand Up @@ -24,7 +24,7 @@ module.exports = {
"zh-TW",
"cs",
"sr",
"sv"
"sv",
],
},
localePath: path.resolve("./public/static/locales"),
Expand Down
3 changes: 2 additions & 1 deletion apps/web/package.json
Expand Up @@ -17,6 +17,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:report": "eslint . --format json --output-file ../../lint-results/web.json",
"lint:fix": "next lint . --ext .ts,.js,.tsx,.jsx --fix",
"check-changed-files": "ts-node scripts/ts-check-changed-files.ts",
"downgrade": "ts-node ee/lib/stripe/downgrade.ts"
Expand Down Expand Up @@ -127,7 +128,7 @@
"autoprefixer": "^10.4.0",
"babel-jest": "^27.3.1",
"env-cmd": "10.1.0",
"eslint": "^8.9.0",
"eslint": "^8.10.0",
"jest": "^26.0.0",
"mockdate": "^3.0.5",
"module-alias": "^2.2.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/pages/[user].tsx
Expand Up @@ -63,7 +63,7 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {
<div
key={type.id}
style={{ display: "flex" }}
className="group hover:border-brand relative rounded-sm border border-neutral-200 bg-white hover:bg-gray-50 dark:border-0 dark:bg-neutral-900 dark:hover:border-neutral-600">
className="hover:border-brand group relative rounded-sm border border-neutral-200 bg-white hover:bg-gray-50 dark:border-0 dark:bg-neutral-900 dark:hover:border-neutral-600">
<ArrowRightIcon className="absolute right-3 top-3 h-4 w-4 text-black opacity-0 transition-opacity group-hover:opacity-100 dark:text-white" />
{/* Don't prefetch till the time we drop the amount of javascript in [user][type] page which is impacting score for [user] page */}
<Link
Expand Down
2 changes: 1 addition & 1 deletion apps/web/pages/team/[slug].tsx
Expand Up @@ -32,7 +32,7 @@ function TeamPage({ team }: TeamPageProps) {
{team.eventTypes.map((type) => (
<li
key={type.id}
className="group hover:border-brand relative rounded-sm border border-neutral-200 bg-white hover:bg-gray-50 dark:border-0 dark:bg-neutral-900 dark:hover:border-neutral-600">
className="hover:border-brand group relative rounded-sm border border-neutral-200 bg-white hover:bg-gray-50 dark:border-0 dark:bg-neutral-900 dark:hover:border-neutral-600">
<ArrowRightIcon className="absolute right-3 top-3 h-4 w-4 text-black opacity-0 transition-opacity group-hover:opacity-100 dark:text-white" />
<Link href={`${team.slug}/${type.slug}`}>
<a className="flex justify-between px-6 py-4">
Expand Down
2 changes: 1 addition & 1 deletion apps/website
7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -21,6 +21,7 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"heroku-postbuild": "turbo run @calcom/web#build",
"lint": "turbo run lint",
"lint:report": "turbo run lint:report",
"pre-commit": "lint-staged",
"prepare": "husky install",
"start": "turbo run start --scope=\"@calcom/web\"",
Expand All @@ -30,11 +31,9 @@
"type-check": "turbo run type-check"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "2.0.4",
"husky": "^7.0.1",
"lint-staged": "^11.1.2",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.6"
"lint-staged": "^12.3.5",
"prettier": "^2.5.1"
},
"dependencies": {
"turbo": "latest"
Expand Down
Expand Up @@ -3,18 +3,11 @@ const tailwind = require("prettier-plugin-tailwindcss");
const sortImports = require("@trivago/prettier-plugin-sort-imports");

const combinedFormatter = {
...tailwind,
parsers: {
...tailwind.parsers,
...Object.keys(sortImports.parsers).reduce((acc, key) => {
acc[key] = {
...tailwind.parsers[key],
preprocess(code, options) {
return sortImports.parsers[key].preprocess(code, options);
},
};
return acc;
}, {}),
typescript: {
...tailwind.parsers.typescript,
preprocess: sortImports.parsers.typescript.preprocess,
},
},
};

Expand Down
12 changes: 8 additions & 4 deletions packages/config/package.json
Expand Up @@ -4,17 +4,21 @@
"main": "index.js",
"license": "MIT",
"files": [
"eslint-preset.js"
"eslint-preset.js",
"prettier-preset.js"
],
"dependencies": {
"eslint-config-next": "^12.0.8",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-playwright": "^0.7.1",
"eslint-plugin-prettier": "^3.4.0"
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-playwright": "^0.8.0",
"eslint-plugin-prettier": "^4.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/typography": "^0.5.2",
"@trivago/prettier-plugin-sort-imports": "3.2.0",
"prettier-plugin-tailwindcss": "^0.1.8",
"prettier": "^2.5.1",
"tailwindcss": "^3.0.23",
"typescript": "^4.5.3"
}
Expand Down
13 changes: 13 additions & 0 deletions packages/config/prettier-preset.js
@@ -0,0 +1,13 @@
module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: false,
jsxSingleQuote: false,
trailingComma: "es5",
semi: true,
printWidth: 110,
arrowParens: "always",
importOrder: ["^@(calcom|ee)/(.*)$", "^@lib/(.*)$", "^@components/(.*)$", "^@(server|trpc)/(.*)$", "^[./]"],
importOrderSeparation: true,
plugins: [require("./merged-prettier-plugin")],
};
5 changes: 5 additions & 0 deletions turbo.json
Expand Up @@ -88,8 +88,13 @@
"cache": false
},
"lint": {
"cache": false,
"outputs": []
},
"lint:report": {
"cache": false,
"outputs": ["lint-results"]
},
"start": {},
"test": {
"dependsOn": []
Expand Down

2 comments on commit e53648d

@vercel
Copy link

@vercel vercel bot commented on e53648d Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The total size of all Environment Variables (4.21KB) exceeds 4KB.

Learn More: https://vercel.link/env-vars-limit

@vercel
Copy link

@vercel vercel bot commented on e53648d Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-cal.vercel.app
developer.cal.com
docs.calendso.com
docs.cal.com
docs-git-main-cal.vercel.app

Please sign in to comment.