Skip to content

Commit

Permalink
fix(Project): Fixes linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mfdebian committed Apr 2, 2024
1 parent 4dbdd1f commit a089841
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 38 deletions.
30 changes: 0 additions & 30 deletions lib/__tests__/__snapshots__/project.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@ exports[`parseProject > parses a project with learning objectives without valida
"title": "A project",
},
},
"learningObjectives": [
"html/semantics",
"css/selectors",
"dom/selectors",
"dom/events",
"dom/manipulation",
"js/data-types/primitive-vs-non-primitive",
"js/data-types/strings",
"js/variables",
"js/conditionals",
"js/functions",
"js/semantics",
"ux/user-understanding",
"ux/prototyping",
],
"path": "lib/__tests__/__fixtures__/01-a-project-with-learning-objectives",
"prefix": 1,
"repo": "Laboratoria/bootcamp",
Expand All @@ -120,21 +105,6 @@ poderá cifrar e decifrar um texto indicando a chave de deslocamento (<em>offset
"title": "Cifra de César",
},
},
"learningObjectives": [
"html/semantics",
"css/selectors",
"browser/dom/selectors",
"browser/dom/events",
"browser/dom/manipulation",
"js/data-types/primitive",
"js/data-types/strings",
"js/variables",
"js/conditionals",
"js/functions",
"js/semantics",
"user-centricity/centricity",
"product-design/interactivity",
],
"path": "lib/__tests__/__fixtures__/01-a-project-with-pt-translation",
"prefix": 1,
"repo": "Laboratoria/bootcamp",
Expand Down
18 changes: 10 additions & 8 deletions lib/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,26 @@ export const transformLearningObjectives = async (dir, opts, meta) => {

const variantOptions = opts.variants?.split(',') || [];

variants?.forEach(variantInYml => {
if(variantOptions.includes(variantInYml.name)){
variantInYml.learningObjectives.forEach(learningObjective => {
variants?.forEach((variantInYml) => {
if (variantOptions.includes(variantInYml.name)) {
variantInYml.learningObjectives.forEach((learningObjective) => {
if (typeof learningObjective === 'string') {
learningObjectives.push(learningObjective);
}

if (typeof learningObjective === 'object') {
if (!learningObjective[Object.keys(learningObjective)[0]]) {
nonOptionalLearningObjectives = nonOptionalLearningObjectives.filter(item => item !== Object.keys(learningObjective)[0]);
nonOptionalLearningObjectives = nonOptionalLearningObjectives.filter(
item => item !== Object.keys(learningObjective)[0],
);
}

if (learningObjective[Object.keys(learningObjective)[0]].optional &&
!optionalLearningObjectives.includes(Object.keys(learningObjective)[0])) {
if (learningObjective[Object.keys(learningObjective)[0]].optional
&& !optionalLearningObjectives.includes(Object.keys(learningObjective)[0])) {
optionalLearningObjectives.push(Object.keys(learningObjective)[0]);
}
}
})
});
}
});

Expand Down Expand Up @@ -200,7 +202,7 @@ export const parseProject = async (dir, opts, pkg) => {

const {
nonOptionalLearningObjectives,
optionalLearningObjectives
optionalLearningObjectives,
} = await transformLearningObjectives(dir, opts, meta) || {};

return {
Expand Down

0 comments on commit a089841

Please sign in to comment.