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 ";"
Click the LF / CLRF icon int he bottom right corner and change it to what you need.
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
In the bottom right corner you can change the line ending character:
Just change from CRLF to LF.
If you use Git, you can change this in automatic via configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With