Я пытаюсь использовать следующую функцию для управления моими вкладками (Bulma CSS):
openTab(evt, tabName) {
let i
const x, tablinks
x = document.getElementsByClassName('content-tab')
for (i = 0; i < x.length; i++) {
x[i].style.display = 'none'
}
tablinks = document.getElementsByClassName('tab')
for (i = 0; i < x.length; i++) {
tablinks[i].className = tablinks[i].className.replace(' is-active', '')
}
document.getElementById(tabName).style.display = 'block'
evt.currentTarget.className += ' is-active'
}
Когда WebPack перезагружает страницу, я получаю следующую ошибку:
Syntax Error: Unexpected token (330:6) friendly-errors 09:58:05
328 | let i
329 | const x
> 330 | const tablinks
| ^
331 | x = document.getElementsByClassName('content-tab')
332 | for (i = 0; i < x.length; i++) {
333 | x[i].style.display = 'none'
Я пытался изменить const на var, но, похоже, это не решает проблему.
Это мой eslintrc.js:
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended',
'plugin:prettier/recommended',
'prettier',
'prettier/vue'
],
plugins: [
'prettier'
],
// add your custom rules here
rules: {
}
}
Кто-нибудь знает, что может быть причиной этой проблемы?