reactjs - React Native 中的 ESLint 不在命令行中进行 linting
问题描述
我刚刚将 ESLint 安装到 React Native (create-react-native-app)
.eslintrc.json
{
"env": {
"browser": true,
"es6": true,
"react-native/react-native": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react",
"react-native"
],
"rules": {
"no-var": "error",
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 2,
"react-native/no-color-literals": 2,
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
]
}
}
一切正常,但不是我的组件。所以我的文件夹结构看起来像:
root: src 组件内容...
linter 在编辑器(Sublime)中工作,但不在命令行(iTerm2)中
解决方案
使用 eslint 可以执行 eslint ./src 来验证整个文件夹。
推荐阅读
- blazor - Blazorise DataGrid 在所有行上编辑一列,然后更新
- c++ - QImage/QPixmap + .xpm 文件大小限制?
- node.js - Vaadin 应用程序在 Heroku 上成功部署,但未加载前端
- node.js - Brain.js 没有使用 GPU 进行训练
- swift - 如何从 Struct 更新 ViewController 中的 imageView
- node.js - 在 aws lambda 上锐利。使用 .toBuffer 时设备上没有剩余空间
- postgresql - 如何修复 org.postgresql.util.PSQLException: ERROR: op ANY/ALL (array) requires array on the right side
- c - C中的函数指针转换
- amazon-web-services - 使用 AWS 数据 api 连接到 Aurora Postgres 数据库的秘密字符串应该采用什么格式?
- google-apps-script - Google Apps 脚本 - 如何授予编辑者访问基于电子表格的文件的权限?