Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Oct 10, 2023
1 parent 82b770b commit 2209e5b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "make build",
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"test": "fedx-scripts jest --coverage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ScoringCard = ({
summary += ` ${String.fromCharCode(183)} `;
summary += unlimited
? intl.formatMessage(messages.unlimitedAttemptsSummary)
: intl.formatMessage(messages.attemptsSummary, { attempts: attempts ? attempts : defaultValue });
: intl.formatMessage(messages.attemptsSummary, { attempts: attempts || defaultValue });
return summary;
};

Expand Down
4 changes: 2 additions & 2 deletions src/editors/containers/ProblemEditor/data/SettingsParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash-es';

import { ShowAnswerTypes, RandomizationTypesKeys } from '../../../data/constants/problem';

export const popuplateItem = (parentObject, itemName, statekey, metadata, allowNull=false) => {
export const popuplateItem = (parentObject, itemName, statekey, metadata, allowNull = false) => {
let parent = parentObject;
const item = _.get(metadata, itemName, null);
if (!_.isNil(item) || allowNull) {
Expand All @@ -14,7 +14,7 @@ export const popuplateItem = (parentObject, itemName, statekey, metadata, allowN
export const parseScoringSettings = (metadata, defaultSettings) => {
let scoring = {};

let attempts = popuplateItem({}, 'max_attempts', 'number', metadata);
const attempts = popuplateItem({}, 'max_attempts', 'number', metadata);
attempts.unlimited = false;

// isFinite checks if value is a finite primitive number.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Test Settings to State Parser', () => {

test('Test score settings attempts missing with default max_attempts', () => {
const scoreSettings = parseScoringSettings(singleSelectWithHints.metadata, defaultSettings);
expect(scoreSettings.attempts).toStrictEqual({number: 1, unlimited: false});
expect(scoreSettings.attempts).toStrictEqual({ number: 1, unlimited: false });
});

test('Test negative attempts in score', () => {
Expand All @@ -47,12 +47,12 @@ describe('Test Settings to State Parser', () => {

test('Test score settings missing with default', () => {
const settings = parseSettings(singleSelectWithHints.metadata, defaultSettings);
expect(settings.scoring).toStrictEqual({attempts: {number: 1, unlimited: false}});
expect(settings.scoring).toStrictEqual({ attempts: { number: 1, unlimited: false } });
});

test('Test score settings missing with null default', () => {
const settings = parseSettings(singleSelectWithHints.metadata, {max_attempts: null});
expect(settings.scoring).toStrictEqual({attempts: {number: '', unlimited: true}});
const settings = parseSettings(singleSelectWithHints.metadata, { max_attempts: null });
expect(settings.scoring).toStrictEqual({ attempts: { number: '', unlimited: true } });
});

test('Test invalid randomization', () => {
Expand Down

0 comments on commit 2209e5b

Please sign in to comment.