Skip to content

Commit

Permalink
Update eslint to the latest version
Browse files Browse the repository at this point in the history
Need to rename no-shadow to @typescript-eslint/no-shadow as specified there:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md

Change-Id: Ib864501e48772b224b4999718f4f8dfbeb8964d6
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Nov 23, 2020
1 parent e209832 commit 93706a3
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 109 deletions.
3 changes: 2 additions & 1 deletion configs/errors.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
],
"no-new-wrappers": "error",
"no-null/no-null": "error",
"no-shadow": [
"no-shadow": "off",
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
"@types/sinon": "^2.3.5",
"@types/temp": "^0.8.29",
"@types/uuid": "^7.0.3",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/eslint-plugin-tslint": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"@typescript-eslint/parser": "^4.8.1",
"chai-string": "^1.4.0",
"colors": "^1.4.0",
"concurrently": "^3.5.0",
"electron-mocha": "^8.2.0",
"eslint": "^6.8.0",
"eslint": "^7.14.0",
"eslint-plugin-deprecation": "^1.1.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-no-unsanitized": "^3.1.2",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-no-unsanitized": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"ignore-styles": "^5.0.1",
"jsdom": "^11.5.1",
"lerna": "^2.2.0",
Expand Down
18 changes: 9 additions & 9 deletions packages/callhierarchy/src/common/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as strings from '@theia/core/lib/common/strings';
import * as paths from './paths';
import { CharCode } from '@theia/core/lib/common/char-code';

/* eslint-disable no-shadow, no-null/no-null */
/* eslint-disable @typescript-eslint/no-shadow, no-null/no-null */
export interface IExpression {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[pattern: string]: boolean | SiblingClause | any;
Expand Down Expand Up @@ -429,10 +429,10 @@ function trivia3(pattern: string, options: IGlobOptions): ParsedStringPattern {
function trivia4and5(path: string, pattern: string, matchPathEnds: boolean): ParsedStringPattern {
const nativePath = paths.nativeSep !== paths.sep ? path.replace(ALL_FORWARD_SLASHES, paths.nativeSep) : path;
const nativePathEnd = paths.nativeSep + nativePath;
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const parsedPattern: ParsedStringPattern = matchPathEnds ? function (path, basename): string {
return path && (path === nativePath || strings.endsWith(path, nativePathEnd)) ? pattern : null!;
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
} : function (path, basename): string {
return path && path === nativePath ? pattern : null!;
};
Expand Down Expand Up @@ -560,7 +560,7 @@ export function isRelativePattern(obj: any): obj is IRelativePattern {
* Same as `parse`, but the ParsedExpression is guaranteed to return a Promise
*/
export function parseToAsync(expression: IExpression, options?: IGlobOptions): ParsedExpression {
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const parsedExpression = parse(expression, options);
return (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise<boolean>): string | Promise<string> => {
const result = parsedExpression(path, basename, hasSibling);
Expand Down Expand Up @@ -591,9 +591,9 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse
return <ParsedStringPattern>parsedPatterns[0];
}

// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const resultExpression: ParsedStringPattern = function (path: string, basename: string): string | Promise<string> {
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
// tslint:disable-next-line:one-variable-per-declaration
for (let i = 0, n = parsedPatterns.length; i < n; i++) {
// Pattern matches path
Expand All @@ -606,13 +606,13 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse
return null!;
};

// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const withBasenames = parsedPatterns.find(pattern => !!(<ParsedStringPattern>pattern).allBasenames);
if (withBasenames) {
resultExpression.allBasenames = (<ParsedStringPattern>withBasenames).allBasenames;
}

// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, <string[]>[]);
if (allPaths.length) {
resultExpression.allPaths = allPaths;
Expand All @@ -624,7 +624,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse
const resultExpression: ParsedStringPattern = function (path: string, basename: string, hasSibling?: (name: string) => boolean | Promise<boolean>): string | Promise<string> {
let name: string = null!;

// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
for (let i = 0, n = parsedPatterns.length; i < n; i++) {
// Pattern matches path
const parsedPattern = (<ParsedExpressionPattern>parsedPatterns[i]);
Expand Down
6 changes: 3 additions & 3 deletions packages/callhierarchy/src/common/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function normalize(path: string, toOSPath?: boolean): string {
return path;
}

// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const sep = wantsBackslash ? '\\' : '/';
const root = getRoot(path, sep);

Expand Down Expand Up @@ -133,7 +133,7 @@ function streql(value: string, start: number, end: number, other: string): boole
* `getRoot('files:///files/path') === files:///`,
* or `getRoot('\\server\shares\path') === \\server\shares\`
*/
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
export function getRoot(path: string, sep: string = '/'): string {

if (!path) {
Expand All @@ -150,7 +150,7 @@ export function getRoot(path: string, sep: string = '/'): string {
// ^^^^^^^^^^^^^^^^^^^
code = path.charCodeAt(2);
if (code !== CharCode.Slash && code !== CharCode.Backslash) {
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
let pos = 3;
const start = pos;
for (; pos < len; pos++) {
Expand Down
2 changes: 1 addition & 1 deletion packages/filesystem/src/browser/file-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// and https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts

/* eslint-disable max-len */
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable no-null/no-null */
/* eslint-disable @typescript-eslint/tslint/config */
/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class RemoteFileSystemProvider implements Required<FileSystemProvider>, D

readFileStream(resource: URI, opts: FileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array> {
const capturedError = new Error();
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const stream = newWriteableStream<Uint8Array>(data => BinaryBuffer.concat(data.map(data => BinaryBuffer.wrap(data))).buffer);
this.server.readFileStream(resource.toString(), opts, token).then(streamHandle => {
if (token.isCancellationRequested) {
Expand Down
2 changes: 1 addition & 1 deletion packages/filesystem/src/node/disk-file-system-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// based on https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/platform/files/node/diskFileSystemProvider.ts

/* eslint-disable no-null/no-null */
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/no-shadow */

import { injectable, inject, postConstruct } from 'inversify';
import { basename, dirname, normalize, join } from 'path';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
}

this.terminatingPluginServer = true;
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const cp = this.childProcess;
this.childProcess = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

/* eslint-disable max-len */
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/tslint/config */

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/node/debug/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class DebugExtImpl implements DebugExt {
providers.add(provider);

return Disposable.create(() => {
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
const providers = this.configurationProviders.get(debugType);
if (providers) {
providers.delete(provider);
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ export enum CompletionItemKind {
Enum = 12,
Keyword = 13,
Snippet = 14,
Color = 15, // eslint-disable-line no-shadow
Color = 15, // eslint-disable-line @typescript-eslint/no-shadow
File = 16,
Reference = 17,
Folder = 18,
Expand Down Expand Up @@ -2301,9 +2301,9 @@ export class SemanticTokensBuilder {
let prevLine = 0;
let prevChar = 0;
for (let i = 0; i < tokenCount; i++) {
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
let line = this._data[5 * i];
// eslint-disable-next-line no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
let char = this._data[5 * i + 1];

if (line === 0) {
Expand Down
Loading

0 comments on commit 93706a3

Please sign in to comment.