diff --git a/.eslintrc.js b/.eslintrc.js index ff5e381c5e..fae4a63321 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,26 @@ module.exports = { { exceptAfterSingleLine: true, exceptAfterOverload: true }, ], '@typescript-eslint/member-ordering': 'error', + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'variableLike', + format: ['camelCase', 'PascalCase', 'UPPER_CASE'], + leadingUnderscore: 'allow', + }, + { + selector: 'enumMember', + format: ['PascalCase'], + }, + { + selector: 'function', + format: ['camelCase', 'PascalCase'], + }, + { + selector: 'typeLike', + format: ['PascalCase'], + }, + ], 'no-empty-function': 'off', '@typescript-eslint/no-empty-function': [ 'error', diff --git a/lib/papi-dts/papi.d.ts b/lib/papi-dts/papi.d.ts index 424dfda3c2..79c2e0588d 100644 --- a/lib/papi-dts/papi.d.ts +++ b/lib/papi-dts/papi.d.ts @@ -250,7 +250,7 @@ declare module 'shared/utils/papi-util' { * papiUtil is a collection of functions, objects, and types that are used as helpers in other services. * Extensions should not use or rely on anything in papiUtil unless some other service requires it. */ - export type moduleSummaryComments = {}; + export type ModuleSummaryComments = {}; } declare module 'shared/models/papi-event.model' { import { Unsubscriber, UnsubscriberAsync } from 'shared/utils/papi-util'; @@ -1663,7 +1663,7 @@ declare module 'shared/services/command.service' { * You can register a command that other services and extensions can send you. * You can send commands to other services and extensions that have registered commands. */ - export type moduleSummaryComments = {}; + export type ModuleSummaryComments = {}; } declare module 'shared/data/web-view.model' { import { ReactNode } from 'react'; diff --git a/src/shared/services/command.service.ts b/src/shared/services/command.service.ts index f1b9887cb6..09477f0bfd 100644 --- a/src/shared/services/command.service.ts +++ b/src/shared/services/command.service.ts @@ -179,4 +179,4 @@ export const registerCommand: ( * You can register a command that other services and extensions can send you. * You can send commands to other services and extensions that have registered commands. */ -export type moduleSummaryComments = {}; +export type ModuleSummaryComments = {}; diff --git a/src/shared/services/logger.service.ts b/src/shared/services/logger.service.ts index e08034059e..fc398f04cc 100644 --- a/src/shared/services/logger.service.ts +++ b/src/shared/services/logger.service.ts @@ -7,7 +7,7 @@ export const WARN_TAG = ''; /** * Represents details that can be parsed from a single line of an Error object */ -type parsedErrorLine = +type ParsedErrorLine = | { functionName: string; fileName: string; @@ -22,7 +22,7 @@ type parsedErrorLine = * @returns Object containing the function name, file name, line number, and column number from the * line of the Error object string. If the line couldn't be parsed, then undefined. */ -function parseErrorLine(errorLine: string): parsedErrorLine { +function parseErrorLine(errorLine: string): ParsedErrorLine { // A few example lines to parse: // " at functionName (filename.js:15:27)" // "at /home/username/paranext-core/src/shared/services/logger.service.ts:119:22" @@ -65,7 +65,7 @@ function parseErrorLine(errorLine: string): parsedErrorLine { function identifyCaller(): string | undefined { const { stack } = new Error(); if (!stack) return undefined; - let details: parsedErrorLine; + let details: ParsedErrorLine; const lines = stack.split('\n'); // Start at 3 to skip the "Error" line, this function's stack frame, and this function's caller for (let lineNumber = 3; lineNumber < lines.length; lineNumber += 1) { diff --git a/src/shared/utils/papi-util.ts b/src/shared/utils/papi-util.ts index cf914920c2..e968ef76b0 100644 --- a/src/shared/utils/papi-util.ts +++ b/src/shared/utils/papi-util.ts @@ -210,4 +210,4 @@ export function getModuleSimilarApiMessage(moduleName: string) { * papiUtil is a collection of functions, objects, and types that are used as helpers in other services. * Extensions should not use or rely on anything in papiUtil unless some other service requires it. */ -export type moduleSummaryComments = {}; +export type ModuleSummaryComments = {};