Skip to content

Commit 752e0f7

Browse files
committed
Add eslint/prettier, run lint:fix on repo
1 parent a59151a commit 752e0f7

23 files changed

+1129
-2239
lines changed

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
2+
3+
module.exports = [eslintPluginPrettierRecommended];

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
if (process.env.NEW_RELIC_APP_NAME) {
2-
console.log("Starting New Relic");
3-
require("newrelic");
2+
console.log("Starting New Relic");
3+
require("newrelic");
44
}
55

6-
const app = require('./src/app');
7-
const config = require('./src/config');
8-
const logger = require('./src/logger');
6+
const app = require("./src/app");
7+
const config = require("./src/config");
8+
const logger = require("./src/logger");
99

1010
app.listen(config.port, () => {
1111
console.log(`Listening on ${config.port}`);

knexfile.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module.exports = {
22
development: {
3-
client: 'postgresql',
3+
client: "postgresql",
44
connection: {
5-
user: process.env.POSTGRES_USER || 'postgres',
6-
password: process.env.POSTGRES_PASSWORD || '123abc',
7-
database: process.env.POSTGRES_DATABASE || 'analytics-reporter',
8-
}
5+
user: process.env.POSTGRES_USER || "postgres",
6+
password: process.env.POSTGRES_PASSWORD || "123abc",
7+
database: process.env.POSTGRES_DATABASE || "analytics-reporter",
8+
},
99
},
1010
production: {
11-
client: 'postgresql',
11+
client: "postgresql",
1212
connection: {
1313
host: process.env.POSTGRES_HOST,
1414
user: process.env.POSTGRES_USER,
@@ -17,20 +17,20 @@ module.exports = {
1717
},
1818
pool: {
1919
min: 2,
20-
max: 10
20+
max: 10,
2121
},
2222
migrations: {
23-
tableName: 'knex_migrations'
24-
}
23+
tableName: "knex_migrations",
24+
},
2525
},
2626
test: {
27-
client: 'postgresql',
27+
client: "postgresql",
2828
connection: {
29-
user: process.env.CIRCLECI ? 'postgres' : undefined,
30-
database: 'analytics-api-test'
29+
user: process.env.CIRCLECI ? "postgres" : undefined,
30+
database: "analytics-api-test",
3131
},
3232
migrations: {
33-
tableName: 'knex_migrations'
34-
}
35-
}
33+
tableName: "knex_migrations",
34+
},
35+
},
3636
};
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
exports.up = function(knex) {
2-
return knex.schema.createTable("analytics_data", table => {
3-
table.increments("id")
4-
table.string("report_name")
5-
table.string("report_agency")
6-
table.dateTime("date_time")
7-
table.jsonb("data")
8-
table.timestamps(true, true)
9-
})
1+
exports.up = function (knex) {
2+
return knex.schema.createTable("analytics_data", (table) => {
3+
table.increments("id");
4+
table.string("report_name");
5+
table.string("report_agency");
6+
table.dateTime("date_time");
7+
table.jsonb("data");
8+
table.timestamps(true, true);
9+
});
1010
};
1111

12-
exports.down = function(knex) {
13-
return knex.schema.dropTable('analytics_data')
12+
exports.down = function (knex) {
13+
return knex.schema.dropTable("analytics_data");
1414
};
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
exports.up = function(knex) {
2-
return knex.schema.table("analytics_data", table => {
3-
table.index(["report_name", "report_agency"])
4-
}).then(() => {
5-
return knex.schema.raw("CREATE INDEX analytics_data_date_time_desc ON analytics_data (date_time DESC NULLS LAST)")
6-
})
1+
exports.up = function (knex) {
2+
return knex.schema
3+
.table("analytics_data", (table) => {
4+
table.index(["report_name", "report_agency"]);
5+
})
6+
.then(() => {
7+
return knex.schema.raw(
8+
"CREATE INDEX analytics_data_date_time_desc ON analytics_data (date_time DESC NULLS LAST)",
9+
);
10+
});
711
};
812

9-
exports.down = function(knex, Promise) {
10-
return knex.schema.table("analytics_data", table => {
11-
table.dropIndex(["report_name", "report_agency"])
12-
table.dropIndex("date_time", "analytics_data_date_time_desc")
13-
})
13+
exports.down = function (knex, Promise) {
14+
return knex.schema.table("analytics_data", (table) => {
15+
table.dropIndex(["report_name", "report_agency"]);
16+
table.dropIndex("date_time", "analytics_data_date_time_desc");
17+
});
1418
};
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
2-
exports.up = function(knex, Promise) {
3-
return knex.schema.raw("ALTER TABLE analytics_data RENAME COLUMN date_time TO date").then(() => {
4-
return knex.schema.raw("ALTER TABLE analytics_data ALTER COLUMN date TYPE date")
5-
})
1+
exports.up = function (knex, Promise) {
2+
return knex.schema
3+
.raw("ALTER TABLE analytics_data RENAME COLUMN date_time TO date")
4+
.then(() => {
5+
return knex.schema.raw(
6+
"ALTER TABLE analytics_data ALTER COLUMN date TYPE date",
7+
);
8+
});
69
};
710

8-
exports.down = function(knex, Promise) {
9-
return knex.schema.raw("ALTER TABLE analytics_data RENAME COLUMN date TO date_time").then(() => {
10-
return knex.schema.raw("ALTER TABLE analytics_data ALTER COLUMN date_time TYPE timestamp with time zone")
11-
})
11+
exports.down = function (knex, Promise) {
12+
return knex.schema
13+
.raw("ALTER TABLE analytics_data RENAME COLUMN date TO date_time")
14+
.then(() => {
15+
return knex.schema.raw(
16+
"ALTER TABLE analytics_data ALTER COLUMN date_time TYPE timestamp with time zone",
17+
);
18+
});
1219
};
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
exports.up = function(knex) {
2-
return knex.schema.raw("CREATE INDEX analytics_data_date_desc_id_asc ON analytics_data (date DESC NULLS LAST, id ASC)")
3-
};
4-
5-
exports.down = function(knex, Promise) {
6-
return knex.schema.table("analytics_data", table => {
7-
table.dropIndex("analytics_data_date_desc_id_asc")
8-
})
9-
};
10-
1+
exports.up = function (knex) {
2+
return knex.schema.raw(
3+
"CREATE INDEX analytics_data_date_desc_id_asc ON analytics_data (date DESC NULLS LAST, id ASC)",
4+
);
5+
};
6+
7+
exports.down = function (knex, Promise) {
8+
return knex.schema.table("analytics_data", (table) => {
9+
table.dropIndex("analytics_data_date_desc_id_asc");
10+
});
11+
};
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
exports.up = function(knex) {
2-
return knex.schema.createTable("analytics_data_ga4", table => {
3-
table.increments("id")
4-
table.string("report_name")
5-
table.string("report_agency")
6-
table.dateTime("date")
7-
table.jsonb("data")
8-
table.timestamps(true, true)
9-
table.string("version")
10-
})
1+
exports.up = function (knex) {
2+
return knex.schema.createTable("analytics_data_ga4", (table) => {
3+
table.increments("id");
4+
table.string("report_name");
5+
table.string("report_agency");
6+
table.dateTime("date");
7+
table.jsonb("data");
8+
table.timestamps(true, true);
9+
table.string("version");
10+
});
1111
};
1212

13-
exports.down = function(knex) {
14-
return knex.schema.dropTable('analytics_data_ga4')
13+
exports.down = function (knex) {
14+
return knex.schema.dropTable("analytics_data_ga4");
1515
};

migrations/20240130203237_rename_date_time_to_date_ga4.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
* @param { import("knex").Knex } knex
33
* @returns { Promise<void> }
44
*/
5-
exports.up = function(knex) {
6-
return knex.schema.raw("ALTER TABLE analytics_data_ga4 ALTER COLUMN date TYPE date")
5+
exports.up = function (knex) {
6+
return knex.schema.raw(
7+
"ALTER TABLE analytics_data_ga4 ALTER COLUMN date TYPE date",
8+
);
79
};
810

911
/**
1012
* @param { import("knex").Knex } knex
1113
* @returns { Promise<void> }
1214
*/
13-
exports.down = function(knex) {
14-
return knex.schema.raw("ALTER TABLE analytics_data_ga4 ALTER COLUMN date TYPE timestamp with time zone")
15+
exports.down = function (knex) {
16+
return knex.schema.raw(
17+
"ALTER TABLE analytics_data_ga4 ALTER COLUMN date TYPE timestamp with time zone",
18+
);
1519
};

migrations/20240130203849_remove_version_col_ga4.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
* @param { import("knex").Knex } knex
33
* @returns { Promise<void> }
44
*/
5-
exports.up = function(knex) {
6-
return knex.schema.table("analytics_data_ga4", table => {
7-
table.dropColumn('version')
8-
})
5+
exports.up = function (knex) {
6+
return knex.schema.table("analytics_data_ga4", (table) => {
7+
table.dropColumn("version");
8+
});
99
};
1010

1111
/**
1212
* @param { import("knex").Knex } knex
1313
* @returns { Promise<void> }
1414
*/
15-
exports.down = function(knex) {
16-
return knex.schema.table("analytics_data_ga4", table => {
17-
table.string('version')
18-
})
15+
exports.down = function (knex) {
16+
return knex.schema.table("analytics_data_ga4", (table) => {
17+
table.string("version");
18+
});
1919
};

0 commit comments

Comments
 (0)