Newline required at end of file but not found

Asked

Viewed 23 times

-1

I started a React project using Eslint. However, it is giving this error:

Failed to compile.

src/index.jsx
  Line 5:59:  Newline required at end of file but not found  eol-last

Search for the keywords to learn more about each error

The code of the index.jsx file is:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
  • I managed to solve it! The solution is to put inside the .eslintrc. project configuration file in the "Rules" structure the "eol-last":0 line. This will make Eslint ignore the error and work

  • 1

    Have you tried typing /* eslint-disable eol-last */ in the first line of the file that is giving problems or else add an empty line to the end of the file that is giving problems?

  • 1

    In general, for each Eslint rule there are three alternatives: respect it, disable it or disable it in the file/on a specific line or region

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.