-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: Unify linting strategy + enforce linting across repo #2839
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
Changes from 2 commits
ca58f90
d655bba
cd9595d
7cba1b4
096fa12
402830a
c6419da
c751ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| # TODO: Enable lint job after applying lint fixes and setting appropriate warning limits | ||
| # Will be handled in follow-up PR to avoid blocking CI setup / bloating this PR | ||
| # lint: | ||
| # name: Lint | ||
| # runs-on: ubuntu-latest | ||
|
|
||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
|
|
||
| # - uses: oven-sh/setup-bun@v1 | ||
| # with: | ||
| # bun-version: latest | ||
|
|
||
| # - name: Cache dependencies | ||
| # uses: actions/cache@v4 | ||
| # with: | ||
| # path: | | ||
| # ~/.bun/install/cache | ||
| # key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
|
||
| # - name: Install dependencies | ||
| # run: bun install --frozen | ||
|
|
||
| # - name: Run linter | ||
| # run: bun lint | ||
|
|
||
| typecheck: | ||
| name: Typecheck | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: oven-sh/setup-bun@v1 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.bun/install/cache | ||
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen | ||
|
|
||
| - name: Run type checking | ||
| run: bun typecheck | ||
|
|
||
| test: | ||
| name: Unit Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: oven-sh/setup-bun@v1 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.bun/install/cache | ||
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen | ||
|
|
||
| - name: Run tests | ||
| run: bun test --timeout 30000 --coverage |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,3 @@ | ||||||||||
| #!/usr/bin/env sh | ||||||||||
| bun run format && git add . | ||||||||||
| # bun run format && git add . | ||||||||||
| # bun run lint && bun run format:write && git add . | ||||||||||
|
Comment on lines
+2
to
3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pre-commit hook has been commented out without enabling a replacement, effectively disabling Git's pre-commit functionality. Consider either:
Without an active hook, code formatting won't be automatically applied before commits.
Suggested change
Spotted by Diamond |
||||||||||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was pulled into |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,14 @@ | ||
| import { FlatCompat } from '@eslint/eslintrc'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import baseConfig, { restrictEnvAccess } from "@onlook/eslint/base"; | ||
| import nextjsConfig from "@onlook/eslint/nextjs"; | ||
| import reactConfig from "@onlook/eslint/react"; | ||
|
|
||
| const compat = new FlatCompat({ | ||
| baseDirectory: import.meta.dirname, | ||
| }); | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
| ignores: ['.next'], | ||
| }, | ||
| ...compat.extends('next/core-web-vitals'), | ||
| { | ||
| files: ['**/*.ts', '**/*.tsx'], | ||
| extends: [ | ||
| ...tseslint.configs.recommended, | ||
| ...tseslint.configs.recommendedTypeChecked, | ||
| ...tseslint.configs.stylisticTypeChecked, | ||
| ], | ||
| rules: { | ||
| '@typescript-eslint/array-type': 'off', | ||
| '@typescript-eslint/consistent-type-definitions': 'off', | ||
| '@typescript-eslint/consistent-type-imports': [ | ||
| 'warn', | ||
| { prefer: 'type-imports', fixStyle: 'inline-type-imports' }, | ||
| ], | ||
| '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], | ||
| '@typescript-eslint/require-await': 'off', | ||
| '@typescript-eslint/no-misused-promises': 'warn' | ||
| }, | ||
| }, | ||
| { | ||
| linterOptions: { | ||
| reportUnusedDisableDirectives: true, | ||
| }, | ||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| }, | ||
| }, | ||
| }, | ||
| ); | ||
| /** @type {import('typescript-eslint').Config} */ | ||
| export default [ | ||
| { | ||
| ignores: [".next/**"], | ||
| }, | ||
| ...baseConfig, | ||
| ...reactConfig, | ||
| ...nextjsConfig, | ||
| ...restrictEnvAccess, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| import baseConfig from '@onlook/prettier'; | ||
|
|
||
| /** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ | ||
| export default { | ||
| plugins: ['prettier-plugin-tailwindcss'], | ||
| ...baseConfig, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import baseConfig from "@onlook/eslint/base"; | ||
|
|
||
| /** @type {import('typescript-eslint').Config} */ | ||
| export default [ | ||
| { | ||
| ignores: ["dist/**"], | ||
| }, | ||
| ...baseConfig, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,8 @@ | |
| } | ||
| }, | ||
| "include": [ | ||
| "src", | ||
| "test" | ||
| "script", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no src/test in this package |
||
| "server" | ||
| ], | ||
| "exclude": [ | ||
| "node_modules" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import baseConfig from "@onlook/eslint/base"; | ||
|
|
||
| /** @type {import('typescript-eslint').Config} */ | ||
| export default [ | ||
| { | ||
| ignores: ["dist/**"], | ||
| }, | ||
| ...baseConfig, | ||
| ]; |
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was unused
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also looks unused, since we're using bun build |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling temporarily, otherwise this PR will have 1000's of files touched