Skip to content

Commit

Permalink
chore: Use oxlint instead of eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian committed Dec 27, 2023
1 parent 93aa490 commit 9a3a163
Show file tree
Hide file tree
Showing 14 changed files with 565 additions and 841 deletions.
4 changes: 2 additions & 2 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pre-commit:
commands:
prettier:
glob: '*.{json,md,yml}'
run: npx prettier --write {staged_files} && git add {staged_files}
run: npx --no-install prettier --write {staged_files} && git add {staged_files}
eslint:
glob: 'packages/**/*.ts'
run: npx eslint --fix {staged_files} && git add {staged_files}
run: npx --no-install oxlint --fix {staged_files} && git add {staged_files}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"babel-eslint": "10.1.0",
"eslint": "7.32.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jasmine": "4.1.3",
Expand All @@ -20,6 +19,7 @@
"eslint-plugin-typescript-sort-keys": "2.3.0",
"eslint-plugin-unused-imports": "1.1.5",
"lerna": "8.0.1",
"oxlint": "0.0.22",
"prettier": "3.1.1"
},
"engines": {
Expand All @@ -43,7 +43,7 @@
"fix:ts": "yarn lint:ts --fix",
"lint": "yarn lint:ts && yarn lint:other",
"lint:other": "yarn prettier --list-different",
"lint:ts": "eslint --ignore-path .gitignore --ext .ts packages",
"lint:ts": "oxlint --ignore-path .gitignore packages",
"prettier": "prettier \"*.{json,md,yml}\"",
"release": "lerna publish",
"test": "yarn lint && yarn test:all",
Expand Down
122 changes: 61 additions & 61 deletions packages/absence.io/src/Endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
export namespace Endpoint {
const ABSENCES = 'absences';
const CREATE = 'create';
const ALLOWANCE_TYPES = 'allowancetypes';
const DEPARTMENTS = 'departments';
const INVITE = 'invite';
const LOCATIONS = 'locations';
const REASONS = 'reasons';
const TEAMS = 'teams';
const USERS = 'users';
const TIMESPANS = 'timespans';
export const Endpoint = {
ABSENCES: 'absences',
CREATE: 'create',
ALLOWANCE_TYPES: 'allowancetypes',
DEPARTMENTS: 'departments',
INVITE: 'invite',
LOCATIONS: 'locations',
REASONS: 'reasons',
TEAMS: 'teams',
USERS: 'users',
TIMESPANS: 'timespans',

export namespace Absence {
export function absences(id?: string): string {
return `/${ABSENCES}/${id ? `${id}/` : ''}`;
}
Absence: {
absences(id?: string): string {
return `/${Endpoint.ABSENCES}/${id ? `${id}/` : ''}`;
},

export function create(): string {
return `/${ABSENCES}/${CREATE}/`;
}
}
create(): string {
return `/${Endpoint.ABSENCES}/${Endpoint.CREATE}/`;
},
},

export namespace AllowanceType {
export function allowanceTypes(id?: string): string {
return `/${ALLOWANCE_TYPES}/${id ? `${id}/` : ''}`;
}
}
AllowanceType: {
allowanceTypes(id?: string): string {
return `/${Endpoint.ALLOWANCE_TYPES}/${id ? `${id}/` : ''}`;
},
},

export namespace Department {
export function departments(id?: string): string {
return `/${DEPARTMENTS}/${id ? `${id}/` : ''}`;
}
}
Department: {
departments(id?: string): string {
return `/${Endpoint.DEPARTMENTS}/${id ? `${id}/` : ''}`;
},
},

export namespace Location {
export function locations(id?: string): string {
return `/${LOCATIONS}/${id ? `${id}/` : ''}`;
}
}
Location: {
locations(id?: string): string {
return `/${Endpoint.LOCATIONS}/${id ? `${id}/` : ''}`;
},
},

export namespace Reason {
export function reasons(id?: string): string {
return `/${REASONS}/${id ? `${id}/` : ''}`;
}
}
Reason: {
reasons(id?: string): string {
return `/${Endpoint.REASONS}/${id ? `${id}/` : ''}`;
},
},

export namespace Team {
export function teams(id?: string): string {
return `/${TEAMS}/${id ? `${id}/` : ''}`;
}
}
Team: {
teams(id?: string): string {
return `/${Endpoint.TEAMS}/${id ? `${id}/` : ''}`;
},
},

export namespace Timespan {
export function create(): string {
return `/${TIMESPANS}/${CREATE}/`;
}
Timespan: {
create(): string {
return `/${Endpoint.TIMESPANS}/${Endpoint.CREATE}/`;
},

export function timespans(id?: string): string {
return `/${TIMESPANS}/${id ? `${id}/` : ''}`;
}
}
timespans(id?: string): string {
return `/${Endpoint.TIMESPANS}/${id ? `${id}/` : ''}`;
},
},

export namespace User {
export function invite(): string {
return `/${USERS}/${INVITE}/`;
}
User: {
invite(): string {
return `/${Endpoint.USERS}/${Endpoint.INVITE}/`;
},

export function users(id?: string): string {
return `/${USERS}/${id ? `${id}/` : ''}`;
}
}
}
users(id?: string): string {
return `/${Endpoint.USERS}/${id ? `${id}/` : ''}`;
},
},
};
4 changes: 2 additions & 2 deletions packages/absence.io/src/api/APIBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export class APIBase {
}

protected checkApiKey(apiName?: string): void {
apiName = `the "${apiName}"` || 'this';
const name = apiName ? `the "${apiName}"` : 'this';
if (!this.options.apiKey || !this.options.apiKeyId) {
throw new Error(`An API key needs to be set in order to use ${apiName} API`);
throw new Error(`An API key needs to be set in order to use ${name} API`);
}
}
}
76 changes: 38 additions & 38 deletions packages/bamboohr.com/src/Endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as qs from 'qs';
import {Fields} from './interfaces/Fields';

export namespace Endpoint {
const DIRECTORY = 'directory';
const EMPLOYEES = 'employees';
const META = 'meta';
const POLICIES = 'policies';
const REQUESTS = 'requests';
const TIME_OFF = 'time_off';
const TYPES = 'types';
const WHOS_OUT = 'whos_out';

export namespace Employees {
export function employees(id?: number, fields?: Array<keyof Fields>): string {
let path = `/${EMPLOYEES}/`;
export const Endpoint = {
DIRECTORY: 'directory',
EMPLOYEES: 'employees',
META: 'meta',
POLICIES: 'policies',
REQUESTS: 'requests',
TIME_OFF: 'time_off',
TYPES: 'types',
WHOS_OUT: 'whos_out',

Employees: {
employees(id?: number, fields?: Array<keyof Fields>): string {
let path = `/${Endpoint.EMPLOYEES}/`;
if (id) {
path += `${id}/`;
}
Expand All @@ -23,28 +23,28 @@ export namespace Endpoint {
}

return path;
}

export function employeeDirectory(): string {
return `/${EMPLOYEES}/${DIRECTORY}/`;
}
}

export namespace TimeOff {
export function whosOut(): string {
return `/${TIME_OFF}/${WHOS_OUT}/`;
}

export function timeOffTypes(): string {
return `/${META}/${TIME_OFF}/${TYPES}/`;
}

export function timeOffPolicies(): string {
return `/${META}/${TIME_OFF}/${POLICIES}/`;
}

export function timeOffRequests(): string {
return `/${TIME_OFF}/${REQUESTS}/`;
}
}
}
},

employeeDirectory(): string {
return `/${Endpoint.EMPLOYEES}/${Endpoint.DIRECTORY}/`;
},
},

TimeOff: {
whosOut(): string {
return `/${Endpoint.TIME_OFF}/${Endpoint.WHOS_OUT}/`;
},

timeOffTypes(): string {
return `/${Endpoint.META}/${Endpoint.TIME_OFF}/${Endpoint.TYPES}/`;
},

timeOffPolicies(): string {
return `/${Endpoint.META}/${Endpoint.TIME_OFF}/${Endpoint.POLICIES}/`;
},

timeOffRequests(): string {
return `/${Endpoint.TIME_OFF}/${Endpoint.REQUESTS}/`;
},
},
};
Loading

0 comments on commit 9a3a163

Please sign in to comment.