ThunD3eR
ThunD3eR

Reputation: 3436

Code formatter removing required newline

I am using visual studio code in a vue.js project.

I have Eslint installed, vutur and prettier code formatter.

My problem:

1    import Aside from './Aside.vue'
2    import Breadcrumb from './Breadcrumb.vue'
3    import Callout from './Callout.vue'
4    import Footer from './Footer.vue'
5    import Header from './Header.vue'
6    import Sidebar from './Sidebar.vue'
7    import Switch from './Switch.vue'
8    
9    export { Aside, Breadcrumb, Callout, Footer, Header, Sidebar, Switch }
10

Pressing CTR+S to save the file gives me this:

1    import Aside from './Aside.vue'
2    import Breadcrumb from './Breadcrumb.vue'
3    import Callout from './Callout.vue'
4    import Footer from './Footer.vue'
5    import Header from './Header.vue'
6    import Sidebar from './Sidebar.vue'
7    import Switch from './Switch.vue'
8    
9    export { Aside, Breadcrumb, Callout, Footer, Header, Sidebar, Switch }

Resulting in eslint saying:

Newline required at end of file but not found

This is only happening in .js files.

My settings:

{
    "window.zoomLevel": 0,
    "javascript.format.enable": false,
    "javascript.validate.enable": false,
    "prettier.eslintIntegration": true,
    "editor.formatOnSave": true,
    "prettier.singleQuote": true,
    "prettier.trailingComma": "none",
    "prettier.semi": false,
    "prettier.useTabs": false,
    "prettier.bracketSpacing": true,
    "prettier.jsxBracketSameLine": true
}

How can I solve this?

Upvotes: 0

Views: 1888

Answers (1)

samayo
samayo

Reputation: 16495

According to the same issue described here https://github.com/vuejs/vue-cli/issues/11 you have to update your vue-loader version to [email protected].

Or use this above the line that is causing the error

/*eslint-disable */

Upvotes: 2

Related Questions