eslint

eslint Parsing error: Unexpected token =

人盡茶涼 提交于 2020-03-18 11:45:03
问题 Why is eslint throwing this error? The Javascript runs without issue inside of React Native. The code was taken from the react-navigation example at : https://reactnavigation.org/docs/intro/ Javascript: static navigationOptions = { header: null }; eslint error: error Parsing error: Unexpected token = .eslintrc.js file: module.exports = { "extends": "standard", "plugins": [ "react", "react-native" ] }; 回答1: The syntax is not yet standardised, but a stage-2 proposal for inclusion in Javascript

v-for和v-if

China☆狼群 提交于 2020-03-17 15:31:13
有时在使用 vs code 编辑器里是 eslint 插件时一直会有一个报错:大致的意思就是不建议 v-if 和 v-for 一起使用 根据 eslint 指出的方法进行改进 : 第一种:将 v-if 和 v-for 分别放在不同标签中 < ul v - if = "active" > < li v - for = "item in list" : key = "item.id" > { { item . title } } < / li > < / ul > 第二种:如果 v-if 和 v-for 只能放在同一级标签中,使用计算属性进行改造: < ul > < li v - for = "user in users" v - if = "user.isActive" : key = "user.id" > { { user . name } } < / li > < / ul > 将会经过如下运算: this . users . map ( function ( user ) { if ( user . isActive ) { return user . name } } ) 这是因为当它们处于同一节点, v-for 的优先级比 v-if 更高,这意味着 v-if 将分别重复运行于每个 v-for 循环中。 通过将其更换为在如下的一个计算属性上遍历 : computed : {

vscode格式化配置

十年热恋 提交于 2020-03-17 11:52:55
一、安装常用插件: Ctrl+shift+x打开应用商店搜索这几个插件安装即可 Beautify、Eslint、Vetur 二、setting.josn配置 文件-首选项-设置-在setting.josn中编辑,打开这个setting.josn文件后将下面配置复制即可 { // tab 大小为2个空格 "editor.tabSize": 2, // 100 列后换行 "editor.wordWrapColumn": 100, // 保存时格式化 "editor.formatOnSave": true, // 开启 vscode 文件路径导航 "breadcrumbs.enabled": true, // prettier 设置语句末尾不加分号 "prettier.semi": false, // prettier 设置强制单引号 "prettier.singleQuote": true, // 选择 vue 文件中 template 的格式化工具 "vetur.format.defaultFormatter.html": "prettyhtml", // 显示 markdown 中英文切换时产生的特殊字符 "editor.renderControlCharacters": true, // 设置 eslint 保存时自动修复 "eslint.autoFixOnSave": true

How to configure Vue CLI 4 with ESLint + Prettier + Airbnb rules + TypeScript + Vetur?

拈花ヽ惹草 提交于 2020-03-17 07:38:21
问题 When creating a new project with Vue CLI v4.0.5 with checking the options for TypeScript and Linter / Formatter , you are given pre-configured options for linting and formatting: ? Pick a linter / formatter config: (Use arrow keys) > ESLint with error prevention only ESLint + Airbnb config ESLint + Standard config ESLint + Prettier TSLint (deprecated) I want to use Airbnb rules for ESLint with Prettier (format-on-save), with TypeScript parser and Vue CLI v4 . These configurations should also

How to configure Vue CLI 4 with ESLint + Prettier + Airbnb rules + TypeScript + Vetur?

二次信任 提交于 2020-03-17 07:38:06
问题 When creating a new project with Vue CLI v4.0.5 with checking the options for TypeScript and Linter / Formatter , you are given pre-configured options for linting and formatting: ? Pick a linter / formatter config: (Use arrow keys) > ESLint with error prevention only ESLint + Airbnb config ESLint + Standard config ESLint + Prettier TSLint (deprecated) I want to use Airbnb rules for ESLint with Prettier (format-on-save), with TypeScript parser and Vue CLI v4 . These configurations should also

Parsing Error The Keyword import is Reserved (SublimeLinter-contrib-eslint)

匆匆过客 提交于 2020-03-17 04:08:49
问题 I have a problem with eslint, it gives me [Parsing Error The keyword import is reserve] this is only occur in sublime, in atom editor work well. I have eslint .eslintrc.js module.exports = { "extends": "airbnb", "plugins": [ "react" ] }; package.json { "name": "paint", "version": "0.0.0", "description": "paint on the browser", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "paint", "javascript" ], "author": "", "license": "ISC",

Parsing Error The Keyword import is Reserved (SublimeLinter-contrib-eslint)

江枫思渺然 提交于 2020-03-17 04:07:46
问题 I have a problem with eslint, it gives me [Parsing Error The keyword import is reserve] this is only occur in sublime, in atom editor work well. I have eslint .eslintrc.js module.exports = { "extends": "airbnb", "plugins": [ "react" ] }; package.json { "name": "paint", "version": "0.0.0", "description": "paint on the browser", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "paint", "javascript" ], "author": "", "license": "ISC",

前端架构之初始化vue 2.x项目

大憨熊 提交于 2020-03-17 03:39:14
用vue-cli构建vue 2.x项目 环境要求 构建项目 环境要求 1. 检查是否安装node.js运行环境 //终端输入 node -v 2. 检查是否安装npm和cnpm包管理程序 //终端输入 npm -v cnpm -v // 淘宝镜像专用通道 3. 检查是否安装webpack构建工具 //终端输入 webpack -v 4. 检查是否安装vue-cli手脚架 //终端输入,这里是大写的"V" vue -V 确定以上环境都没问题后,那么我们就往前走,构建项目开始。 构建项目 第一步:直接在code目录(本人代码项目习惯)右键选择Git Bash Here(本着已安装git) 你们看着办 第二步:在终端开始安装命令 //终端输入,"project"是项目名称,大家随意,不要中文就行 vue init webpack project Administrator/d/code $ vue init webpack project--------------------- 安装项目命令 ? Project name (project) --------------------- 项目名称 ? Project name project ? Project description (A Vue.js project)--------------------- 项目描述 ?

项目常用eslint配置(Vue/React/TypeScript)

纵饮孤独 提交于 2020-03-16 17:47:38
项目常用eslint配置(Vue/React/TypeScript) 记录一下常用的eslint配置。 Vue项目常用eslint配置 需要安装依赖(Vue这里使用standard扩展和vue插件,所以需要安装) { "devDependencies": { "babel-eslint": "^10.0.2", "eslint": "^6.1.0", "eslint-config-imperative-es6": "^2.1.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.17.2", "eslint-plugin-node": "^5.2.0", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", "eslint-plugin-vue": "^4.7.1" // vue插件 } } .eslintrc.js文件配置 // https://eslint.org/docs/user-guide/configuring module.exports = { // 默认情况下,ESLint 会在所有父级目录里寻找配置文件,一直到根目录。ESLint 一旦发现配置文件中有 "root": true

配置vscode的vue环境变量

久未见 提交于 2020-03-16 08:27:44
安装插件 配置vscode的go环境变量 https://blog.csdn.net/weixin_41558061/article/details/100741278 配置 ESLint (需安装 Prettier - Code formatter 插件) command + shift + p 打开用户设置 或者 文件->首选项->设置: 搜索:Associations 打开settings.json // vscode默认启用了根据文件类型自动设置tabsize的选项 "editor.detectIndentation": false, // 重新设定tabsize "editor.tabSize": 2, "files.autoSave": "afterDelay", "files.autoSaveDelay": 3000, // #每次保存的时候自动格式化 "editor.formatOnSave": true, // #每次保存的时候将代码按eslint格式进行修复 "eslint.autoFixOnSave": true, // 添加 vue 支持 "eslint.validate": [ "javascript", "javascriptreact", { "language": "vue", "autoFix": true } ], //