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

Prettier as code formatter #835

Closed
wants to merge 7 commits into from
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": [
"warn",
2
],
"quotes": [
"error",
"single"
],
"semi": [
"warn",
"never"
],
"max-len": [
"error",
100
],
"prettier/prettier": ["warn"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": [
Expand All @@ -33,18 +19,6 @@
}
],
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "none",
"requireLast": false
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}
]
"@typescript-eslint/member-delimiter-style": ["off"]
}
}
}
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "mikestead.dotenv"]
"recommendations": [
"dbaeumer.vscode-eslint",
"mikestead.dotenv",
"esbenp.prettier-vscode"
]
}
28 changes: 14 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"protocol": "inspector"
}
]
}
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"protocol": "inspector"
}
]
}
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/dist": true
},
"typescript.referencesCodeLens.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.insertFinalNewline": true,
"eslint.enable": true
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
28 changes: 14 additions & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"baseUrl": "http://localhost:3000"
"baseUrl": "http://localhost:3000"
}
8 changes: 6 additions & 2 deletions cypress/integration/calendar_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ describe('Calendar page test', () => {

const today: Date = new Date()

cy.get('.fc-day-today').children().first()
cy.get('.fc-day-today')
.children()
.first()
.should('include.text', `${today.getMonth() + 1}. ${today.getDate()}.`)

cy.get('.fc-icon-chevron-right').click()
cy.contains('ma').click()

cy.get('.fc-day-today').children().first()
cy.get('.fc-day-today')
.children()
.first()
.should('include.text', `${today.getMonth() + 1}. ${today.getDate()}.`)
})
})
24 changes: 20 additions & 4 deletions cypress/integration/darkmode_cookie_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@ describe('Theme tests', () => {

cy.get('.cursor-pointer').last().find('svg').click()
cy.getCookie('theme').should('have.property', 'value', 'dark')
cy.contains('Tanulószobák').should('css', 'background-color', 'rgb(79, 70, 229)')
cy.contains('Foglalás').should('css', 'background-color', 'rgb(167, 139, 250)')
cy.contains('Tanulószobák').should(
'css',
'background-color',
'rgb(79, 70, 229)'
)
cy.contains('Foglalás').should(
'css',
'background-color',
'rgb(167, 139, 250)'
)

cy.get('.cursor-pointer').last().find('svg').click()
cy.getCookie('theme').should('have.property', 'value', 'light')
cy.contains('Tanulószobák').should('css', 'background-color', 'rgb(249, 250, 251)')
cy.contains('Foglalás').should('css', 'background-color', 'rgb(254, 215, 170)')
cy.contains('Tanulószobák').should(
'css',
'background-color',
'rgb(249, 250, 251)'
)
cy.contains('Foglalás').should(
'css',
'background-color',
'rgb(254, 215, 170)'
)
})
})
3 changes: 1 addition & 2 deletions cypress/integration/logged_out_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('Logged out tests', () => {
it('checks responses when the user is not logged in', () => {
const loggedOutText = 'Az oldal megtekintéséhez bejelentkezés szükséges!'

cy.visit('/')

cy.contains('Foglalás').click()
Expand All @@ -24,4 +24,3 @@ describe('Logged out tests', () => {
cy.contains(loggedOutText)
})
})

8 changes: 4 additions & 4 deletions knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ module.exports = {
port: +process.env.DB_PORT,
user: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE
database: process.env.DB_DATABASE,
},
pool: {
min: 2,
max: 10
max: 10,
},
migrations: {
tableName: 'migrationTable',
extension: 'ts',
directory: './migrations'
directory: './migrations',
},
...knexSnakeCaseMappers()
...knexSnakeCaseMappers(),
}
8 changes: 4 additions & 4 deletions migrations/20200328131352_initial_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import * as Knex from 'knex'

export async function up(knex: Knex): Promise<void> {
return knex.schema
.createTable('tickets', table => {
.createTable('tickets', (table) => {
table.increments('id').primary()

table.string('description')
table.integer('roomNumber')
table.dateTime('createdAt')
})
.createTable('users', table => {
.createTable('users', (table) => {
table.increments('id').primary()

table.string('name')
table.string('email')
table.string('authSchId')
table.boolean('admin')
})
.createTable('groups', table => {
.createTable('groups', (table) => {
table.increments('id').primary()

table.string('name')
Expand All @@ -29,7 +29,7 @@ export async function up(knex: Knex): Promise<void> {
table.boolean('doNotDisturb')
table.dateTime('createdAt')
})
.createTable('users_groups', table => {
.createTable('users_groups', (table) => {
table.increments('id').primary()

table
Expand Down
10 changes: 5 additions & 5 deletions migrations/20200328173956_add_owner_id_to_group.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as Knex from 'knex'

export async function up(knex: Knex): Promise<void> {
return knex.schema.alterTable('groups', table => {
table.integer('ownerId')
return knex.schema.alterTable('groups', (table) => {
table
.integer('ownerId')
.unsigned()
.references('id')
.inTable('users')
Expand All @@ -11,8 +12,7 @@ export async function up(knex: Knex): Promise<void> {
}

export async function down(knex: Knex): Promise<void> {
return knex.schema.alterTable('groups', table => {
table.dropColumn('ownerId')
.dropIndex('ownerId')
return knex.schema.alterTable('groups', (table) => {
table.dropColumn('ownerId').dropIndex('ownerId')
})
}
12 changes: 6 additions & 6 deletions migrations/20200408124626_add_non_nullable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import * as Knex from 'knex'

export async function up(knex: Knex): Promise<void> {
return knex.schema
.alterTable('tickets', table => {
.alterTable('tickets', (table) => {
table.integer('roomNumber').notNullable().alter()
table.string('description').notNullable().alter()
})
.alterTable('users', table => {
.alterTable('users', (table) => {
table.string('name').notNullable().alter()
table.string('email').notNullable().alter()
table.string('authSchId').notNullable().alter()
})
.alterTable('groups', table => {
.alterTable('groups', (table) => {
table.string('name').notNullable().alter()
table.dateTime('startDate').notNullable().alter()
table.dateTime('endDate').notNullable().alter()
Expand All @@ -22,16 +22,16 @@ export async function up(knex: Knex): Promise<void> {

export async function down(knex: Knex): Promise<void> {
return knex.schema
.alterTable('tickets', table => {
.alterTable('tickets', (table) => {
table.integer('roomNumber').nullable().alter()
table.string('description').nullable().alter()
})
.alterTable('users', table => {
.alterTable('users', (table) => {
table.string('name').nullable().alter()
table.string('email').nullable().alter()
table.string('authSchId').nullable().alter()
})
.alterTable('groups', table => {
.alterTable('groups', (table) => {
table.string('name').nullable().alter()
table.dateTime('startDate').nullable().alter()
table.dateTime('endDate').nullable().alter()
Expand Down
8 changes: 3 additions & 5 deletions migrations/20200510001427_add_floor_to_profile.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as Knex from 'knex'

export async function up(knex: Knex): Promise<void> {
return knex.schema.table('users', table => {
table.integer('floor')
.unsigned()
.nullable()
return knex.schema.table('users', (table) => {
table.integer('floor').unsigned().nullable()
})
}

export async function down(knex: Knex): Promise<void> {
return knex.schema.table('users', table => {
return knex.schema.table('users', (table) => {
table.dropColumn('floor')
})
}
4 changes: 2 additions & 2 deletions migrations/20200527121145_rename_column_in_groups.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as Knex from 'knex'

export async function up(knex: Knex): Promise<void> {
return knex.schema.table('groups', table => {
return knex.schema.table('groups', (table) => {
table.renameColumn('subject', 'tags')
})
}

export async function down(knex: Knex): Promise<void> {
return knex.schema.table('groups', table => {
return knex.schema.table('groups', (table) => {
table.renameColumn('tags', 'subject')
})
}
Loading