eslint

ESLint - no-unused-expressions in ReactJS

自古美人都是妖i 提交于 2020-12-05 12:13:27
问题 Getting a ESLint error when copiling with babel: Line 28: Expected an assignment or function call and instead saw an expression no-unused-expressions Line 29: Expected an assignment or function call and instead saw an expression no-unused-expressions Any idea how to get rid of these whilst making my timer still work as intended? Or have you got a better way of me doing my timer? class RequestTimer extends Component { constructor(props) { super(props); this.state = { seconds: 0, minutes: 0,

安装Vue安装脚手架以及一直卡着不动的问题

…衆ロ難τιáo~ 提交于 2020-12-04 10:57:10
1.首先我们去nodejs官网: https://nodejs.org/en/download/ (下载nodejs,下载自己电脑想匹配的最新版本) 2.其次 去下载一个cnpm (注释:淘宝npm镜像,这个是阿里把外国的npm服务器搬到我们中国来了,用淘宝镜像npm下载一些配置文件会更快一些) 操作如下:电脑右下角 window输入cmd, 把 npm install - g cnpm -- registry = https :// registry . npm . taobao . org 复制到cmd里面去就可以拉。(注释:我们用ctrl+C 复制网站,在cmd中鼠标点击右键粘贴就可以复制 npm install - g cnpm -- registry = https :// registry . npm . taobao . org 然后回车键进行安装。 ) 3.安装vue文件 cnpm install i vue -S 4. 安装vue脚手架,关于脚手架问题, 有些兄弟姐妹会发现安装的时候会一直卡着不动,我也遇到过这个问题,最后查资料发现是我安装的vue脚手架版本比较低出现的问题 // 之前我安装的时候是用 cnpm install -g vue/cli 用这个安装的是旧版本的特别伤,我用vue init webpack app的时候,真的卡在一个地方一个晚上

How can I remove unused imports/declarations from the entire project of React Typescript?

一世执手 提交于 2020-12-01 07:26:24
问题 I'm trying to remove unused imports and declarations as answered in this SO thread for Angular. I'm trying to achieve the goal using eslint-plugin-react, but not found any option to remove the unused imports and daclarations from the entire project, with a single command. Here is my .eslintrc.json { "env": { "browser": true, "es2021": true }, "extends": [ "eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended" ], "parser": "@typescript-eslint/parser",

Vue.js+vue-element搭建属于自己的后台管理模板:创建一个项目(四)

删除回忆录丶 提交于 2020-12-01 04:27:28
Vue.js+vue-element搭建属于自己的后台管理模板:创建一个项目(四) 前言 本章主要讲解通过Vue CLI 脚手架构建工具创建一个项目,在学习Vue CLI之前我们需要先了解下webpack 代码编译工具,webpack 是一个现代 JavaScript 应用程序的静态模块打包器(module bundler)。 webpack 官方中文文档地址: https://www.webpackjs.com/concepts/ Vue CLI 脚手架构建工具 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统,搭建交互式的项目脚手架,Vue CLI版本3.x开始包名称由vue-cli 改成了 @vue/cli, 如果你已经全局安装了旧版本的 vue-cli (1.x 或 2.x),你需要先通过 npm uninstall vue-cli -g 卸载后再安装3.x版本,Vue CLI 需要 Node.js 8.9 或更高版本 (推荐 8.11.0+)。 安装Vue CLI 在命令行输入: cnpm install -g @vue/cli (安装新包) 我们这里推荐用vue-cli 3.x构建项目,新版优化了编译速度,不过你也可以通过老版本创建项目,老版本安装命令:cnpm install --global vue-cli 备注: 安装后,检查是否安装成功 。vue

module is not defined and process is not defined in eslint in visual studio code

那年仲夏 提交于 2020-11-30 07:49:51
问题 I have installed eslint in my machine and i have used visual studio code i have certain modules and process to be exported When i try to use "module" or "process" it shows it was working fine before. [eslint] 'module' is not defined. (no-undef) [eslint] 'process' is not defined. (no-undef) and here is my .eslintrc.json { "env": { "browser": true, "amd": true }, "parserOptions": { "ecmaVersion": 6 }, "extends": "eslint:recommended", "rules": { "no-console": "off", "indent": [ "error", "tab" ],

module is not defined and process is not defined in eslint in visual studio code

坚强是说给别人听的谎言 提交于 2020-11-30 07:48:27
问题 I have installed eslint in my machine and i have used visual studio code i have certain modules and process to be exported When i try to use "module" or "process" it shows it was working fine before. [eslint] 'module' is not defined. (no-undef) [eslint] 'process' is not defined. (no-undef) and here is my .eslintrc.json { "env": { "browser": true, "amd": true }, "parserOptions": { "ecmaVersion": 6 }, "extends": "eslint:recommended", "rules": { "no-console": "off", "indent": [ "error", "tab" ],

module is not defined and process is not defined in eslint in visual studio code

一个人想着一个人 提交于 2020-11-30 07:47:26
问题 I have installed eslint in my machine and i have used visual studio code i have certain modules and process to be exported When i try to use "module" or "process" it shows it was working fine before. [eslint] 'module' is not defined. (no-undef) [eslint] 'process' is not defined. (no-undef) and here is my .eslintrc.json { "env": { "browser": true, "amd": true }, "parserOptions": { "ecmaVersion": 6 }, "extends": "eslint:recommended", "rules": { "no-console": "off", "indent": [ "error", "tab" ],

module is not defined and process is not defined in eslint in visual studio code

怎甘沉沦 提交于 2020-11-30 07:47:09
问题 I have installed eslint in my machine and i have used visual studio code i have certain modules and process to be exported When i try to use "module" or "process" it shows it was working fine before. [eslint] 'module' is not defined. (no-undef) [eslint] 'process' is not defined. (no-undef) and here is my .eslintrc.json { "env": { "browser": true, "amd": true }, "parserOptions": { "ecmaVersion": 6 }, "extends": "eslint:recommended", "rules": { "no-console": "off", "indent": [ "error", "tab" ],

vscode如何配置ts的lint,如何配置才能让eslint和prettier不冲突一键格式化代码(vue开发使用)

拜拜、爱过 提交于 2020-11-30 07:26:02
最近在使用ts,发觉tslint在vscode上使用很不方便,不如eslint一键格式化高效,就想着能不能配置下vscode让其像写js一样爽 这篇文章主要解决2个问题,第一个是如何让vscode使用ts的lint,第二个是如何配置才能让eslint和prettier这2个代码格式化的vscode插件不互相冲突 ###vscode使用ts的lint 首先ts的lint已经不用tslint了,这个东东官方已经说不维护了,转过来做了个typescript-eslint这个eslint的插件 官方文档 https://github.com/typescript-eslint/typescript-eslint#getting-started 如果是一个干净的项目,按文档来肯定没有问题,为了写的更爽,提示更智能还是建议你继续往下读 搭配typescript-eslint 做一个更高效的配置 网上写的vscode配置eslint和prettier达到一键格式化的文章很多,个人觉得都差不多,而且文章里很多设置都已经过时了 我直接贴目前较新的写法,注释也比较清楚 { // 重新设定tabsize "editor.tabSize": 4, "prettier.tabWidth": 4, // 缩进字节数 // #每次保存的时候自动格式化 "editor.formatOnSave": true, /

How to handle eslint no-param-reassign rule in Array.prototype.reduce() functions

扶醉桌前 提交于 2020-11-30 06:13:34
问题 I've recently added the eslint rule no-param-reassign. However, when I use reduce to build out an object (empty object as initialValue ), I find myself needing to modify the accumulator (first arg of callback function) on each callback iteration, which causes a no-param-reassign linter complaint (as one would expect it would). const newObject = ['a', 'b', 'c'].reduce((result, item, index) => { result[item] = index; // <-- causes the no-param-reassign complaint return result; }, {}); Is there