Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded prettier from version 2.8,8 to 3.2.5. #1840

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"graphql-markdown": "^7.0.0",
"husky": "^9.0.6",
"lint-staged": "^15.2.2",
"prettier": "^2.7.1",
"prettier": "3.2.5",
"rimraf": "^5.0.5",
"tsx": "^4.7.0",
"typescript": "^5.3.2",
Expand Down
44 changes: 22 additions & 22 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async function setNodeEnvironment(): Promise<void> {
*/
async function accessAndRefreshTokens(
accessTokenSecret: string | null,
refreshTokenSecret: string | null
refreshTokenSecret: string | null,
): Promise<void> {
const config = dotenv.parse(fs.readFileSync(".env"));

Expand Down Expand Up @@ -183,12 +183,12 @@ async function askForTransactionLogPath(): Promise<string> {
break;
} catch {
console.error(
"The file is not readable/writable. Please enter a valid file path."
"The file is not readable/writable. Please enter a valid file path.",
);
}
} else {
console.error(
"Invalid path or file does not exist. Please enter a valid file path."
"Invalid path or file does not exist. Please enter a valid file path.",
);
}
}
Expand Down Expand Up @@ -350,7 +350,7 @@ async function redisConfiguration(): Promise<void> {
*/
async function askForSuperAdminEmail(): Promise<string> {
console.log(
"\nPlease make sure to register with this email before logging in.\n"
"\nPlease make sure to register with this email before logging in.\n",
);
const { email } = await inquirer.prompt([
{
Expand Down Expand Up @@ -558,7 +558,7 @@ async function recaptcha(): Promise<void> {
async function recaptchaSiteKey(): Promise<void> {
if (process.env.RECAPTCHA_SITE_KEY) {
console.log(
`\nreCAPTCHA site key already exists with the value ${process.env.RECAPTCHA_SITE_KEY}`
`\nreCAPTCHA site key already exists with the value ${process.env.RECAPTCHA_SITE_KEY}`,
);
}

Expand Down Expand Up @@ -636,14 +636,14 @@ function abort(): void {
async function twoFactorAuth(): Promise<void> {
console.log("\nIMPORTANT");
console.log(
"\nEnsure that you have Two-Factor Authentication set up on your Google Account."
"\nEnsure that you have Two-Factor Authentication set up on your Google Account.",
);
console.log("\nVisit Url: https://myaccount.google.com");
console.log(
"\nSelect Security and under Signing in to Google section select App Passwords."
"\nSelect Security and under Signing in to Google section select App Passwords.",
);
console.log(
"\nClick on Select app section and choose Other(Custom name), enter talawa as the custom name and press Generate button."
"\nClick on Select app section and choose Other(Custom name), enter talawa as the custom name and press Generate button.",
);

const { email, password } = await inquirer.prompt([
Expand Down Expand Up @@ -741,7 +741,7 @@ async function importData(): Promise<void> {
abort();
}
console.log(`Output: ${stdout}`);
}
},
);
}
}
Expand All @@ -762,7 +762,7 @@ type VerifySmtpConnectionReturnType = {
* be `true` and the `error` property will be `null`. If the SMTP connection verification fails
*/
async function verifySmtpConnection(
config: Record<string, string>
config: Record<string, string>,
): Promise<VerifySmtpConnectionReturnType> {
const transporter = nodemailer.createTransport({
host: config.SMTP_HOST,
Expand Down Expand Up @@ -829,7 +829,7 @@ async function configureSmtp(): Promise<void> {

if (!isValidSmtpConfig) {
console.error(
"Invalid SMTP configuration. Please provide all required parameters."
"Invalid SMTP configuration. Please provide all required parameters.",
);
return;
}
Expand All @@ -838,7 +838,7 @@ async function configureSmtp(): Promise<void> {

if (!success) {
console.error(
"SMTP configuration verification failed. Please check your SMTP settings."
"SMTP configuration verification failed. Please check your SMTP settings.",
);
if (error instanceof Error) {
console.log(error.message);
Expand Down Expand Up @@ -876,7 +876,7 @@ async function main(): Promise<void> {
refreshToken: string | null = "";
if (process.env.ACCESS_TOKEN_SECRET) {
console.log(
`\nAccess token secret already exists with the value:\n${process.env.ACCESS_TOKEN_SECRET}`
`\nAccess token secret already exists with the value:\n${process.env.ACCESS_TOKEN_SECRET}`,
);
}
const { shouldGenerateAccessToken } = await inquirer.prompt({
Expand All @@ -892,7 +892,7 @@ async function main(): Promise<void> {

if (process.env.REFRESH_TOKEN_SECRET) {
console.log(
`\nRefresh token secret already exists with the value:\n${process.env.REFRESH_TOKEN_SECRET}`
`\nRefresh token secret already exists with the value:\n${process.env.REFRESH_TOKEN_SECRET}`,
);
}
const { shouldGenerateRefreshToken } = await inquirer.prompt({
Expand All @@ -918,7 +918,7 @@ async function main(): Promise<void> {
if (shouldLog) {
if (process.env.LOG_PATH) {
console.log(
`\n Log path already exists with the value:\n${process.env.LOG_PATH}`
`\n Log path already exists with the value:\n${process.env.LOG_PATH}`,
);
}
let logPath: string | null = null;
Expand Down Expand Up @@ -997,7 +997,7 @@ async function main(): Promise<void> {
// MongoDB configuration
if (process.env.MONGO_DB_URL) {
console.log(
`\nMongoDB URL already exists with the value:\n${process.env.MONGO_DB_URL}`
`\nMongoDB URL already exists with the value:\n${process.env.MONGO_DB_URL}`,
);

const { shouldSetupMongo } = await inquirer.prompt({
Expand All @@ -1016,7 +1016,7 @@ async function main(): Promise<void> {
}
if (process.env.RECAPTCHA_SECRET_KEY) {
console.log(
`\nreCAPTCHA secret key already exists with the value ${process.env.RECAPTCHA_SECRET_KEY}`
`\nreCAPTCHA secret key already exists with the value ${process.env.RECAPTCHA_SECRET_KEY}`,
);
}
const { shouldSetRecaptcha } = await inquirer.prompt({
Expand All @@ -1032,12 +1032,12 @@ async function main(): Promise<void> {
}

console.log(
"\n You can configure either SMTP or Mail for sending emails through Talawa.\n"
"\n You can configure either SMTP or Mail for sending emails through Talawa.\n",
);

if (process.env.MAIL_USERNAME) {
console.log(
`Mail username already exists with the value ${process.env.MAIL_USERNAME}`
`Mail username already exists with the value ${process.env.MAIL_USERNAME}`,
);
}

Expand Down Expand Up @@ -1070,7 +1070,7 @@ async function main(): Promise<void> {

if (process.env.LAST_RESORT_SUPERADMIN_EMAIL) {
console.log(
`\nSuper Admin of last resort already exists with the value ${process.env.LAST_RESORT_SUPERADMIN_EMAIL}`
`\nSuper Admin of last resort already exists with the value ${process.env.LAST_RESORT_SUPERADMIN_EMAIL}`,
);
}

Expand All @@ -1093,7 +1093,7 @@ async function main(): Promise<void> {
) {
if (process.env.MAIL_USERNAME) {
console.log(
"No super admin email configured, setting it to mail username's value."
"No super admin email configured, setting it to mail username's value.",
);
}
const config = dotenv.parse(fs.readFileSync(".env"));
Expand Down Expand Up @@ -1135,7 +1135,7 @@ async function main(): Promise<void> {
await setImageUploadSize(imageSizeLimit * 1000);

console.log(
"\nCongratulations! Talawa API has been successfully setup! 🥂🎉"
"\nCongratulations! Talawa API has been successfully setup! 🥂🎉",
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ app.use(
helmet({
contentSecurityPolicy:
process.env.NODE_ENV === "production" ? undefined : false,
})
}),
);
app.use(mongoSanitize());
app.use(cors());
Expand All @@ -81,8 +81,8 @@ app.use(
':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms',
{
stream: stream,
}
)
},
),
);

app.use("/images", express.static(path.join(__dirname, "./../images")));
Expand All @@ -97,7 +97,7 @@ app.get("/", (req, res) =>
res.json({
"talawa-version": "v1",
status: "healthy",
})
}),
);

export default app;
8 changes: 4 additions & 4 deletions src/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const logWarningForSuperAdminEnvVariable = async (): Promise<void> => {
if (isVariablePresentInEnvFile) {
logger.warn(
"\x1b[1m\x1b[33m%s\x1b[0m",
"The LAST_RESORT_SUPERADMIN_EMAIL variable configured in your .env file poses a security risk. We strongly recommend that you remove it if not required. Please refer to the documentation in the INSTALLATION.md file.You have created super admin, please remove the LAST_RESORT_SUPERADMIN_EMAIL variable from .env file if you don't require it"
"The LAST_RESORT_SUPERADMIN_EMAIL variable configured in your .env file poses a security risk. We strongly recommend that you remove it if not required. Please refer to the documentation in the INSTALLATION.md file.You have created super admin, please remove the LAST_RESORT_SUPERADMIN_EMAIL variable from .env file if you don't require it",
);
}
} else {
if (!isVariablePresentInEnvFile) {
logger.warn(
"\x1b[1m\x1b[33m%s\x1b[0m",
"To create your first Super Admin, the LAST_RESORT_SUPERADMIN_EMAIL parameter needs to be set in the .env file. Please refer to the documentation in the INSTALLATION.md file."
"To create your first Super Admin, the LAST_RESORT_SUPERADMIN_EMAIL parameter needs to be set in the .env file. Please refer to the documentation in the INSTALLATION.md file.",
);
}
}
Expand All @@ -28,12 +28,12 @@ export const logIssues = async (): Promise<void> => {
const issues = getEnvIssues();
if (issues) {
logger.error(
"Invalid environment variables found in your .env file, check the errors below!"
"Invalid environment variables found in your .env file, check the errors below!",
);
console.error(
generateErrorMessage(issues, {
delimiter: { error: "\\n" },
})
}),
);
} else {
logger.info("The environment variables are valid!");
Expand Down
4 changes: 2 additions & 2 deletions src/config/plugins/loadPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const loadPlugins = async (): Promise<void> => {
});
logger.info(
"\x1b[1m\x1b[32m%s\x1b[0m",
`Uploaded Plugins in ${databaseTitle} `
`Uploaded Plugins in ${databaseTitle} `,
);
} else {
//plugin data already present
logger.info(
"\x1b[1m\x1b[32m%s\x1b[0m",
`Plugin data already present at ${databaseTitle}`
`Plugin data already present at ${databaseTitle}`,
);
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ export const connect = async (): Promise<void> => {
logger.error("\n\n\n\x1b[1m\x1b[31m%s\x1b[0m", error);
logger.error(
"\n\n\x1b[1m\x1b[34m%s\x1b[0m",
`- Connection to MongoDB failed: There are several potential causes for this issue, including:`
`- Connection to MongoDB failed: There are several potential causes for this issue, including:`,
);
logger.error(
"\x1b[1m\x1b[33m%s\x1b[0m",
`- Unstable Network Connection`
`- Unstable Network Connection`,
);
logger.error("\x1b[1m\x1b[33m%s\x1b[0m", `- Invalid Connection String`);
logger.error(
"\x1b[1m\x1b[33m%s\x1b[0m",
`- MongoDB Server may not be running`
`- MongoDB Server may not be running`,
);
logger.error(
"\x1b[1m\x1b[33m%s\x1b[0m",
`- Firewall may not be configured to allow incoming connections on MongoDB port.`
`- Firewall may not be configured to allow incoming connections on MongoDB port.`,
);
logger.error(
"\x1b[1m\x1b[31m%s\x1b[0m",
`- Please try again with the fixes !`
`- Please try again with the fixes !`,
);
} else {
logger.error("Error while connecting to mongo database", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { errors, requestContext } from "../../libraries";
function authDirectiveTransformer(schema, directiveName): any {
return mapSchema(schema, {
[MapperKind.OBJECT_FIELD]: (
fieldConfig: GraphQLFieldConfig<any, any>
fieldConfig: GraphQLFieldConfig<any, any>,
): any => {
// Check whether this field has the specified directive
const authDirective = getDirective(
schema,
fieldConfig,
directiveName
directiveName,
)?.[0];
if (authDirective) {
//@ts-ignore
Expand All @@ -23,7 +23,7 @@ function authDirectiveTransformer(schema, directiveName): any {
throw new errors.UnauthenticatedError(
requestContext.translate("user.notAuthenticated"),
"user.notAuthenticated --auth directive",
"userAuthentication"
"userAuthentication",
);
return resolve(root, args, context, info);
};
Expand Down
Loading
Loading