Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JS (Expected linebreaks to be 'LF' but found 'CRLF'.eslintlinebreak-style) issue

I'm new in JS. I created table with checkbox row. Now I wanna test it. But I get error in my index.js file.

My code

import React from 'react';
import { Spin, Table } from 'antd';
import { useFetch } from 'innroad.common.ui';
import * as apiService from 'services/ApiService';

const AccountType = (onSelectingItems) => {
  const [data, isLoading] = useFetch(apiService.accountType);

  return (
    <Spin spinning={isLoading}>
      <Table
        key="id"
        bordered="true"
        rowKey="id"
        dataSource={data}
        rowSelection={{ onChange: onSelectingItems }}
        pagination={false}
      >
        <Table.Column title="Account Type" dataIndex="accountType" />
      </Table>

    </Spin>
  );
};

/* AccountType.propTypes = {
  selectionType: PropTypes.string,
  onSelectingLineItems: PropTypes.func,
}; */

AccountType.defaultProps = {
  selectionType: 'checkbox',
  onSelectingLineItems: () => { },
};

export default AccountType;

And one question more: should I use AccountType.propTypes - commented block? If yes, how I need change it? Because now I get error in this block - that I declare but didn't use.

Index.JS (Here is error)

export { default } from './AccountType';

Expected linebreaks to be 'LF' but found 'CRLF'.eslintlinebreak-style after ";"

like image 839
kirill_junior Avatar asked Oct 18 '25 05:10

kirill_junior


2 Answers

Click the LF / CLRF icon int he bottom right corner and change it to what you need.

bottom right icon

select panel

Alternatively you can change the rule in eslint

"linebreak-style": ["error", "windows"]
or
"linebreak-style": ["error", "unix"]

https://eslint.org/docs/rules/linebreak-style

You can also configure git to checkout with a choosen line ending style. This is often the cause of the reocurrence of the "problem".

For example

$ git config --global core.autocrlf true
# Configure Git to ensure line endings in files you checkout are correct for Windows.
# For compatibility, line endings are converted to Unix style when you commit files.

https://docs.github.com/en/free-pro-team@latest/github/using-git/configuring-git-to-handle-line-endings

like image 62
The Fool Avatar answered Oct 19 '25 18:10

The Fool


In the bottom right corner you can change the line ending character:

enter image description here

Just change from CRLF to LF.

If you use Git, you can change this in automatic via configuration.

like image 21
Greedo Avatar answered Oct 19 '25 18:10

Greedo