Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit ee41418

Browse files
committed
👕 refactor(eslint): resolve eslint errors
1 parent ac23d13 commit ee41418

6 files changed

Lines changed: 25 additions & 24 deletions

File tree

src/extend.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export default function (Vue) {
8383
res = interpolate(getter(fallback), key, params)
8484
if (!isNil(res)) {
8585
if (process.env.NODE_ENV !== 'production') {
86-
warn('Fall back to translate the keypath "' + key + '" with "'
87-
+ fallback + '" language.')
86+
warn('Fall back to translate the keypath "' + key + '" with "' +
87+
fallback + '" language.')
8888
}
8989
return res
9090
} else {
@@ -99,8 +99,8 @@ export default function (Vue) {
9999
Vue.config.missingHandler.apply(null, [lang, key, vm])
100100
} else {
101101
if (process.env.NODE_ENV !== 'production') {
102-
warn('Cannot translate the value of keypath "' + key + '". '
103-
+ 'Use the value of keypath as default')
102+
warn('Cannot translate the value of keypath "' + key + '". ' +
103+
'Use the value of keypath as default')
104104
}
105105
}
106106
return key
@@ -206,8 +206,9 @@ export default function (Vue) {
206206
*/
207207

208208
Vue.prototype.$tc = function (key, choice, ...args) {
209-
if (typeof choice !== 'number'
210-
&& typeof choice !== 'undefined') { return key }
209+
if (typeof choice !== 'number' && typeof choice !== 'undefined') {
210+
return key
211+
}
211212
return fetchChoice(this.$t(key, ...args), choice)
212213
}
213214

src/format.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default function (Vue) {
3434
return string.replace(RE_NARGS, (match, prefix, i, index) => {
3535
let result
3636

37-
if (string[index - 1] === '{'
38-
&& string[index + match.length] === '}') {
37+
if (string[index - 1] === '{' &&
38+
string[index + match.length] === '}') {
3939
return i
4040
} else {
4141
result = hasOwn(args, i) ? args[i] : match

src/path.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Path paerser
3-
* - Inspired:
3+
* - Inspired:
44
* Vue.js Path parser
55
*/
66

@@ -224,8 +224,8 @@ function parse (path) {
224224

225225
function maybeUnescapeQuote () {
226226
const nextChar = path[index + 1]
227-
if ((mode === IN_SINGLE_QUOTE && nextChar === "'")
228-
|| (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
227+
if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
228+
(mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
229229
index++
230230
newChar = '\\' + nextChar
231231
actions[APPEND]()
@@ -333,7 +333,7 @@ export default function (Vue) {
333333
last = value
334334
i++
335335
}
336-
336+
337337
ret = last
338338
return ret
339339
}

test/unit/fixture/locales.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ export default {
1010
},
1111
fallback: 'this is fallback',
1212
link: '@:message.hello',
13-
link_end: 'This is a linked translation to @:message.hello',
14-
link_within: 'Isn\'t @:message.hello we live in great?',
15-
link_multiple: 'Hello @:message.hoge!, isn\'t @:message.hello great?',
13+
linkEnd: 'This is a linked translation to @:message.hello',
14+
linkWithin: 'Isn\'t @:message.hello we live in great?',
15+
linkMultiple: 'Hello @:message.hoge!, isn\'t @:message.hello great?',
1616
'hyphen-locale': 'hello hyphen',
1717
'1234': 'Number-based keys are found',
1818
'1mixedKey': 'Mixed keys are not found.'
1919
},
2020
'hello world': 'Hello World',
2121
'Hello {0}': 'Hello {0}',
2222
'continue-with-new-account': 'continue with new account',
23-
underscore: '{hello_msg} world',
23+
underscore: '{helloMsg} world',
2424
plurals: {
2525
car: 'car | cars',
2626
apple: 'no apples | one apple | {count} apples',
@@ -40,7 +40,7 @@ export default {
4040
]
4141
],
4242
issues: {
43-
array_bugs: ['bug1', 'bug2']
43+
arrayBugs: ['bug1', 'bug2']
4444
}
4545
},
4646
ja: {
@@ -75,7 +75,7 @@ export default {
7575
]
7676
],
7777
issues: {
78-
array_bugs: ['バグ1', 'バグ2']
78+
arrayBugs: ['バグ1', 'バグ2']
7979
}
8080
}
8181
}

test/unit/i18n.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ describe('i18n', () => {
3030

3131
describe('linked translation', () => {
3232
it('should translate link at the end of locale', () => {
33-
assert.equal(Vue.t('message.link_end'), 'This is a linked translation to the world')
33+
assert.equal(Vue.t('message.linkEnd'), 'This is a linked translation to the world')
3434
})
3535
})
3636

3737
describe('linked translation', () => {
3838
it('should translate link within a locale', () => {
39-
assert.equal(Vue.t('message.link_within'), 'Isn\'t the world we live in great?')
39+
assert.equal(Vue.t('message.linkWithin'), 'Isn\'t the world we live in great?')
4040
})
4141
})
4242

4343
describe('linked translation', () => {
4444
it('should translate multiple links within a locale', () => {
45-
assert.equal(Vue.t('message.link_multiple'), 'Hello hoge!, isn\'t the world great?')
45+
assert.equal(Vue.t('message.linkMultiple'), 'Hello hoge!, isn\'t the world great?')
4646
})
4747
})
4848

test/unit/issues.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('issues', () => {
1919
describe('#35', () => {
2020
it('should be translated', () => {
2121
assert.equal(
22-
vm.$t('underscore', { hello_msg: 'hello' }),
22+
vm.$t('underscore', { helloMsg: 'hello' }),
2323
'hello world'
2424
)
2525
})
@@ -45,9 +45,9 @@ describe('issues', () => {
4545

4646
describe('#91, #51', () => {
4747
it('should be translated', () => {
48-
const arrayLocales = locales[Vue.config.lang].issues.array_bugs
48+
const arrayLocales = locales[Vue.config.lang].issues.arrayBugs
4949
for (let i = 0; i < arrayLocales.length; i++) {
50-
const item = vm.$t('issues.array_bugs')[i]
50+
const item = vm.$t('issues.arrayBugs')[i]
5151
assert.equal(item, arrayLocales[i])
5252
}
5353
})

0 commit comments

Comments
 (0)