Skip to content

Commit

Permalink
Merge pull request #1796 from openmeterio/chore/web-client
Browse files Browse the repository at this point in the history
feat(client): update web client & add new linter to typespec
  • Loading branch information
tothandras authored Nov 6, 2024
2 parents 4e02f2b + 70784ad commit b0c4884
Show file tree
Hide file tree
Showing 18 changed files with 13,072 additions and 3,991 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gen-api: ## Generate API and SDKs
$(call print-target)
$(MAKE) update-openapi-cloud
dagger call generate node-sdk -o api/client/node
# dagger call generate web-sdk -o api/client/web
dagger call generate web-sdk -o api/client/web
# dagger call generate python-sdk -o api/client/python

.PHONY: migrate-check
Expand Down
488 changes: 246 additions & 242 deletions api/client/go/client.gen.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion api/client/web/.eslintignore

This file was deleted.

59 changes: 0 additions & 59 deletions api/client/web/.eslintrc.json

This file was deleted.

91 changes: 91 additions & 0 deletions api/client/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: ['**/dist/', '!**/*.ts'],
},
...fixupConfigRules(
compat.extends(
'prettier',
'eslint:recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended'
)
),
{
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2022,
sourceType: 'module',
},

settings: {
'import/parsers': {
'@typescript-eslint/parser': ['', '.ts'],
},

'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},

rules: {
'no-mixed-spaces-and-tabs': 'warn',
'no-prototype-builtins': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': 'off',

'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],

'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],

'newlines-between': 'never',

alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
},
]
19 changes: 11 additions & 8 deletions api/client/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,39 @@
"node": ">=18.16.1"
},
"scripts": {
"lint": "eslint . --ext .ts",
"lint": "eslint .",
"format": "prettier --list-different --find-config-path --write .",
"build": "rimraf ./dist && tsc --build",
"generate": "openapi-typescript '../../openapi.yaml' --output src/client/openapi.ts && prettier --write src/client/openapi.ts",
"generate": "openapi-typescript '../../openapi.cloud.yaml' --output src/client/openapi.ts && prettier --write src/client/openapi.ts",
"pretest": "pnpm run build",
"test": "vitest --run",
"test:watch": "vitest --watch",
"prepublishOnly": "pnpm run generate && pnpm run build && pnpm run lint && pnpm run test"
},
"devDependencies": {
"@eslint/compat": "^1.2.2",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@testing-library/react": "16.0.1",
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@typescript-eslint/eslint-plugin": "7.13.1",
"@typescript-eslint/parser": "7.13.1",
"eslint": "8.57.0",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"eslint": "9.14.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-unused-imports": "4.1.4",
"eslint-plugin-vitest": "0.5.4",
"jsdom": "24.1.0",
"openapi-typescript": "6.7.6",
"jsdom": "25.0.1",
"openapi-typescript": "7.4.2",
"prettier": "3.3.3",
"react": "18.3.1",
"rimraf": "6.0.1",
"rollup": "^4.24.4",
"typescript": "5.6.3",
"undici": "6.20.1",
"vitest": "1.6.0"
"vitest": "2.1.4"
},
"dependencies": {
"openapi-typescript-fetch": "^2.0.0"
Expand Down
Loading

0 comments on commit b0c4884

Please sign in to comment.