-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add actions test workflow * Set up test * Add env * Tweaks * Tweak quota * Bump eslint
- Loading branch information
Showing
20 changed files
with
378 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
const config = require("@blitzjs/next/eslint"); | ||
|
||
module.exports = { | ||
...config, | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
}, | ||
ignorePatterns: ["workers", "vendor", "docs"], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
// extends: [ | ||
// "blitz", | ||
// "eslint:recommended", | ||
// "plugin:react/recommended", | ||
// "plugin:@typescript-eslint/recommended", | ||
// ], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
plugins: ["react", "react-hooks", "@typescript-eslint", "unused-imports"], | ||
rules: { | ||
"react/react-in-jsx-scope": 0, | ||
"react/display-name": 0, | ||
"jsx-a11y/no-onchange": 0, | ||
"jsx-a11y/no-autofocus": 0, | ||
"no-console": ["error"], | ||
"no-warning-comments": ["error", { terms: ["fixme"] }], | ||
"no-restricted-imports": [ | ||
"error", | ||
{ paths: ["lodash", "purify-ts", "proj4"] }, | ||
], | ||
"no-throw-literal": "error", | ||
"prefer-const": 1, | ||
"require-await": 1, | ||
"react/jsx-key": 2, | ||
"react/prop-types": 0, | ||
"react/no-unescaped-entities": 0, | ||
"@next/next/no-img-element": 0, | ||
"@typescript-eslint/no-non-null-assertion": 0, | ||
"@typescript-eslint/explicit-module-boundary-types": 0, | ||
"@typescript-eslint/ban-types": 1, | ||
"react/jsx-no-useless-fragment": 2, | ||
"@typescript-eslint/no-explicit-any": 0, | ||
"@typescript-eslint/no-empty-function": 0, | ||
"react-hooks/rules-of-hooks": "error", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_", ignoreRestSiblings: true }, | ||
], | ||
"react-hooks/exhaustive-deps": [ | ||
"warn", | ||
{ | ||
additionalHooks: "(useRecoilCallback|useRecoilTransaction_UNSTABLE)", | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["*.ts", "*.tsx"], // Your TypeScript files extension | ||
parserOptions: { | ||
project: ["./tsconfig.json"], // Specify it only for TypeScript files | ||
}, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
], | ||
rules: { | ||
"prefer-const": 1, | ||
"unused-imports/no-unused-imports": "error", | ||
"@typescript-eslint/no-explicit-any": 0, | ||
"@typescript-eslint/no-base-to-string": 0, | ||
"@typescript-eslint/no-floating-promises": 1, | ||
"@typescript-eslint/switch-exhaustiveness-check": 2, | ||
"@typescript-eslint/no-misused-promises": 0, | ||
"@typescript-eslint/no-unnecessary-type-assertion": 1, | ||
"@typescript-eslint/no-unsafe-return": 1, | ||
// This will trip an error in linting/CI | ||
// because Routes will not be generated. | ||
"@typescript-eslint/no-unsafe-call": 1, | ||
"@typescript-eslint/no-unsafe-assignment": 0, | ||
"@typescript-eslint/no-unsafe-argument": 1, | ||
"@typescript-eslint/no-unsafe-member-access": 0, | ||
"@typescript-eslint/unbound-method": 0, | ||
}, | ||
}, | ||
{ | ||
files: ["./*.config.js", ".eslintrc.js"], | ||
env: { | ||
commonjs: true, | ||
}, | ||
}, | ||
{ | ||
files: ["./vendor/*/*"], | ||
rules: { | ||
complexity: 0, | ||
"no-warning-comments": 0, | ||
}, | ||
}, | ||
{ | ||
files: ["./vendor/mapshaper/**/*", "./vendor/mproj.js"], | ||
rules: { | ||
"@typescript-eslint/no-loss-of-precision": 0, | ||
"no-console": 0, | ||
"@typescript-eslint/no-unused-vars": 0, | ||
"@typescript-eslint/no-var-requires": 0, | ||
"@typescript-eslint/no-this-alias": 0, | ||
"no-extra-boolean-cast": 0, | ||
"no-useless-escape": 0, | ||
"no-empty": 0, | ||
"no-warning-comments": 0, | ||
"no-undef": 0, | ||
"no-constant-condition": 0, | ||
"no-control-regex": 0, | ||
"no-prototype-builtins": 0, | ||
"react-hooks/rules-of-hooks": 0, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Node CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_ENV: test | ||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/placemark_test | ||
NEXT_PUBLIC_FILE_WARN_MB: 5 | ||
NEXT_PUBLIC_FILE_LIMIT_MB: 5 | ||
PUSHER_SERVER_INTERNAL_ADDRESS: xxx | ||
NEXT_PUBLIC_STRIPE_PRICE_ID_ENTERPRISE: xx | ||
PUSHER_SERVER_INTERNAL_PORT: xxx | ||
NEXT_PUBLIC_POSTHOG_API_HOST: xxx | ||
NEXT_PUBLIC_POSTHOG_API_TOKEN: xxx | ||
NEXT_PUBLIC_MAPBOX_TOKEN: pk.eyJ1IjoidG1jdyIsImEiOiJja2twd25qdWowMXBuMnVxdDZodXJzaDZoIn0.UL4e2OtC7xrGr9hohU1odg | ||
BLOG_RSS_URL: xxx | ||
WFC_QUOTA: 10 | ||
WFC_QUOTA_ENTERPRISE: 100 | ||
TEAM_EMAIL: foo@bar.com | ||
DOMAIN: test.local | ||
CAMPAIGNMONITOR_KEY: xxx | ||
CYPRESS_INSTALL_BINARY: 0 | ||
GITHUB_CLIENT_ID: xx | ||
GITHUB_CLIENT_SECRET: xx | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
services: | ||
postgres: | ||
image: postgres:16 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v4 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- uses: actions/cache@v4 | ||
id: cache-next | ||
with: | ||
path: ${{ github.workspace }}/.next/cache | ||
# Generate a new cache whenever packages or source files change. | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]sx?') }} | ||
# If source files changed but packages didn't, rebuild from a prior cache. | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | ||
- name: Install packages | ||
run: | | ||
yarn install --frozen-lockfile | ||
- name: Migrate DB & generate prisma client | ||
run: yarn blitz prisma migrate dev | ||
- name: Lint | ||
run: | | ||
yarn lint | ||
- name: Run tests with coverage | ||
run: | | ||
yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.