Skip to content

Commit c3fa362

Browse files
authored
lint: increased line-length #444
Since `.editorconfig` was added, eslint (or prettier) seems to treat it as authoritative. So let's just increase the line length.
1 parent 7488014 commit c3fa362

27 files changed

+166
-620
lines changed

.prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"tabWidth": 2,
33
"trailingComma": "es5",
44
"parser": "typescript",
5+
"printWidth": 100,
56
"singleQuote": true,
67
"arrowParens": "avoid"
78
}

packages/decorators/src/plugin/autocmd.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export function Autocmd(name: string, options?: AutocmdOptions) {
1919
}
2020
});
2121

22-
const nameWithPattern = `${name}${
23-
options?.pattern ? `:${options.pattern}` : ''
24-
}`;
22+
const nameWithPattern = `${name}${options?.pattern ? `:${options.pattern}` : ''}`;
2523
Object.defineProperty(f, NVIM_METHOD_NAME, {
2624
value: `autocmd:${nameWithPattern}`,
2725
});

packages/decorators/src/plugin/plugin.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
import { Neovim, NvimPlugin } from 'neovim';
44
import { NVIM_SPEC } from './properties';
5-
import {
6-
PluginOptions,
7-
AutocmdOptions,
8-
CommandOptions,
9-
FunctionOptions,
10-
} from './types';
5+
import { PluginOptions, AutocmdOptions, CommandOptions, FunctionOptions } from './types';
116

127
interface Spec {
138
type: 'function' | 'autocmd' | 'command';
@@ -57,11 +52,7 @@ function wrapper(cls: PluginWrapperConstructor, options?: PluginOptions): any {
5752
autoCmdOpts.eval = spec.opts.eval;
5853
}
5954

60-
plugin.registerAutocmd(
61-
spec.name,
62-
[this, method],
63-
autoCmdOpts as any
64-
);
55+
plugin.registerAutocmd(spec.name, [this, method], autoCmdOpts as any);
6556
break;
6657
case 'command':
6758
const cmdOpts: CommandOptions = {
@@ -134,7 +125,5 @@ export function Plugin(outter: any): any {
134125
*
135126
* Plugin(TestPlugin)
136127
*/
137-
return typeof outter !== 'function'
138-
? (cls: any) => wrapper(cls, outter)
139-
: wrapper(outter);
128+
return typeof outter !== 'function' ? (cls: any) => wrapper(cls, outter) : wrapper(outter);
140129
}

packages/integration-tests/src/factory.test.ts

+16-31
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,20 @@ describe('Plugin Factory (used by host)', () => {
5151
});
5252

5353
it('should collect the handlers from a plugin', async () => {
54-
expect(await pluginObj.handleRequest('Func', 'function', ['town'])).toEqual(
55-
'Funcy town'
56-
);
54+
expect(await pluginObj.handleRequest('Func', 'function', ['town'])).toEqual('Funcy town');
5755
});
5856

5957
it('should load the plugin a sandbox', async () => {
60-
expect(
61-
await pluginObj.handleRequest('Global', 'function', ['loaded'])
62-
).toEqual(true);
63-
expect(
64-
await pluginObj.handleRequest('Global', 'function', ['Buffer'])
65-
).not.toEqual(undefined);
66-
expect(
67-
await pluginObj.handleRequest('Global', 'function', ['process'])
68-
).not.toContain(['chdir', 'exit']);
58+
expect(await pluginObj.handleRequest('Global', 'function', ['loaded'])).toEqual(true);
59+
expect(await pluginObj.handleRequest('Global', 'function', ['Buffer'])).not.toEqual(undefined);
60+
expect(await pluginObj.handleRequest('Global', 'function', ['process'])).not.toContain([
61+
'chdir',
62+
'exit',
63+
]);
6964
});
7065

7166
it('should load files required by the plugin in a sandbox', async () => {
72-
expect(
73-
await pluginObj.handleRequest('Global', 'function', ['required'])
74-
).toEqual('you bet!');
67+
expect(await pluginObj.handleRequest('Global', 'function', ['required'])).toEqual('you bet!');
7568
// expect(
7669
// Object.keys(required.globals.process),
7770
// ).not.toContain(
@@ -94,10 +87,7 @@ describe('Plugin Factory (decorator api)', () => {
9487
let pluginObj: NvimPlugin;
9588

9689
beforeEach(() => {
97-
const p = loadPlugin(
98-
'@neovim/example-plugin-decorators',
99-
getFakeNvimClient()
100-
);
90+
const p = loadPlugin('@neovim/example-plugin-decorators', getFakeNvimClient());
10191
if (!p) {
10292
throw new Error();
10393
}
@@ -126,24 +116,19 @@ describe('Plugin Factory (decorator api)', () => {
126116
});
127117

128118
it('should collect the handlers from a plugin', async () => {
129-
expect(await pluginObj.handleRequest('Func', 'function', ['town'])).toEqual(
130-
'Funcy town'
131-
);
119+
expect(await pluginObj.handleRequest('Func', 'function', ['town'])).toEqual('Funcy town');
132120
});
133121

134122
it('should load the plugin a sandbox', async () => {
135-
expect(
136-
await pluginObj.handleRequest('Global', 'function', ['loaded'])
137-
).toEqual(true);
138-
expect(
139-
await pluginObj.handleRequest('Global', 'function', ['process'])
140-
).not.toContain(['chdir', 'exit']);
123+
expect(await pluginObj.handleRequest('Global', 'function', ['loaded'])).toEqual(true);
124+
expect(await pluginObj.handleRequest('Global', 'function', ['process'])).not.toContain([
125+
'chdir',
126+
'exit',
127+
]);
141128
});
142129

143130
it('should load files required by the plugin in a sandbox', async () => {
144-
expect(
145-
await pluginObj.handleRequest('Global', 'function', ['required'])
146-
).toEqual('you bet!');
131+
expect(await pluginObj.handleRequest('Global', 'function', ['required'])).toEqual('you bet!');
147132
// expect(
148133
// Object.keys(required.globals.process),
149134
// ).not.toContain(

packages/neovim/src/api/Base.ts

+3-19
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ export class BaseApi extends EventEmitter {
3939
// Node Buffer
4040
protected client: any;
4141

42-
constructor({
43-
transport,
44-
data,
45-
logger,
46-
metadata,
47-
client,
48-
}: BaseConstructorOptions) {
42+
constructor({ transport, data, logger, metadata, client }: BaseConstructorOptions) {
4943
super();
5044

5145
this.transport = transport;
@@ -75,12 +69,7 @@ export class BaseApi extends EventEmitter {
7569
try {
7670
logData =
7771
res && typeof res === 'object'
78-
? partialClone(
79-
res,
80-
2,
81-
['logger', 'transport', 'client'],
82-
'[Object]'
83-
)
72+
? partialClone(res, 2, ['logger', 'transport', 'client'], '[Object]')
8473
: res;
8574
} catch {
8675
logData = String(res);
@@ -108,12 +97,7 @@ export class BaseApi extends EventEmitter {
10897
return this[DO_REQUEST](name, args).catch(err => {
10998
// XXX: Get a `*.ts stacktrace. If we re-throw `err` we get a `*.js` trace. tsconfig issue?
11099
const newError = new Error(err.message);
111-
this.logger.error(
112-
`failed request to "%s": %s: %s`,
113-
name,
114-
newError.name,
115-
newError.message
116-
);
100+
this.logger.error(`failed request to "%s": %s: %s`, name, newError.name, newError.message);
117101
throw newError;
118102
});
119103
}

packages/neovim/src/api/Buffer.test.ts

+17-78
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ describe('Buffer API', () => {
1717

1818
// utility to allow each test to be run in its
1919
// own buffer
20-
function withBuffer(
21-
lines: string[],
22-
test: (buffer: Buffer) => Promise<void>
23-
) {
20+
function withBuffer(lines: string[], test: (buffer: Buffer) => Promise<void>) {
2421
return async () => {
2522
await nvim.command('new!');
2623

@@ -118,38 +115,18 @@ describe('Buffer API', () => {
118115

119116
it(
120117
'replaces the right lines',
121-
withBuffer(
122-
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
123-
async buffer => {
124-
await buffer.replace(['a', 'b', 'c'], 2);
125-
126-
expect(await buffer.lines).toEqual([
127-
'0',
128-
'1',
129-
'a',
130-
'b',
131-
'c',
132-
'5',
133-
'6',
134-
'7',
135-
'8',
136-
'9',
137-
]);
138-
}
139-
)
118+
withBuffer(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], async buffer => {
119+
await buffer.replace(['a', 'b', 'c'], 2);
120+
121+
expect(await buffer.lines).toEqual(['0', '1', 'a', 'b', 'c', '5', '6', '7', '8', '9']);
122+
})
140123
);
141124

142125
it(
143126
'inserts line at index 2',
144127
withBuffer(['test', 'bar', 'bar', 'bar'], async buffer => {
145128
buffer.insert(['foo'], 2);
146-
expect(await buffer.lines).toEqual([
147-
'test',
148-
'bar',
149-
'foo',
150-
'bar',
151-
'bar',
152-
]);
129+
expect(await buffer.lines).toEqual(['test', 'bar', 'foo', 'bar', 'bar']);
153130
})
154131
);
155132

@@ -192,13 +169,7 @@ describe('Buffer API', () => {
192169
withBuffer(['test', 'bar', 'foo'], async buffer => {
193170
await buffer.append(['test', 'test']);
194171

195-
expect(await buffer.lines).toEqual([
196-
'test',
197-
'bar',
198-
'foo',
199-
'test',
200-
'test',
201-
]);
172+
expect(await buffer.lines).toEqual(['test', 'bar', 'foo', 'test', 'test']);
202173
})
203174
);
204175

@@ -307,26 +278,12 @@ describe('Buffer API', () => {
307278

308279
it(
309280
'replaces the right lines',
310-
withBuffer(
311-
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
312-
async () => {
313-
const buffer = await nvim.buffer;
314-
await buffer.replace(['a', 'b', 'c'], 2);
315-
316-
expect(await buffer.lines).toEqual([
317-
'0',
318-
'1',
319-
'a',
320-
'b',
321-
'c',
322-
'5',
323-
'6',
324-
'7',
325-
'8',
326-
'9',
327-
]);
328-
}
329-
)
281+
withBuffer(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], async () => {
282+
const buffer = await nvim.buffer;
283+
await buffer.replace(['a', 'b', 'c'], 2);
284+
285+
expect(await buffer.lines).toEqual(['0', '1', 'a', 'b', 'c', '5', '6', '7', '8', '9']);
286+
})
330287
);
331288

332289
it(
@@ -352,13 +309,7 @@ describe('Buffer API', () => {
352309
withBuffer(['test', 'bar', 'bar', 'bar'], async () => {
353310
const buffer = await nvim.buffer;
354311
await buffer.insert(['foo'], 2);
355-
expect(await buffer.lines).toEqual([
356-
'test',
357-
'bar',
358-
'foo',
359-
'bar',
360-
'bar',
361-
]);
312+
expect(await buffer.lines).toEqual(['test', 'bar', 'foo', 'bar', 'bar']);
362313
})
363314
);
364315

@@ -376,13 +327,7 @@ describe('Buffer API', () => {
376327
withBuffer(['test', 'bar', 'foo'], async () => {
377328
const buffer = await nvim.buffer;
378329
await buffer.append(['test', 'test']);
379-
expect(await buffer.lines).toEqual([
380-
'test',
381-
'bar',
382-
'foo',
383-
'test',
384-
'test',
385-
]);
330+
expect(await buffer.lines).toEqual(['test', 'bar', 'foo', 'test', 'test']);
386331
})
387332
);
388333

@@ -477,13 +422,7 @@ describe('Buffer event updates', () => {
477422
const promise = new Promise<void>(resolve => {
478423
const unlisten = buffer.listen(
479424
'lines',
480-
async (
481-
currentBuffer: Buffer,
482-
tick: number,
483-
start: number,
484-
end: number,
485-
data: string[]
486-
) => {
425+
async (currentBuffer: Buffer, tick: number, start: number, end: number, data: string[]) => {
487426
expect(await currentBuffer.name).toBe(bufferName);
488427
expect(start).toBe(1);
489428
expect(end).toBe(1);

0 commit comments

Comments
 (0)