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

Dynamic Nesting #7

Merged
merged 10 commits into from
Sep 7, 2024
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
26 changes: 2 additions & 24 deletions eslint.config.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import process from 'process';

const dirname = process.cwd();

const compat = new FlatCompat({
baseDirectory: dirname,
resolvePluginsRelativeTo: dirname,
});

const appConfigs = compat.config({
const config = {
env: {
node: true,
browser: true,
Expand Down Expand Up @@ -118,17 +107,6 @@ const appConfigs = compat.config({
}
}
]
}).map((conf) => ({
...conf,
files: ['src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.js', 'generated/**/*.ts'],
}));

const otherConfig = {
files: ['*.js', '*.ts', '*.cjs'],
...js.configs.recommended,
};

export default [
...appConfigs,
otherConfig,
];
module.exports = config;
135 changes: 135 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Lint & Build

on:
pull_request:
push:
branches:
- 'develop'

env:
APP_TITLE: ${{ vars.APP_TITLE }}
APP_ENVIRONMENT: ${{ vars.APP_ENVIRONMENT }}
APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }}
APP_GRAPHQL_ENDPOINT: ${{ vars.APP_GRAPHQL_ENDPOINT }}
APP_AUTH_URL: ${{ vars.APP_AUTH_URL }}
APP_ADMIN_URL: ${{ vars.APP_ADMIN_URL }}
APP_UMAMI_SRC: ${{ vars.APP_UMAMI_SRC }}
APP_UMAMI_ID: ${{ vars.APP_UMAMI_ID }}
APP_SENTRY_DSN: ${{ vars.APP_SENTRY_DSN }}
GITHUB_WORKFLOW: true

jobs:
unused:
name: Find unused things
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run knip
run: pnpm generate:type && pnpm lint:unused
lint-js:
name: Lint JS
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Lint Javascript
run: pnpm generate:type && pnpm lint:js
css-lint:
name: Lint CSS
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Css Lint
run: pnpm lint:css
typecheck:
name: Typecheck
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Lint Javascript
run: pnpm generate:type && pnpm typecheck
build:
name: Build
environment: 'test'
needs: [lint-js, css-lint, typecheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm generate:type && pnpm build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ pnpm-debug.log*
# Custom
build/
generated/
coverage/
stats.html

2 changes: 1 addition & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config: CodegenConfig = {
ignoreNoDocuments: true, // for better experience with the watcher
generates: {
'./generated/types/': {
preset: 'client'
preset: 'client',
}
},
config: {
Expand Down
2 changes: 1 addition & 1 deletion env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export default defineConfig({
APP_UMAMI_SRC: Schema.string.optional(),
APP_UMAMI_ID: Schema.string.optional(),
APP_SENTRY_DSN: Schema.string.optional(),
})
});
19 changes: 17 additions & 2 deletions knip.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["src/index.tsx"],
"project": ["src/**/*.tsx", "src/**/*.ts"]
"ignoreDependencies": [
"virtual:pwa-info",
"virtual:pwa-register"
],
"entry": [
"src/**/*.test.ts",
"src/**/*.test.tsx",
"generated/**/*.ts",
"src/index.tsx!"
],
"project": [
"src/**/*.d.ts",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"src/**/*.tsx!",
"src/**/*.ts!"
]
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
"build": "vite build",
"preview": "vite preview",
"generate-and-watch:type": "graphql-codegen --require dotenv/config --config codegen.ts --watch",
"generate:type": "graphql-codegen --require dotenv/config --config codegen.ts && eslint --fix generated/",
"generate:type": "graphql-codegen --require dotenv/config --config codegen.ts",
"typecheck": "tsc",
"lint": "pnpm lint:js && pnpm lint:css",
"lint:fix": "pnpm lint:js --fix && pnpm lint:css --fix",
"lint:js": "eslint src",
"lint:css": "stylelint \"./src/**/*.css\"",
"lint": "yarn lint:js && yarn lint:css",
"lint:unused": "knip",
"lint:fix": "yarn lint:js --fix && yarn lint:css --fix",
"lint:unused": "knip --tags=-knipignore",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"postinstall": "patch-package"
},
"dependencies": {
"@codemirror/lang-markdown": "^6.2.5",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@replit/codemirror-vim": "^6.2.1",
"@sentry/react": "^8.26.0",
"@togglecorp/fujs": "^2.2.0",
Expand All @@ -38,11 +40,8 @@
"urql": "^4.1.0"
},
"devDependencies": {
"@eslint/eslintrc": "^2.0.3",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.3.3",
"@graphql-codegen/introspection": "^4.0.3",
"@graphql-codegen/typescript-operations": "^4.2.3",
"@graphql-typed-document-node/core": "^3.2.0",
"@julr/vite-plugin-validate-env": "^1.0.1",
"@types/node": "^20.11.6",
Expand All @@ -55,24 +54,25 @@
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitest/coverage-v8": "^1.2.2",
"autoprefixer": "^10.4.14",
"dotenv": "^16.4.5",
"eslint": "^8.40.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import-exports-imports-resolver": "^1.0.1",
"eslint-plugin-import-newlines": "^1.3.4",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"eslint-plugin-simple-import-sort": "^10.0.0",
"knip": "^5.27.3",
"graphql": "^16.9.0",
"happy-dom": "^15.7.3",
"knip": "^5.29.2",
"patch-package": "^7.0.0",
"postcss": "^8.3.0",
"postcss-nested": "^6.0.1",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^8.3.2",
"postinstall-postinstall": "^2.1.0",
"rollup-plugin-visualizer": "^5.9.0",
"stylelint": "^16.7.0",
"stylelint-config-concentric": "^2.0.2",
Expand Down
Loading