eslint

Caught between two no-restricted-syntax violations

佐手、 提交于 2020-02-21 10:09:45
问题 This is my original code: const buildTableContent = (settings) => { const entries = []; for (const key in settings) { for (const subkey in env[key]) { settings is basically a dictionary of dictionary { 'env': {'name': 'prod'}, 'sass: {'app-id': 'a123445', 'app-key': 'xxyyzz'} } It triggered the following AirBnb style guide error: 35:3 error for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the

Error: EACCES: permission denied when trying to install ESLint using npm

无人久伴 提交于 2020-02-16 13:45:09
问题 I'm trying to install ESLint with npm by going: npm install -g eslint However I get the following error: Deans-Air:~ deangibson$ npm install -g eslint npm ERR! tar.unpack untar error /Users/deangibson/.npm/eslint/2.4.0/package.tgz npm ERR! Darwin 15.3.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "eslint" npm ERR! node v4.2.3 npm ERR! npm v2.14.7 npm ERR! path /usr/local/lib/node_modules/eslint npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall mkdir npm ERR!

Error: EACCES: permission denied when trying to install ESLint using npm

旧城冷巷雨未停 提交于 2020-02-16 13:44:47
问题 I'm trying to install ESLint with npm by going: npm install -g eslint However I get the following error: Deans-Air:~ deangibson$ npm install -g eslint npm ERR! tar.unpack untar error /Users/deangibson/.npm/eslint/2.4.0/package.tgz npm ERR! Darwin 15.3.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "eslint" npm ERR! node v4.2.3 npm ERR! npm v2.14.7 npm ERR! path /usr/local/lib/node_modules/eslint npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall mkdir npm ERR!

Eslint检测出的问题如何自动修复

这一生的挚爱 提交于 2020-02-13 01:27:18
1. sublime 插件 eslintAutoFix 目前只试了windows下 真是大坑!如果你用了这个插件但不能自动修复,那就不要再用这个了!全网无解! 提示系统找不到指定的文件,各种路径加入系统变量以及配置文件都无用!心累! 不知道是不是不支持windows了??? 如果你碰巧使用正常了,可以留言告诉我怎么搞的,感谢! 2. 命令行eslint自动修复 全局安装eslint npm install eslint -g 运行 eslint --fix [file.js][dir] 修复前: 修复后: console手动注释即可, --fix不能完全修复 来源: https://www.cnblogs.com/saysmy/p/6637258.html

在VSCode中开启ESLint风格审查

我是研究僧i 提交于 2020-02-13 01:08:15
  最近一直在学习开发一个VUE项目,几乎没有前端基础摸爬滚打,就一边摸索HTML,JS,CSS一边模仿着已有代码开发,也还算能学到东西。   VSCode确实还不错,很轻量。在刚开始学写vue的时候,后台总是报各种错,什么空格多了少了,缩进不对,没用驼峰命名法都报错,很让人崩溃。后来才知道有个叫ESLint的东西: 官网入口: https://cn.eslint.org/    用了一段时间过后,觉得书写规范这个东西还是很重要的,之前写代码的时候,虽然也在意过,不过像这样严格的提醒是没有的,有时候也不注意了。    不过好归好,每次代码写完跳出来十几个甚至几十个红色error/warning还是让人很难受。从网上找了点资料,发现可以在VS里添加辅助工具。 步骤如下: 1. 安装ESLint: 在vscode左侧的extension处搜索ESLint并安装 2. file->preference->settings ,如果不是文本框点击那个open settings(JSON) 3.在用户设置中填写如下配置: { "eslint.autoFixOnSave": true, "eslint.alwaysShowStatus": true, "eslint.validate": [ "javascript", "javascriptreact", { "language": "html

Webstorm下安装ESLint检测JS代码

ε祈祈猫儿з 提交于 2020-02-12 22:13:02
今天配置下Webstorm下面的Eslint。 1,先看下本地安装的Node,NPM版本,2017-11-23日这个节点最新版本。 >node -v v8.9.1 >npm -v 5.5.1 2,使用Webstorm快捷键 Alt + F12 ,进入 Terminal 窗口,如下图 3,执行全局安装eslint npm install -g eslint 4,执行 eslint --init 初始化eslint配置文件,每一步根据自己需要选择YES or NO, C:\Users\XXXXXXX\WebstormProjects\es6tutorial>eslint --init ? How would you like to configure ESLint? Answer questions about your style ? Are you using ECMAScript 6 features? Yes ? Are you using ES6 modules? Yes ? Where will your code run? Browser ? Do you use CommonJS? No ? Do you use JSX? No ? What style of indentation do you use? Tabs ? What quotes do you use

Error: No ESLint configuration found.

谁都会走 提交于 2020-02-12 04:24:04
vue 开启项目报:Error: No ESLint configuration found. 受疫情影响在家里办公的时候,将之前公司做的(vue项目)项目拉下来,发现在启动项目的时候报错,将拷下来的目录和之前的比较,发现少了个相关js文件:.eslintrc.js,因为有些隐藏的文件是拷贝不下来的,就比如这个。eslintrc.js 报错的提示 1.拷下来的目录 2.项目可以启动后的目录 3. .eslintrc.js的代码 // https://eslint.org/docs/user-guide/configuring module . exports = { root : true , parserOptions : { parser : 'babel-eslint' } , env : { browser : true , } , extends : [ // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 'plugin:vue/essential

gitHooks使用

≡放荡痞女 提交于 2020-02-09 12:55:49
gitHooks使用 package.json配置: { "name": "eslint", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "core-js": "^3.6.4", "vue": "^2.6.11", "vue-router": "^3.1.5" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.2.0", "@vue/cli-plugin-eslint": "^4.2.0", "@vue/cli-plugin-router": "^4.2.0", "@vue/cli-service": "^4.2.0", "@vue/eslint-config-standard": "^5.1.0", "babel-eslint": "^10.0.3", "eslint": "^6.7.2", "eslint-plugin-import": "^2.20.1", "eslint-plugin-node": "^11.0.0",

默认package.json

为君一笑 提交于 2020-02-07 10:16:50
{ "name" : "bpmn-vue-basic" , "version" : "0.1.0" , "private" : true , "scripts" : { "serve" : "vue-cli-service serve" , "build" : "vue-cli-service build" , "lint" : "vue-cli-service lint" } , "dependencies" : { "axios" : "^0.19.0" , "bpmn-js-properties-panel" : "^0.33.0" , "camunda-bpmn-moddle" : "^4.3.0" , "core-js" : "^3.4.3" , "vue" : "^2.6.10" } , "devDependencies" : { "@vue/cli-plugin-babel" : "^4.1.0" , "@vue/cli-plugin-eslint" : "^4.1.0" , "@vue/cli-service" : "^4.1.0" , "babel-eslint" : "^10.0.3" , "bpmn-js" : "^6.0.4" , "eslint" : "^5.16.0" , "eslint-plugin-vue" : "^5.0.0" , "vue

构建vue项目

跟風遠走 提交于 2020-02-07 01:03:22
1 安装nodejs, 进入node官网 2 使用npm全局安装vue-cli npm i(install) vue-cli -g 3 新建一个文件夹,在该文件内打开命令窗口(在该文件shift+右击鼠标 -> 在此处打开命令窗口) 使用命令创建项目 vue init webpack [项目名称] 命令输入之后,会出现以下信息 Project name 注意:该项目名称不能输入中文 Project description 项目的描述 Author 作者 Vue build standalone Install vue-router? 是否安装vue-router Use ESLint to lint your code? 是否使用ESLint管理代码 ESLint是个代码风格管理工具,用来避免低级错误和统一代码的风格。(官网https://eslint.org/) Pick an ESLint preset 选择一个ESLint预设,代码风格 Setup unit tests with Karma + Mocha? 是否安装单元测试 Setup e2e tests with Nightwatch(Y/n)? 是否安装e2e (端到端) 测试 4 cd test进入该目录 5 安装依赖 npm install 可以安装淘宝镜像,打开命令行窗口,输入 npm install -g