Skip to content

Commit

Permalink
fix: eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RenanLorijola committed Oct 29, 2023
1 parent 7fe13fa commit 290f5e8
Show file tree
Hide file tree
Showing 47 changed files with 125 additions and 76 deletions.
8 changes: 2 additions & 6 deletions apps/container/src/components/ConceptsHorizontalChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
class="grading-segment"
:class="grade.count < untrustableThreshold ? 'unthrustable' : ''"
:style="{
background:
conceptsColor[grade.conceito],
background: conceptsColor[grade.conceito],
width: `${grades[grade.conceito]}%`,
}"
>
Expand Down Expand Up @@ -47,10 +46,7 @@ const orderedDistribution = computed(() => {
});
const grades = computed(() =>
transformConceptDataToObject(
props.gradeData.distribution,
props.gradeData.count,
),
transformConceptDataToObject(props.gradeData.distribution),
);
</script>

Expand Down
1 change: 0 additions & 1 deletion apps/container/src/components/SubjectReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ const generalGrades = computed(() => {
if (!subjectData.value?.data) return {};
return transformConceptDataToObject(
subjectData.value.data.general.distribution,
subjectData.value.data.general.count,
);
});
Expand Down
6 changes: 1 addition & 5 deletions apps/container/src/components/TeacherReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,12 @@ const grades = computed(() => {
if (selectedSubject.value === 'Todas as matérias') {
return transformConceptDataToObject(
teacherData.value.data.general.distribution,
teacherData.value.data.general.count,
);
}
const data = teacherData.value.data.specific
.filter((subject) => subject._id)
.find((subject) => subject._id.name === selectedSubject.value);
return transformConceptDataToObject(
data?.distribution || [],
data?.count || 1,
);
return transformConceptDataToObject(data?.distribution || []);
});
const demandsAttendance = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/container/src/views/Stats/StatsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import { ref, computed } from 'vue';
import { StatsSubjects, type StatsParams } from 'services';
import type { StatsClass, StatsSubject, StatsCourse } from 'types';
import { useInfiniteQuery, useQuery } from '@tanstack/vue-query';
import { getSeason } from '@/utils/season';
import { getSeason } from 'utils/season';
import { PaperCard } from '@/components/PaperCard';
type Tab = 'classes' | 'courses' | 'subjects';
Expand Down
10 changes: 10 additions & 0 deletions packages/services/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
extends: ['custom', 'react-ts'],
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.json'],
},
};
4 changes: 0 additions & 4 deletions packages/services/.eslintrc.js

This file was deleted.

6 changes: 1 addition & 5 deletions packages/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export * from './comments';
export * from './enrollments';
export * from './users';
export * from './reviews';
export * from './stats';
export * from './src';
5 changes: 3 additions & 2 deletions packages/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"version": "0.0.0",
"main": "./index.ts",
"license": "MIT",
"type": "module",
"scripts": {
"lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint \"**/*.ts\" --fix"
"lint": "eslint src/**/*",
"lint:fix": "eslint src/**/* --fix"
},
"devDependencies": {
"eslint-config-custom": "*",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions packages/services/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './comments';
export * from './enrollments';
export * from './users';
export * from './reviews';
export * from './stats';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
StatsCourse,
StatsSubject,
} from 'types';

import api from './api';

export type StatsParams = {
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions packages/services/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": "tsconfig/react.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
"include": [".", ".eslintrc.cjs"]
}
10 changes: 10 additions & 0 deletions packages/stores/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
extends: ['custom', 'react-ts'],
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.json'],
},
};
4 changes: 0 additions & 4 deletions packages/stores/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/stores/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as authStore } from './auth';
export * from './src';
5 changes: 3 additions & 2 deletions packages/stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"version": "0.0.0",
"main": "./index.ts",
"license": "MIT",
"type": "module",
"scripts": {
"lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint \"**/*.ts\" --fix"
"lint": "eslint src/**/*",
"lint:fix": "eslint src/**/* --fix"
},
"devDependencies": {
"eslint-config-custom": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from 'services/users';
import { User } from 'services';
import { persist } from 'zustand/middleware';
import { createStore } from 'zustand/vanilla';

Expand Down
1 change: 1 addition & 0 deletions packages/stores/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as authStore } from './auth';
3 changes: 1 addition & 2 deletions packages/stores/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": "tsconfig/react.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
"include": [".", ".eslintrc.cjs"]
}
10 changes: 10 additions & 0 deletions packages/types/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
extends: ['custom', 'react-ts'],
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.json'],
},
};
9 changes: 1 addition & 8 deletions packages/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
export type * from './concepts';
export type * from './request-error';
export type * from './search';
export type * from './subjects';
export type * from './teachers';
export type * from './users';
export type * from './comments';
export type * from './stats';
export type * from './src';
15 changes: 11 additions & 4 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"name": "types",
"version": "0.0.0",
"main": "index.ts",
"types": "index.ts",
"main": "./index.ts",
"license": "MIT",
"publishConfig": {
"access": "public"
"type": "module",
"scripts": {
"lint": "eslint src/**/*",
"lint:fix": "eslint src/**/* --fix"
},
"devDependencies": {
"eslint-config-custom": "*",
"eslint-config-react-ts": "*",
"tsconfig": "*",
"typescript": "^5.1.6"
}
}
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type * from './concepts';
export type * from './request-error';
export type * from './search';
export type * from './subjects';
export type * from './teachers';
export type * from './users';
export type * from './comments';
export type * from './stats';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "tsconfig/react.json",
"include": [".", ".eslintrc.cjs"]
}
10 changes: 10 additions & 0 deletions packages/utils/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
extends: ['custom', 'react-ts'],
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.json'],
},
};
5 changes: 1 addition & 4 deletions packages/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export * from './transformConceptDataToObject';
export * from './dateToTimeAgo';
export * from './seasonFormatting';
export * from './consts';
export * from './src';
15 changes: 11 additions & 4 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"name": "utils",
"version": "0.0.0",
"main": "index.ts",
"types": "index.ts",
"main": "./index.ts",
"license": "MIT",
"publishConfig": {
"access": "public"
"type": "module",
"scripts": {
"lint": "eslint src/**/*",
"lint:fix": "eslint src/**/* --fix"
},
"devDependencies": {
"eslint-config-custom": "*",
"eslint-config-react-ts": "*",
"tsconfig": "*",
"typescript": "^5.1.6"
},
"dependencies": {
"types": "*"
Expand Down
17 changes: 0 additions & 17 deletions packages/utils/seasonFormatting.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './transformConceptDataToObject';
export * from './dateToTimeAgo';
export * from './seasonFormatting';
export * from './consts';
File renamed without changes.
16 changes: 16 additions & 0 deletions packages/utils/src/seasonFormatting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const checkEAD = (year: string | number, quad: string | number) => {
const possibles = [
'2020:1',
'2020:2',
'2020:3',
'2021:1',
'2021:2',
'2021:3',
'2022:1',
'2022:2',
];
return possibles.includes(`${year}:${quad}`);
};

export const formatSeason = (quad: string | number, year: string | number) =>
`Q${quad} ${year}`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConceptData } from 'types';

export const transformConceptDataToObject = (grades: ConceptData[], count: number) => {
const result: { [x: string]: number } = {};
export const transformConceptDataToObject = (grades: ConceptData[]) => {
const result: Record<string, number> = {};
grades.forEach((grade) => {
result[grade.conceito] = grade.count;
});
Expand All @@ -12,4 +12,4 @@ export const transformConceptDataToObject = (grades: ConceptData[], count: numbe
return obj;
}, {});
return ordered;
};
};
4 changes: 4 additions & 0 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "tsconfig/react.json",
"include": [".", ".eslintrc.cjs"]
}

0 comments on commit 290f5e8

Please sign in to comment.