Skip to content

Commit 276c3ca

Browse files
author
Amin Mahboubi
authored
prettier: increase line width to 120char (#818)
1 parent c27a999 commit 276c3ca

23 files changed

+556
-2133
lines changed

.eslintrc.json

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"plugins": [
3-
"babel",
4-
"markdown",
5-
"sonarjs",
6-
"prettier",
7-
"@typescript-eslint",
8-
"typescript-sort-keys"
9-
],
10-
"extends": [
11-
"eslint:recommended",
12-
"plugin:sonarjs/recommended",
13-
"plugin:@typescript-eslint/recommended",
14-
"prettier"
15-
],
2+
"plugins": ["babel", "markdown", "sonarjs", "prettier", "@typescript-eslint", "typescript-sort-keys"],
3+
"extends": ["eslint:recommended", "plugin:sonarjs/recommended", "plugin:@typescript-eslint/recommended", "prettier"],
164
"rules": {
175
"@typescript-eslint/ban-ts-comment": 0,
186
"@typescript-eslint/explicit-module-boundary-types": 0,
@@ -47,11 +35,7 @@
4735
"asc",
4836
{ "caseSensitive": false, "natural": true, "requiredFirst": true }
4937
],
50-
"typescript-sort-keys/string-enum": [
51-
"error",
52-
"asc",
53-
{ "caseSensitive": false, "natural": true }
54-
]
38+
"typescript-sort-keys/string-enum": ["error", "asc", { "caseSensitive": false, "natural": true }]
5539
},
5640
"env": {
5741
"es6": true,

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"useTabs": false,
3-
"printWidth": 90,
3+
"printWidth": 120,
44
"tabWidth": 2,
55
"singleQuote": true,
66
"trailingComma": "all",

README.md

+4-13
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,9 @@ const client = StreamChat.getInstance<
7575
* Unused generics default to Record<string, unknown>
7676
* with the exception of Command which defaults to string & {}
7777
*/
78-
const client = StreamChat.getInstance<
79-
{},
80-
ChatChannel,
81-
{},
82-
{},
83-
UserMessage | AdminMessage,
84-
{},
85-
ChatUser1 | ChatUser2
86-
>('YOUR_API_KEY');
78+
const client = StreamChat.getInstance<{}, ChatChannel, {}, {}, UserMessage | AdminMessage, {}, ChatUser1 | ChatUser2>(
79+
'YOUR_API_KEY',
80+
);
8781
```
8882

8983
Query operations will return results that utilize the custom types added via generics. In addition the query filters are type checked and provide intellisense using both the key and type of the parameter to ensure accurate use.
@@ -139,10 +133,7 @@ Custom types are carried into all creation functions as well.
139133
```typescript
140134
// Valid
141135
client.connectUser({ id: 'testId', nickname: 'testUser', age: 3 }, 'TestToken');
142-
client.connectUser(
143-
{ id: 'testId', nickname: 'testUser', avatar: 'testAvatar' },
144-
'TestToken',
145-
);
136+
client.connectUser({ id: 'testId', nickname: 'testUser', avatar: 'testAvatar' }, 'TestToken');
146137

147138
// Invalid
148139
client.connectUser({ id: 'testId' }, 'TestToken'); // Type ChatUser1 | ChatUser2 requires nickname for both types

rollup.config.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@ import pkg from './package.json';
1010
import process from 'process';
1111
process.env.NODE_ENV = 'production';
1212

13-
const externalPackages = [
14-
'axios',
15-
'form-data',
16-
'isomorphic-ws',
17-
'base64-js',
18-
/@babel\/runtime/,
19-
];
13+
const externalPackages = ['axios', 'form-data', 'isomorphic-ws', 'base64-js', /@babel\/runtime/];
2014

2115
const browserIgnore = {
2216
name: 'browser-remapper',
23-
resolveId: (importee) =>
24-
['jsonwebtoken', 'https', 'crypto'].includes(importee) ? importee : null,
25-
load: (id) =>
26-
['jsonwebtoken', 'https', 'crypto'].includes(id) ? 'export default null;' : null,
17+
resolveId: (importee) => (['jsonwebtoken', 'https', 'crypto'].includes(importee) ? importee : null),
18+
load: (id) => (['jsonwebtoken', 'https', 'crypto'].includes(id) ? 'export default null;' : null),
2719
};
2820

2921
const extensions = ['.mjs', '.json', '.node', '.js', '.ts'];
@@ -112,6 +104,4 @@ const fullBrowserBundle = {
112104
};
113105

114106
export default () =>
115-
process.env.ROLLUP_WATCH
116-
? [normalBundle, browserBundle]
117-
: [normalBundle, browserBundle, fullBrowserBundle];
107+
process.env.ROLLUP_WATCH ? [normalBundle, browserBundle] : [normalBundle, browserBundle, fullBrowserBundle];

src/base64.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ function isMapStringCallback<T, U>(
1717
// source - https://github.com/beatgammit/base64-js/blob/master/test/convert.js#L72
1818
function map<T, U>(array: T[], callback: MapGenericCallback<T, U>): U[];
1919
function map<U>(string: string, callback: MapStringCallback<U>): U[];
20-
function map<T, U>(
21-
arrayOrString: string | T[],
22-
callback: MapGenericCallback<T, U> | MapStringCallback<U>,
23-
): U[] {
20+
function map<T, U>(arrayOrString: string | T[], callback: MapGenericCallback<T, U> | MapStringCallback<U>): U[] {
2421
const res = [];
2522

2623
if (isString(arrayOrString) && isMapStringCallback(arrayOrString, callback)) {

0 commit comments

Comments
 (0)