Skip to content

Commit

Permalink
feat: use explicit-member-accessibility #557 (#558)
Browse files Browse the repository at this point in the history
* feat: use `explicit-member-accessibility` #557

* fix: fix lint errors
  • Loading branch information
Robot-Inventor authored Mar 15, 2024
1 parent b706013 commit 9655345
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
}
],
"no-new": "off",
"@typescript-eslint/explicit-function-return-type": "error"
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/explicit-member-accessibility": "error"
}
}
4 changes: 2 additions & 2 deletions src/ts/common/translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Translator {
* @param translationFunction translation function to use
* @param twemojiEndpoint endpoint URL of Twemoji
*/
constructor(translationFunction: TranslationFunction, twemojiEndpoint: string) {
public constructor(translationFunction: TranslationFunction, twemojiEndpoint: string) {
this.translationFunction = translationFunction;
this.twemojiEndpoint = twemojiEndpoint;
}
Expand All @@ -43,7 +43,7 @@ class Translator {
/**
* Run the translation process.
*/
translateElements(): void {
public translateElements(): void {
const targetElements = [...document.querySelectorAll(`[${TRANSLATION_ATTRIBUTE}]`)];

const shadowTargets = document.querySelectorAll<SbsMessage>(`sbs-message[${SHADOW_TRANSLATION_ATTRIBUTE}]`);
Expand Down
2 changes: 1 addition & 1 deletion src/ts/components/sbsMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class SbsMessage extends LitElement {
this.dispatchEvent(newEvent);
}

override firstUpdated(_changedProperties: PropertyValues): void {
public override firstUpdated(_changedProperties: PropertyValues): void {
if (this.onRenderedCallback) {
this.onRenderedCallback();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ts/components/settingsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SettingsItem extends LitElement {
@query("md-checkbox")
private checkbox!: MdCheckbox;

static styles = css`
public static styles = css`
.settings-item {
display: flex;
flex-direction: row;
Expand Down
2 changes: 1 addition & 1 deletion src/ts/components/settingsSeparator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { customElement } from "lit/decorators.js";

@customElement("settings-separator")
class SettingsSeparator extends LitElement {
static styles = css`
public static styles = css`
.settings-separator {
--left-line-width: 0.75rem;
Expand Down
2 changes: 1 addition & 1 deletion src/ts/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Core {
* @param settings settings
* @param onMessageCallback callback function called when the new message is inserted.
*/
constructor(settings: Settings, onMessageCallback: () => void) {
public constructor(settings: Settings, onMessageCallback: () => void) {
this.settings = settings;
this.onMessageCallback = onMessageCallback;

Expand Down
2 changes: 1 addition & 1 deletion src/ts/core/parser/parserBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ParserBase {
* Parse the React props.
* @param element element to parse
*/
constructor(element: HTMLElement) {
public constructor(element: HTMLElement) {
this.sourceElement = element;
[this.reactPropsName] = Object.getOwnPropertyNames(element).filter((name) => name.startsWith("__reactProps$"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/ts/core/parser/tweetParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TweetParser extends ParserBase {
* Parse the React props of the tweet.
* @param tweet element of the tweet
*/
constructor(tweet: HTMLElement) {
public constructor(tweet: HTMLElement) {
super(tweet);

const menuBar = this.getMenuBar();
Expand Down
2 changes: 1 addition & 1 deletion src/ts/core/sbsMessageWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SbsMessageWrapper {
private readonly tweetText?: string;

// eslint-disable-next-line max-statements
constructor(options: SbsMessageWrapperOptionsForTweets | SbsMessageWrapperOptionsForProfiles) {
public constructor(options: SbsMessageWrapperOptionsForTweets | SbsMessageWrapperOptionsForProfiles) {
const sbsMessage = document.createElement("sbs-message");

sbsMessage.textColor = SbsMessageWrapper.getTextColor();
Expand Down
2 changes: 1 addition & 1 deletion src/ts/userScript/userScriptBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DEFAULT_SETTINGS } from "../common/defaultSettings";
* Base class of the user script.
*/
class UserScriptBase {
constructor(translationData: TranslationData) {
public constructor(translationData: TranslationData) {
const translator = new Translator((key, substitutions) => {
if (substitutions) {
const substitutionsArray = typeof substitutions === "string" ? [substitutions] : substitutions;
Expand Down

0 comments on commit 9655345

Please sign in to comment.