Skip to content

Commit

Permalink
fix: remove eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelsr committed Feb 24, 2023
1 parent 44c8d26 commit 231e59f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --exec ts-node src/index.ts"
"lint": "eslint .",
"start": "npm run lint && nodemon --exec ts-node src/index.ts"
},
"keywords": [],
"author": "raquelsr",
Expand Down
12 changes: 6 additions & 6 deletions backend/src/schema/mutations/User.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { GraphQLString } from 'graphql';
import { Users } from '../../entities/Users';
import { User } from '../types/User';
import { CreateUserPayload, User } from '../types/User';

export const CREATE_USER = {
type: User,
args: {
name: {type: GraphQLString},
lastName: {type: GraphQLString},
country: {type: GraphQLString},
role: {type: GraphQLString}
name: { type: GraphQLString },
lastName: { type: GraphQLString },
country: { type: GraphQLString },
role: { type: GraphQLString }
},
resolve: async (_: any, args: any) => {
resolve: async (_: unknown, args: CreateUserPayload) => {
const { name, lastName, country, role } = args;

const result = await Users.insert({
Expand Down
6 changes: 3 additions & 3 deletions backend/src/schema/queries/User.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLList } from 'graphql';
import { Users } from '../../entities/Users';
import { Countries } from '../../entities/Countries';
import { getUsersByCountrySuccessPayload, getTUsersByRoleSuccessPayload, UserRegistrationStatistics, UsersByCountry, UsersByRole, User } from '../types/User';
import { GetUsersByCountrySuccessPayload, GetTUsersByRoleSuccessPayload, UserRegistrationStatistics, UsersByCountry, UsersByRole, User } from '../types/User';
import { Roles } from '../../entities/Roles';


Expand Down Expand Up @@ -31,7 +31,7 @@ export const GET_USER_REGISTRATION_STATISTICS = {
export const GET_USERS_BY_COUNTRY = {
type: new GraphQLList(UsersByCountry),
resolve: async () => {
const result: getUsersByCountrySuccessPayload[] = [];
const result: GetUsersByCountrySuccessPayload[] = [];
const countries = await Countries.find();
const users = await Users.find();
countries.map(country => {
Expand All @@ -50,7 +50,7 @@ export const GET_USERS_BY_COUNTRY = {
export const GET_USERS_BY_ROLE = {
type: new GraphQLList(UsersByRole),
resolve: async () => {
const result: getTUsersByRoleSuccessPayload[] = [];
const result: GetTUsersByRoleSuccessPayload[] = [];
const roles = await Roles.find();
const users = await Users.find();
roles.map(role => {
Expand Down
11 changes: 9 additions & 2 deletions backend/src/schema/types/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,21 @@ export const UsersByRole = new GraphQLObjectType({
}
});

export type getUsersByCountrySuccessPayload = {
export type GetUsersByCountrySuccessPayload = {
country: string;
totalCount: number;
percentage: number;
}

export type getTUsersByRoleSuccessPayload = {
export type GetTUsersByRoleSuccessPayload = {
role: string;
totalCount: number;
percentage: number;
}

export type CreateUserPayload = {
name: string;
lastName: string;
country: string;
role: string;
}
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint src/**/*.ts src/**/*.tsx"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BarChart as BarChartRechart, Bar, CartesianGrid, Legend, Tooltip, XAxis
import { LayoutType } from 'recharts/types/util/types';

export type BarChartProps = {
data: any[];
data: unknown[];
dataKey: string;
xAxisKeys?: string;
yAxisKeys?: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { LineChart as LineChartRechart, Line, CartesianGrid, XAxis, YAxis } from 'recharts';

export type LineChartProps = {
data: any[];
data: unknown[];
dataKey: string;
xAxisKeys: string;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Label, LabelList, Pie, PieChart as PieChartRechart } from 'recharts';

export type PieChartProps = {
data: any[];
data: unknown[];
dataKey: string;
nameKey: string;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/RadarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { RadarChart as RadarChartRechart, PolarAngleAxis, PolarRadiusAxis, PolarGrid, Radar, Legend } from 'recharts';

type RadarChartProps = {
data: any[];
data: unknown[];
}

export const RadarChart: React.FC<RadarChartProps> = ({ data }) => {
Expand Down

0 comments on commit 231e59f

Please sign in to comment.