Skip to content
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
21 changes: 0 additions & 21 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .commitlintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://json.schemastore.org/commitlintrc.json",
"extends": ["@commitlint/config-conventional"]
}
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

74 changes: 0 additions & 74 deletions .eslintrc.json

This file was deleted.

15 changes: 7 additions & 8 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ description: Sets up Node and Build SDK

inputs:
node-version:
description: "Specify Node version"
description: 'Specify Node version'
required: false
default: "22"
default: '22'

runs:
using: "composite"
using: 'composite'
steps:
- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -20,13 +20,12 @@ runs:
shell: bash
run: echo "NODE_VERSION=$(node --version)" >> $GITHUB_ENV

- name: Cache Dependencies
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ inputs.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-${{ inputs.node-version }}-modules-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('./yarn.lock') }}

- name: Install Dependencies & Build
run: yarn install --frozen-lockfile --ignore-engines
- name: Install dependencies
run: yarn install --frozen-lockfile
shell: bash
7 changes: 2 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ on:
pull_request:
types: [opened, synchronize, reopened, edited]

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- name: Commit message lint
run: echo "${{ github.event.pull_request.title }}" | yarn commitlinter

- name: Lint
run: yarn lint
16 changes: 16 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check PR title

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
pr-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-node

- name: commitlint
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# https://github.com/stream-ci-bot
GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}
HUSKY: 0
run: >
yarn semantic-release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
schedule:
# Monday at 9:00 UTC
- cron: "0 9 * * 1"
- cron: '0 9 * * 1'

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'test/**'
- '**.md'

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

Expand Down
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

npx commitlint --edit $1
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env sh

if ! yarn run lint-staged; then
echo
echo "Some files were not formatted correctly (see output above), commit aborted!"
Expand Down
4 changes: 2 additions & 2 deletions .lintstagedrc.fix.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"{**/*.{js,ts,md,css,scss,json}, .eslintrc.json, .prettierrc, .babelrc}": "prettier --write",
"**/*.{js,md,ts}": "eslint --fix"
"**/*.{json,js,mjs,ts,yml,md}": "prettier --write",
"**/*.{js,mjs,ts}": "eslint --fix"
}
4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"{**/*.{js,ts,md,css,scss,json}, .eslintrc.json, .prettierrc, .babelrc}": "prettier --list-different",
"**/*.{js,md,ts}, !test": "eslint --max-warnings 0"
"**/*.{json,js,mjs,ts,yml,md}": "prettier --list-different",
"**/*.{js,mjs,ts}, !test": "eslint --max-warnings 0"
}
7 changes: 0 additions & 7 deletions .mocharc.json

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/dist
/node_modules
/.vscode
/types
CHANGELOG.md
test/typescript/data.ts
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"useTabs": false,
"printWidth": 120,
"tabWidth": 2,
"arrowParens": "always",
"jsxSingleQuote": true,
"printWidth": 90,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"jsxBracketSameLine": false,
"useTabs": false,
"semi": true,
"overrides": [
{
"files": "*.js",
"options": {
"useTabs": true,
"tabWidth": 4
"useTabs": true
}
}
]
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ await client.upsertUser({
});

// create a channel
const channel = client.channel('messaging', 'test-channel', { created_by_id: 'vishal-1' });
const channel = client.channel('messaging', 'test-channel', {
created_by_id: 'vishal-1',
});
await channel.create();

// send message
Expand Down Expand Up @@ -84,10 +86,16 @@ declare module 'stream-chat' {
// index.ts

// property `profile_picture` is code-completed and expects type `string | undefined`
await client.partialUpdateUser({ id: 'vishal-1', set: { profile_picture: 'https://random.picture/1.jpg' } });
await client.partialUpdateUser({
id: 'vishal-1',
set: { profile_picture: 'https://random.picture/1.jpg' },
});

// property `custom_property` is code-completed and expects type `number | undefined`
const { message } = await channel.sendMessage({ text: 'This is another test message', custom_property: 255 });
const { message } = await channel.sendMessage({
text: 'This is another test message',
custom_property: 255,
});

message.custom_property; // in the response object as well
```
Expand Down
2 changes: 0 additions & 2 deletions babel-register.js

This file was deleted.

88 changes: 88 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';

import importPlugin from 'eslint-plugin-import';

export default tseslint.config(
{
ignores: ['dist', 'src/@types', '*.{js,ts}'],
},
{
name: 'default',
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['src/**/*.{js,ts}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
import: importPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
camelcase: 'off',
semi: ['warn', 'always'],
eqeqeq: ['error', 'smart'],
'array-callback-return': 'error',
'arrow-body-style': 'error',
'comma-dangle': 'off',
'default-case': 'error',
'jsx-quotes': ['error', 'prefer-single'],
'linebreak-style': ['error', 'unix'],
'no-console': 'off',
'no-mixed-spaces-and-tabs': 'warn',
'no-self-compare': 'error',
'no-underscore-dangle': 'off',
'no-use-before-define': 'off',
'no-useless-concat': 'error',
'no-var': 'error',
'no-script-url': 'error',
'no-continue': 'off',
'object-shorthand': 'warn',
'prefer-const': 'warn',
'require-await': 'error',
'sort-imports': [
'error',
{
allowSeparatedGroups: true,
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'sort-keys': 'off',
'valid-typeof': 'error',
'max-classes-per-file': 'off',
'no-unused-expressions': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true, // TODO: set to false once React is in the dependencies (not devDependencies)
optionalDependencies: false,
peerDependencies: false,
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ ignoreRestSiblings: false, caughtErrors: 'none' },
],
'@typescript-eslint/no-unsafe-function-type': 'error',
'@typescript-eslint/no-wrapper-object-types': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-require-imports': 'off', // TODO: remove this rule once all files are .mjs (and require is not used)
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-empty-object-type': 'off',
},
},
);
Loading