Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Fix lint issues in translation module #13

Merged
merged 2 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/superset-ui-translation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "yarn run build:cjs && yarn run build:esm",
"dev": "beemo babel --watch ./src --out-dir esm/ --esm",
"jest": "beemo jest --color --coverage",
"eslint": "beemo eslint \"./{src,test}/**/*.{js,jsx,json,md}\"",
"eslint": "beemo eslint \"./{src,test}/**/*.{js,jsx,md}\"",
"lint": "yarn run prettier && yarn run eslint",
"lint:fix": "yarn run prettier --write && yarn run eslint --fix",
"test": "yarn run jest",
Expand Down
3 changes: 2 additions & 1 deletion packages/superset-ui-translation/src/Translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class Translator {
return input;
}
const text = this.i18n.gettext(input);
return (args.length > 0) ? sprintf(text, ...args) : text;

return args.length > 0 ? sprintf(text, ...args) : text;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ let singleton;

function configure(config) {
singleton = new Translator(config);

return singleton;
};
}

function getInstance() {
if (!singleton) {
throw new Error('You must call configure(...) before calling other methods');
}

return singleton;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/superset-ui-translation/test/Translator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ describe('Translator', () => {
expect(new Translator({})).toBeInstanceOf(Translator);
});
it('initializes when config is specified', () => {
expect(new Translator({
languagePack: languagePackZh,
})).toBeInstanceOf(Translator);
expect(
new Translator({
languagePack: languagePackZh,
}),
).toBeInstanceOf(Translator);
});
});
describe('.translate(input, ...args)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"Copy of %s": ["%s 的副本"]
}
}
}
}