问题标签 [eslint]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - npm:如何一次安装所有依赖项
我安装eslint并在运行命令时,npm run lint然后每次它要求一一安装所有依赖项。是否有任何命令选项可以安装一次而不是一直运行npm run lint?
package.json
eslint - 找不到模块“eslint-plugin-angular”
我正在尝试将 ESLint 集成到我的项目中,但运行时遇到错误: “找不到模块 'eslint-plugin-angular'”$ eslint *.js。
我可以让它运行的唯一方法是全局安装 eslint-plugin-angular,但这似乎是错误的(除非我错过了什么??)。
我在跑:
- 节点 v0.12.7
- npm 3.3.4
- eslint v1.5.0
- eslint-plugin-angular 0.12.0
ESLint 是全局安装的。
我的package.json文件有以下条目:
- "eslint": "^1.5.0",
- "eslint-plugin-angular": "^0.12.0",
我已经$ rm -rf node_modules重新运行$ npm install以确保没有某种 npm 依赖问题或损坏。我还验证了目录权限node_modules以确保可以访问。
我的.eslintrc包含:
我在这里想念什么?谢谢!附言。我确实在 github 上开了一张票:https ://github.com/Gillespie59/eslint-plugin-angular/issues/222——只是想知道 Stack 社区中是否有人遇到过这个问题。
webstorm - 如何使用 ESLint 在 webstorm 中重构/重新设计代码
我在我的项目中添加了一个 ESLint 文件,现在我的代码中有 1,000 条“警告”和红线。有没有办法将 webstorm 配置为使用 ESLint 文件来使用该 lint 文件重构我的代码?
jshint - ESLINT:将数值传递给配置文件中的规则?
刚开始配置 aslant 配置文件 (.eslintrc),我发现了一些示例,它们似乎将数值传递给规则,但我无法确认这些值的含义。例如
2代表什么?0是什么?有1吗?
文档似乎没有概述这一点。我对如何进行有点困惑。
node.js - Node.js 和 eslint 不同意“使用严格”
ESLint 告诉我我不需要"use strict"在 index.js 文件的顶部(它是一个简单的服务器,如https://nodejs.org/en/about/上的 6 行服务器)。显然所有节点模块都已经处于严格模式。说得通。
但是,运行node index.js给我一个“SyntaxError: [let] not supported outside strict mode”。确实使用“冗余”"use strict"编译指示运行。
为什么不一致?node 不应该知道这个 node 模块默认情况下确实是严格的吗?这可能是由于节点、ESLint 或我的 IDE 的一些简单配置错误造成的吗?
javascript - React Native & Webpack: Confusing when ESLint detects errors
For a React Native project, I'm using react-native-webpack-server, babel, eslint and the webpack-hotloader
When ESLint detects errors in my Javascript code, the iOS simulator still refresh the app and display the stacktrace. But instead displaying errors reported by ESLint, I've of errors from index.ios.bundle that can be confusing and hard to debug.
For instance with this code:
I have this error reported by ESLint:
And this error reported y the simulator (so React Native):
This error message isn't really straightforward.
I wonder if there is a more efficient way to use ESLint, maybe by showing the errors directly in the simulator?
Here is my webpack.config.js:
And .eslintrc:
Any suggestion?
javascript - ESLint 错误我无法弄清楚
我正在使用 ESLint 1.1.0 对我的 javascript 文件进行 lint。我收到“id-match”规则错误。这是规则定义:
它抱怨的代码在这里:
错误信息是:
32:25 错误标识符 'Date' 与模式 '^[az,$]+([AZ][az]+)*$' 不匹配
我难住了。
javascript - eslint / eslint-plugin-react:
我有一个带有表单的组件:
<form action="javascript:void(0)" onSubmit={this.join}>
埃斯林特抱怨:
错误脚本 URL 是 eval no-script-url 的一种形式
注意:我也在使用“eslint-plugin-react”
我该如何放宽这条规则,或者什么可以替代 javascript void 函数?

