- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 React 和 NPM 构建一个应用程序。
我已经像这样设置了我的 package.json
{
"name": "mouseflow-react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "7.7.4",
"@material-ui/core": "^4.1.3",
"@material-ui/icons": "^4.1.3",
"@material-ui/styles": "^4.2.1",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.0",
"babel-eslint": "10.0.3",
"babel-jest": "^24.9.0",
"babel-loader": "8.0.6",
"babel-plugin-named-asset-import": "^0.3.5",
"babel-preset-react-app": "^9.1.0",
"camelcase": "^5.3.1",
"case-sensitive-paths-webpack-plugin": "2.2.0",
"cookie": "^0.4.0",
"css-loader": "3.2.0",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-react-app": "^5.1.0",
"eslint-loader": "3.0.2",
"eslint-plugin-flowtype": "3.13.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.16.0",
"eslint-plugin-react-hooks": "^1.6.1",
"file-loader": "4.3.0",
"fs-extra": "^8.1.0",
"html-webpack-plugin": "4.0.0-beta.5",
"http-proxy-middleware": "^0.20.0",
"identity-obj-proxy": "3.0.0",
"jest": "24.9.0",
"jest-environment-jsdom-fourteen": "0.1.0",
"jest-resolve": "24.9.0",
"jest-watch-typeahead": "0.4.2",
"mini-css-extract-plugin": "0.8.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"pnp-webpack-plugin": "1.5.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "8.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-app-polyfill": "^1.0.5",
"react-dev-utils": "^10.0.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"resolve": "1.12.2",
"resolve-url-loader": "3.1.1",
"sass-loader": "8.0.0",
"semver": "6.3.0",
"style-loader": "1.0.0",
"terser-webpack-plugin": "2.2.1",
"ts-pnp": "1.1.5",
"url-loader": "2.3.0",
"webpack": "4.41.2",
"webpack-dev-server": "3.9.0",
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "4.3.1"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": ["react-app", "airbnb"],
"rules": {
"no-underscore-dangle": 0,
"react/jsx-indent-props": [
"error",
4
],
"react/jsx-indent": [
"error",
4
],
"indent": [
"error",
4
],
"semi": [
"error",
"always"
],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline"
}
]
}
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"roots": [
"<rootDir>/src"
],
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
],
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupFilesAfterEnv": [
"<rootDir>/src/setupTests.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
],
"testEnvironment": "jest-environment-jsdom-fourteen",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"modulePaths": [],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
],
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"babel": {
"presets": [
"react-app"
]
}
}
但是当我运行 npm start
时,我在控制台中收到以下错误:
Failed to compile.
./src/store/dashboards/reducers.js
Line 29:43: Unexpected dangling '_' in '_id' no-underscore-dangle
Line 36:36: Unexpected dangling '_' in '_id' no-underscore-dangle
Search for the keywords to learn more about each error.
我正在使用 VS Code,并且更改 package.json 中的 eslintConfig 属性似乎适用于 IDE,但不适用于运行应用程序。我还尝试添加: /* eslint-disable no-underscore-dangle */
到 ./src/store/dashboards/reducers.js
的顶部。同样,它似乎是向编辑器注册,而不是向编译器注册。我还尝试将 eslint 配置提取到其自己的文件 .eslintrc
中。仍然没有编译。
您可以在此处查看完整的存储库:https://github.com/bensoutendijk/mouseflow-react
最佳答案
@devaent 的解决方案(重新安装 node_modules
和 yarn.lock
)有很大帮助,但我不得不重新做每次我向 .eslintrc.json
添加另一条规则时。
过去三天我一直深受其苦,幸运的是今天找到了另一个解决方案。
在 config/webpack.config.js
的第 340 行添加 useEslintrc: true
如下,它对我有用。
options: {
cache: true,
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname,
useEslintrc: true, // <= added line
},
我从这篇文章中得到了这个想法[ link ].
仅供引用,我在下面分享我的 .eslintrc.json
。
{
"env": {
"browser": true,
"commonjs": true,
"es2020": true
},
"extends": ["react-app", "plugin:react/recommended", "airbnb"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11
},
"plugins": ["react"],
"rules": {
"no-unused-vars": 0,
"react/jsx-filename-extension": 0,
"linebreak-style": 0,
"jsx-quotes": 0,
"object-curly-newline": 0,
"react/prop-types": 0,
"react/destructuring-assignment": 0,
"comma-dangle": 0,
"arrow-body-style": 0,
"implicit-arrow-linebreak": 0,
"no-else-return": 0,
"array-bracket-spacing": 0,
"react/button-has-type": 0,
"import/prefer-default-export": 0,
"func-names": 0,
"no-underscore-dangle": 0,
"react/jsx-one-expression-per-line": 0,
"operator-linebreak": 0,
"jsx-a11y/media-has-caption": 0
}
}
关于javascript - 有没有办法更改弹出的 create-react-app 的 eslint 规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59417732/
我连续有 11 个图像,如果鼠标悬停在其中一个图像上,我希望弹出一个弹出窗口。所以每 11 个图像都有不同的弹出窗口。我已经有一些代码可以执行此操作,但它仅适用于第一张图像。 代码:index.htm
是否可以从 NSColorWell 制作一个 NSColorPanel“弹出”,几乎像一个弹出菜单? 我不喜欢它作为调色板的实现方式,因为有时它与哪个 NSColorWell 关联并不明显。 谢谢!
我正在考虑一个想法,基本上我想要一个带有 NSPopoverController 的 NSStatusItem 。我读到了人们遇到的所有问题,但我只是想尝试一下。现在有干净的方法吗?我见过的所有版本都
如何获取 JS 打开的弹出窗口的 url。这是我的代码: var _url = 'someurlhere'; var popupwindow = window.open(_url, "Popu
我正在设计一个网页,我希望当用户单击链接时,弹出窗口(新窗口)将打开一个链接网页。我的代码如下所示 function win(add,w,h) { window.open(add,"","widt
我正在寻找 C 中的简单堆栈实现,并找到了类似的东西: void pop(struct stack **top) { struct stack *temp; temp = malloc(s
我正在尝试使用 paypal 实现登录,我有 2 个不同的主机域 1- www.example.com 2- www.example.de 对于 paypal,我需要为此目的选择一个返回 URL,我选
我正在尝试找出如何复制此处显示的“弹出式” View 动画:https://imgur.com/a/irFqdiP .我正在使用当前代码来显示我的 viewController,但目前只有一个淡入淡出
有谁知道在 Windows 2000 或更高版本上以编程方式关闭 CD 托盘的方法?打开 CD 托盘存在,但我似乎无法关闭它,尤其是在 W2k 下。 如果可能的话,我特别想从批处理文件中寻找一种方法来
当您访问http://www.daniweb.com时你得到一个弹出窗口,这叫什么 + 知道怎么做吗? 感谢您的回复,只有模态加载动画的最简单方法是什么,即页面加载时动画显示以及动画何时完成? ASP
我正在为 Unity 引擎中的音频过滤器创建一个 C# 脚本。 我的问题是,在通过我的过滤器运行后,生成的音频具有一致且频繁的“咔哒声”、“砰砰声”或“跳过声”。听起来有点像旧 radio 。 我不确
我必须隐藏浏览器的地址栏。我正在使用这段代码: var winFeature = 'location=no,toolbar=no,menubar=no,scrollbars=yes,r
推荐一个button 弹起pickerview的源码,也可以作为工具类使用。 利用inputview 做键盘弹起动画。该如何做呢? 1.继承uiview 2.重写属性&方法
我在这里有一个问题,我已经工作了几个小时。 我正在导入一个 Excel 文件,并使用此代码来执行此操作: Dim objExcel As Excel.Application Di
我基本上是从 UITableViewController 推送 UIView,它包含的只是 UIWebView。但是,当我删除 UIView 以返回到 UITableView 时,应用程序崩溃了。 -
我有几个由导航 Controller 控制的 View Controller 。 例如,viewController A 和 viewController B 都可以将 viewController
我使用新的Gmail API为用户创建草稿。 API响应提供了新创建的消息ID。 然后,我可以使用URL https://mail.google.com/mail/#drafts?compose=[m
Redis列表实现了哪种内部数据结构以实现这一目的?链表将需要O(n)索引,而数组将需要O(n)左/右推/弹出。 最佳答案 根据official documentation,它们被实现为linked
我正在使用 WPF Popup 控件,它显示背景为黑色。我在其中放置了一个 StackPanel 并设置了 Background="Transparent",但这没有帮助。
我希望页面内的容器在事件时占据页面的整个宽度并覆盖在其他所有内容上。这是我目前所拥有的,但它没有按我想要的方式工作: $(function() { $('.main a').click( fu
我是一名优秀的程序员,十分优秀!