I am developing front desk with TypeScript and Nxt.js.
I am developing using eslint, but there was an error in interface properties when I defined interface.
interface Data {
name —string
password:string // Parsing error:Unexpected token
}
Below is the full error statement.
ERROR in./components/LoginForm/LoginForm.vue friendly-errors 21:31:04
Module Errors (from./node_modules/eslint-loader/index.js): friendly-errors 21:31:04
<project_path>/components/LoginForm/LoginForm.vue
36:2 error Parsing error:Unexpected token
4 | interface Data {
5 | name —string
>6 | password:string
| ^
7 | }
8 |
9 | export default Vue.extend({
✖ 1 problem (1 error, 0 warnings)
friendly-errors 21:31:04
@ ./node_modules/babel-loader/lib?ref--3-0!./node_modules/ts-loader??ref--3-1!./node_modules/vue-loader/lib?vue-loader-options!./pages/index.vue?vue&type=script&lang: 2/4&161
@ ./pages/index.vue?vue&type=script&lang=ts&
@ ./pages/index.vue
@ ./.nuxt/router.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multieventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&name=client&path=/__webpack_hmr/client.ntxt.juntent.
I've looked into many things myself, but I couldn't find a solution to this error.
Note:
.eslintrc.js
is as follows:
module.exports={
root —true,
env: {
browser —true,
node —true
},
parserOptions: {
parser: 'babel-eslint'
},
extensions:
'@nuxtjs',
'plugin:nuxt/recommended',
'plugin: prettier/recommended',
'prettier',
'prettier/vue',
],
plugins: [
'prettier'
],
// add your custom rules here
rules: {
}
}
Thank you to everyone who commented.
Self-resolved.
The eslint parser was set to typescript-eslint-parser
and it was resolved.
© 2024 OneMinuteCode. All rights reserved.