Skip to content

Commit

Permalink
feat: add eslint detail
Browse files Browse the repository at this point in the history
  • Loading branch information
HOUSHENGREN committed May 20, 2023
1 parent 9fc5fb1 commit 3ca6421
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ module.exports = {
rules: {
'no-shadow': 'off',
'no-console': 'off', // 允许代码出现console.log
'no-param-reassign': 'off', // 允许修改function的入参
'react-hooks/exhaustive-deps': 'off',
// 'no-param-reassign': [
// // 允许修改function的入参 https://blog.csdn.net/weixin_43459866/article/details/114629507
// 'error',
// {
// props: true,
// ignorePropertyModificationsFor: [
// 'e', // for e.returnvalue
// 'ctx', // for Koa routing
// 'req', // for Express requests
// 'request', // for Express requests
// 'res', // for Express responses
// 'response', // for Express responses
// 'state', // for vuex state
// ],
// },
// ],
'react/jsx-filename-extension': 'off', // 关闭airbnb对于jsx必须写在jsx文件中的设置
'react/prop-types': 'off', // 关闭airbnb对于必须添加prop-types的校验
// 'react/destructuring-assignment': [
Expand Down
5 changes: 4 additions & 1 deletion src/components/FileList.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,17 @@ const FileList = forwardRef(

// https://stackoverflow.com/questions/41771217/react-linter-airbnb-proptypes-array
FileList.propTypes = {
files: propTypes.array,
files: propTypes.instanceOf(Array),
onFileClick: propTypes.func,
onFileDelete: propTypes.func,
onSaveEdit: propTypes.func,
};

FileList.defaultProps = {
files: [],
onFileClick: () => {},
onFileDelete: () => {},
onSaveEdit: () => {},
};

export default FileList;
4 changes: 2 additions & 2 deletions src/components/TabList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function TabList({ files, activeId, unsaveIds, onTabClick, onCloseTab }) {
}

TabList.propTypes = {
files: propTypes.array,
unsaveIds: propTypes.array,
files: propTypes.instanceOf(Array),
unsaveIds: propTypes.instanceOf(Array),
};

TabList.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/reportWebVitals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const reportWebVitals = onPerfEntry => {
const reportWebVitals = (onPerfEntry) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/defaultFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ const defaultFiles = [

export default defaultFiles;

console.log('99', defaultFiles);
console.log('defaultFiles', defaultFiles);

0 comments on commit 3ca6421

Please sign in to comment.