57 }
58}
59
60const onDemand = new I18nextKeysOnDemand({ 61 translationGetter: onDemandFetcher,
62 debounceDelay: 50,
63})
64
65// const crowdinBackend = new CrowdinOtaBackend(undefined, )
66const apiPath = '/api/i18n/load?lng={{lng}}&ns={{ns}}'
67const httpBackend = new HttpBackend(null, { 68 loadPath: getUrl(apiPath), //typeof window !== 'undefined' ? apiPath : `http://localhost:3000${apiPath}`,
69 allowMultiLoading: true,
70})
130 interpolation: {
131 skipOnVariables: false,
132 alwaysFormat: true,
133 format: (value, format, lng, edit) => {134 switch (format) {
135 case 'lowercase': {
136 if (typeof value === 'string') return value.toLowerCase()
130 interpolation: {
131 skipOnVariables: false,
132 alwaysFormat: true,
133 format: (value, format, lng, edit) => {134 switch (format) {
135 case 'lowercase': {
136 if (typeof value === 'string') return value.toLowerCase()
Found variables that are declared but not used anywhere.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Currently, we don't support variables that are not explicitly exported, and are injected into other scripts by being included in an HTML file
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
let y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
let z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
let x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}