Skip to content

Commit

Permalink
enable @typescript-eslint/member-delimiter-style, #140391
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Feb 2, 2022
1 parent 5abc4e0 commit 4a130c4
Show file tree
Hide file tree
Showing 954 changed files with 3,017 additions and 3,016 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"jsdoc/no-types": "warn",
"semi": "off",
"@typescript-eslint/semi": "warn",
"@typescript-eslint/member-delimiter-style": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface OSSProduct {
}

interface Product {
readonly builtInExtensions?: IBuiltInExtension[] | { 'include'?: IBuiltInExtension[], 'exclude'?: string[] };
readonly builtInExtensions?: IBuiltInExtension[] | { 'include'?: IBuiltInExtension[]; 'exclude'?: string[] };
readonly webBuiltInExtensions?: IBuiltInExtension[];
}

Expand Down
6 changes: 3 additions & 3 deletions build/azure-pipelines/upload-nlsmetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const commit = util.getVersion(root);
const credential = new ClientSecretCredential(process.env['AZURE_TENANT_ID']!, process.env['AZURE_CLIENT_ID']!, process.env['AZURE_CLIENT_SECRET']!);

interface NlsMetadata {
keys: { [module: string]: string },
messages: { [module: string]: string },
bundles: { [bundle: string]: string[] },
keys: { [module: string]: string };
messages: { [module: string]: string };
bundles: { [bundle: string]: string[] };
}

function main(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/upload-sourcemaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function main(): Promise<void> {
const vs = src('out-vscode-min'); // client source-maps only
sources.push(vs);

const productionDependencies: { name: string, path: string, version: string }[] = deps.getProductionDependencies(root);
const productionDependencies: { name: string; path: string; version: string }[] = deps.getProductionDependencies(root);
const productionDependenciesSrc = productionDependencies.map(d => path.relative(root, d.path)).map(d => `./${d}/**/*.map`);
const nodeModules = vfs.src(productionDependenciesSrc, { base: '.' })
.pipe(util.cleanNodeModules(path.join(root, 'build', '.moduleignore')));
Expand Down
6 changes: 3 additions & 3 deletions build/lib/asar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare class AsarFilesystem {
readonly header: unknown;
constructor(src: string);
insertDirectory(path: string, shouldUnpack?: boolean): unknown;
insertFile(path: string, shouldUnpack: boolean, file: { stat: { size: number; mode: number; }; }, options: {}): Promise<void>;
insertFile(path: string, shouldUnpack: boolean, file: { stat: { size: number; mode: number } }, options: {}): Promise<void>;
}

export function createAsar(folderPath: string, unpackGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
Expand All @@ -38,7 +38,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
let onFileInserted = () => { pendingInserts--; };

// Do not insert twice the same directory
const seenDir: { [key: string]: boolean; } = {};
const seenDir: { [key: string]: boolean } = {};
const insertDirectoryRecursive = (dir: string) => {
if (seenDir[dir]) {
return;
Expand All @@ -65,7 +65,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
}
};

const insertFile = (relativePath: string, stat: { size: number; mode: number; }, shouldUnpack: boolean) => {
const insertFile = (relativePath: string, stat: { size: number; mode: number }, shouldUnpack: boolean) => {
insertDirectoryForFile(relativePath);
pendingInserts++;
// Do not pass `onFileInserted` directly because it gets overwritten below.
Expand Down
2 changes: 1 addition & 1 deletion build/lib/builtInExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface IExtensionDefinition {
flags: string;
};
publisherDisplayName: string;
}
};
}

const root = path.dirname(path.dirname(__dirname));
Expand Down
2 changes: 1 addition & 1 deletion build/lib/builtInExtensionsCG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function downloadExtensionDetails(extension: IExtensionDefinition): Promis

const promises = [];
for (const fileName of contentFileNames) {
promises.push(new Promise<{ fileName: string, body: Buffer | undefined | null }>(resolve => {
promises.push(new Promise<{ fileName: string; body: Buffer | undefined | null }>(resolve => {
got(`${repositoryContentBaseUrl}/${fileName}`)
.then(response => {
resolve({ fileName, body: response.rawBody });
Expand Down
12 changes: 6 additions & 6 deletions build/lib/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface IConcatFile {

export interface IBundleData {
graph: IGraph;
bundles: { [moduleId: string]: string[]; };
bundles: { [moduleId: string]: string[] };
}

export interface IBundleResult {
Expand All @@ -91,7 +91,7 @@ interface IPartialBundleResult {

export interface ILoaderConfig {
isBuild?: boolean;
paths?: { [path: string]: any; };
paths?: { [path: string]: any };
}

/**
Expand All @@ -106,7 +106,7 @@ export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callba
entryPointsMap[module.name] = module;
});

const allMentionedModulesMap: { [modules: string]: boolean; } = {};
const allMentionedModulesMap: { [modules: string]: boolean } = {};
entryPoints.forEach((module: IEntryPoint) => {
allMentionedModulesMap[module.name] = true;
(module.include || []).forEach(function (includedModule) {
Expand Down Expand Up @@ -283,7 +283,7 @@ function extractStrings(destFiles: IConcatFile[]): IConcatFile[] {
}

// Do one pass to record the usage counts for each module id
const useCounts: { [moduleId: string]: number; } = {};
const useCounts: { [moduleId: string]: number } = {};
destFile.sources.forEach((source) => {
const matches = source.contents.match(/define\(("[^"]+"),\s*\[(((, )?("|')[^"']+("|'))+)\]/);
if (!matches) {
Expand All @@ -302,7 +302,7 @@ function extractStrings(destFiles: IConcatFile[]): IConcatFile[] {
return useCounts[b] - useCounts[a];
});

const replacementMap: { [moduleId: string]: number; } = {};
const replacementMap: { [moduleId: string]: number } = {};
sortedByUseModules.forEach((module, index) => {
replacementMap[module] = index;
});
Expand Down Expand Up @@ -599,7 +599,7 @@ function visit(rootNodes: string[], graph: IGraph): INodeSet {
function topologicalSort(graph: IGraph): string[] {

const allNodes: INodeSet = {},
outgoingEdgeCount: { [node: string]: number; } = {},
outgoingEdgeCount: { [node: string]: number } = {},
inverseEdges: IGraph = {};

Object.keys(graph).forEach((fromNode: string) => {
Expand Down
2 changes: 1 addition & 1 deletion build/lib/compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class MonacoGenerator {
private readonly _isWatch: boolean;
public readonly stream: NodeJS.ReadWriteStream;

private readonly _watchedFiles: { [filePath: string]: boolean; };
private readonly _watchedFiles: { [filePath: string]: boolean };
private readonly _fsProvider: monacodts.FSProvider;
private readonly _declarationResolver: monacodts.DeclarationResolver;

Expand Down
10 changes: 5 additions & 5 deletions build/lib/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import * as util from './util';

type DarwinDocumentSuffix = 'document' | 'script' | 'file' | 'source code';
type DarwinDocumentType = {
name: string,
role: string,
ostypes: string[],
extensions: string[],
iconFile: string,
name: string;
role: string;
ostypes: string[];
extensions: string[];
iconFile: string;
};

function isDocumentSuffix(str?: string): str is DarwinDocumentSuffix {
Expand Down
2 changes: 1 addition & 1 deletion build/lib/eslint/code-no-unexternalized-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {

create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

const externalizedStringLiterals = new Map<string, { call: TSESTree.CallExpression, message: TSESTree.Node }[]>();
const externalizedStringLiterals = new Map<string, { call: TSESTree.CallExpression; message: TSESTree.Node }[]>();
const doubleQuotedStringLiterals = new Set<TSESTree.Node>();

function collectDoubleQuotedStrings(node: TSESTree.Literal) {
Expand Down
2 changes: 1 addition & 1 deletion build/lib/eslint/vscode-dts-event-naming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {

create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {

const config = <{ allowed: string[], verbs: string[] }>context.options[0];
const config = <{ allowed: string[]; verbs: string[] }>context.options[0];
const allowed = new Set(config.allowed);
const verbs = new Set(config.verbs);

Expand Down
6 changes: 3 additions & 3 deletions build/lib/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[]

export function translatePackageJSON(packageJSON: string, packageNLSPath: string) {
interface NLSFormat {
[key: string]: string | { message: string, comment: string[] };
[key: string]: string | { message: string; comment: string[] };
}
const CharCode_PC = '%'.charCodeAt(0);
const packageNls: NLSFormat = JSON.parse(fs.readFileSync(packageNLSPath).toString());
Expand Down Expand Up @@ -446,7 +446,7 @@ const esbuildMediaScripts = [
'markdown-math/esbuild.js',
];

export async function webpackExtensions(taskName: string, isWatch: boolean, webpackConfigLocations: { configPath: string, outputRoot?: string }[]) {
export async function webpackExtensions(taskName: string, isWatch: boolean, webpackConfigLocations: { configPath: string; outputRoot?: string }[]) {
const webpack = require('webpack') as typeof import('webpack');

const webpackConfigs: webpack.Configuration[] = [];
Expand Down Expand Up @@ -515,7 +515,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
});
}

async function esbuildExtensions(taskName: string, isWatch: boolean, scripts: { script: string, outputRoot?: string }[]) {
async function esbuildExtensions(taskName: string, isWatch: boolean, scripts: { script: string; outputRoot?: string }[]) {
function reporter(stdError: string, script: string) {
const matches = (stdError || '').match(/\> (.+): error: (.+)?/g);
fancyLog(`Finished ${ansiColors.green(taskName)} ${script} with ${matches ? matches.length : 0} errors.`);
Expand Down
4 changes: 2 additions & 2 deletions build/lib/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class XLF {
static parsePseudo = function (xlfString: string): Promise<ParsedXLF[]> {
return new Promise((resolve) => {
let parser = new xml2js.Parser();
let files: { messages: Map<string>, originalFilePath: string, language: string }[] = [];
let files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];
parser.parseString(xlfString, function (_err: any, result: any) {
const fileNodes: any[] = result['xliff']['file'];
fileNodes.forEach(file => {
Expand All @@ -304,7 +304,7 @@ export class XLF {
return new Promise((resolve, reject) => {
let parser = new xml2js.Parser();

let files: { messages: Map<string>, originalFilePath: string, language: string }[] = [];
let files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];

parser.parseString(xlfString, function (err: any, result: any) {
if (err) {
Expand Down
10 changes: 5 additions & 5 deletions build/lib/monaco-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function getTopLevelDeclaration(ts: typeof import('typescript'), sourceFile: ts.
}


function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number; }): string {
function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number }): string {
return sourceFile.getFullText().substring(node.pos, node.end);
}

Expand Down Expand Up @@ -461,7 +461,7 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
let replacer = createReplacer(m2[2]);

let typeNames = m2[3].split(/,/);
let typesToExcludeMap: { [typeName: string]: boolean; } = {};
let typesToExcludeMap: { [typeName: string]: boolean } = {};
let typesToExcludeArr: string[] = [];
typeNames.forEach((typeName) => {
typeName = typeName.trim();
Expand Down Expand Up @@ -599,7 +599,7 @@ class CacheEntry {
export class DeclarationResolver {

public readonly ts: typeof import('typescript');
private _sourceFileCache: { [moduleId: string]: CacheEntry | null; };
private _sourceFileCache: { [moduleId: string]: CacheEntry | null };

constructor(private readonly _fsProvider: FSProvider) {
this.ts = require('typescript') as typeof import('typescript');
Expand Down Expand Up @@ -667,8 +667,8 @@ export function run3(resolver: DeclarationResolver): IMonacoDeclarationResult |



interface ILibMap { [libName: string]: string; }
interface IFileMap { [fileName: string]: string; }
interface ILibMap { [libName: string]: string }
interface IFileMap { [fileName: string]: string }

class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost {

Expand Down
6 changes: 3 additions & 3 deletions build/lib/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as tss from './treeshaking';
const REPO_ROOT = path.join(__dirname, '../../');
const SRC_DIR = path.join(REPO_ROOT, 'src');

let dirCache: { [dir: string]: boolean; } = {};
let dirCache: { [dir: string]: boolean } = {};

function writeFile(filePath: string, contents: Buffer | string): void {
function ensureDirs(dirPath: string): void {
Expand Down Expand Up @@ -69,7 +69,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
writeFile(path.join(options.destRoot, fileName), result[fileName]);
}
}
let copied: { [fileName: string]: boolean; } = {};
let copied: { [fileName: string]: boolean } = {};
const copyFile = (fileName: string) => {
if (copied[fileName]) {
return;
Expand Down Expand Up @@ -131,7 +131,7 @@ export interface IOptions2 {
outFolder: string;
outResourcesFolder: string;
ignores: string[];
renames: { [filename: string]: string; };
renames: { [filename: string]: string };
}

export function createESMSourcesAndResources2(options: IOptions2): void {
Expand Down
8 changes: 4 additions & 4 deletions build/lib/treeshaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface ITreeShakingOptions {
*/
importIgnorePattern: RegExp;

redirects: { [module: string]: string; };
redirects: { [module: string]: string };
}

export interface ITreeShakingResult {
Expand Down Expand Up @@ -140,7 +140,7 @@ function createTypeScriptLanguageService(ts: typeof import('typescript'), option
function discoverAndReadFiles(ts: typeof import('typescript'), options: ITreeShakingOptions): IFileMap {
const FILES: IFileMap = {};

const in_queue: { [module: string]: boolean; } = Object.create(null);
const in_queue: { [module: string]: boolean } = Object.create(null);
const queue: string[] = [];

const enqueue = (moduleId: string) => {
Expand Down Expand Up @@ -225,8 +225,8 @@ function processLibFiles(ts: typeof import('typescript'), options: ITreeShakingO
return result;
}

interface ILibMap { [libName: string]: string; }
interface IFileMap { [fileName: string]: string; }
interface ILibMap { [libName: string]: string }
interface IFileMap { [fileName: string]: string }

/**
* A TypeScript language service host
Expand Down
4 changes: 2 additions & 2 deletions build/lib/watch/watch-win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ function watch(root: string): Stream {
return result;
}

const cache: { [cwd: string]: Stream; } = Object.create(null);
const cache: { [cwd: string]: Stream } = Object.create(null);

module.exports = function (pattern: string | string[] | filter.FileFunction, options?: { cwd?: string; base?: string; }) {
module.exports = function (pattern: string | string[] | filter.FileFunction, options?: { cwd?: string; base?: string }) {
options = options || {};

const cwd = path.normalize(options.cwd || process.cwd());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ vscode.languages.registerDocumentSymbolProvider({ pattern: '**/launch.json', lan
}, { label: 'Launch Targets' });

function registerContextKeyCompletions(): vscode.Disposable {
type ContextKeyInfo = { key: string, type?: string, description?: string };
type ContextKeyInfo = { key: string; type?: string; description?: string };

const paths = new Map<vscode.DocumentFilter, JSONPath[]>([
[{ language: 'jsonc', pattern: '**/keybindings.json' }, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class SettingsDocument {
return item;
}

private newSnippetCompletionItem(o: { label: string; documentation?: string; snippet: string; range: vscode.Range; }): vscode.CompletionItem {
private newSnippetCompletionItem(o: { label: string; documentation?: string; snippet: string; range: vscode.Range }): vscode.CompletionItem {
const item = new vscode.CompletionItem(o.label);
item.kind = vscode.CompletionItemKind.Value;
item.documentation = o.documentation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare const Worker: {
new(stringUrl: string): any;
};
declare const TextDecoder: {
new(encoding?: string): { decode(buffer: ArrayBuffer): string; };
new(encoding?: string): { decode(buffer: ArrayBuffer): string };
};

// this method is called when vs code is activated
Expand Down
2 changes: 1 addition & 1 deletion extensions/css-language-features/client/src/cssClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const localize = nls.loadMessageBundle();
export type LanguageClientConstructor = (name: string, description: string, clientOptions: LanguageClientOptions) => CommonLanguageClient;

export interface Runtime {
TextDecoder: { new(encoding?: string): { decode(buffer: ArrayBuffer): string; } };
TextDecoder: { new(encoding?: string): { decode(buffer: ArrayBuffer): string } };
fs?: RequestService;
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/css-language-features/client/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RequestType, CommonLanguageClient } from 'vscode-languageclient';
import { Runtime } from './cssClient';

export namespace FsContentRequest {
export const type: RequestType<{ uri: string; encoding?: string; }, string, any> = new RequestType('fs/content');
export const type: RequestType<{ uri: string; encoding?: string }, string, any> = new RequestType('fs/content');
}
export namespace FsStatRequest {
export const type: RequestType<string, FileStat, any> = new RequestType('fs/stat');
Expand All @@ -19,7 +19,7 @@ export namespace FsReadDirRequest {
}

export function serveFileSystemRequests(client: CommonLanguageClient, runtime: Runtime) {
client.onRequest(FsContentRequest.type, (param: { uri: string; encoding?: string; }) => {
client.onRequest(FsContentRequest.type, (param: { uri: string; encoding?: string }) => {
const uri = Uri.parse(param.uri);
if (uri.scheme === 'file' && runtime.fs) {
return runtime.fs.getContent(param.uri);
Expand Down
2 changes: 1 addition & 1 deletion extensions/css-language-features/server/src/cssServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface RuntimeEnvironment {
readonly timer: {
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable;
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
}
};
}

export function startServer(connection: Connection, runtime: RuntimeEnvironment) {
Expand Down
Loading

0 comments on commit 4a130c4

Please sign in to comment.