eslint

Typescript: Why doesn't visual studio code report the same errors that the command line tsc does?

扶醉桌前 提交于 2020-03-25 13:48:34
问题 If I intentionally make a typo in my code I will get an error. Here is the correct code: declare const State: TwineState; If I delete the last character and then type tsc on the command line, it gives me this error: tsc/prod.spec.ts:7:22 - error TS2304: Cannot find name 'TwineStat'. 7 declare const State: TwineStat; But Visual Studio Code doesn't seem to realize there's any error. How I get my editor to show me the same errors that the tsc command recognizes? I'm pretty new to all these

Typescript: Why doesn't visual studio code report the same errors that the command line tsc does?

淺唱寂寞╮ 提交于 2020-03-25 13:48:09
问题 If I intentionally make a typo in my code I will get an error. Here is the correct code: declare const State: TwineState; If I delete the last character and then type tsc on the command line, it gives me this error: tsc/prod.spec.ts:7:22 - error TS2304: Cannot find name 'TwineStat'. 7 declare const State: TwineStat; But Visual Studio Code doesn't seem to realize there's any error. How I get my editor to show me the same errors that the tsc command recognizes? I'm pretty new to all these

Vue取消eslint语法限制

妖精的绣舞 提交于 2020-03-23 16:22:10
eslint是一个语法检查工具,但是限制很严格,在我的vue文件里面很多空格都会导致红线(红线可以关闭提示),虽然可以关闭,但是在编译的时候老是会跳出来,所以能关闭是最好的了。 关闭方法: 在build/webpack.base.conf.js文件中,注释或者删除掉:module->rules中有关eslint的规则 module: { rules: [ //...(config.dev.useEslint ? [createLintingRule()] : []), // 注释或者删除 { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, ... } ] } 来源: https://www.cnblogs.com/xtjatswc/p/10308440.html

Vue取消eslint语法限制

♀尐吖头ヾ 提交于 2020-03-23 16:21:55
话不多说,先上图: 当然,这里的警告我是知道怎么回事,原来eslint是一个语法检查工具,但是限制很严格,在我的vue文件里面很多空格都会导致红线警告(可以屏蔽),虽然可以屏蔽,但是在编译的时候老是会跳出来一堆警告出来,所以能完全关闭语法的限制是最好的了。 关闭方法: 在build/webpack.base.conf.js文件中,注释或者删除掉:module->rules中有关eslint的规则: module: { rules: [ //...(config.dev.useEslint ? [createLintingRule()] : []), // 注释或者删除 { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, ... } ] } 来源: https://www.cnblogs.com/520BigBear/p/10605156.html

团队协作editconfig与eslint

泪湿孤枕 提交于 2020-03-23 16:21:45
editconfig root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true .eslintrc 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', // https://github.com/standard/standard/blob/master/docs/RULES-en.md 'standard' ], // required to lint *.vue

vue-cli vue脚手架

眉间皱痕 提交于 2020-03-22 18:22:54
都说Vue2简单上手容易,的确,看了官方文档确实觉得上手很快,除了ES6语法和webpack的配置让你感到陌生,重要的是思路的变换,以前用jq随便拿全局变量和修改dom的锤子不能用了,vue只用关心数据本身,不用再频繁繁琐的操作dom,注册事件、监听事件、取消事件。。。。(确实很烦)。vue的官方文档还是不错的,由浅到深,如果不使用构建工具确实用的很爽,但是这在实际项目应用中是不可能的,当用vue-cli构建一个工程的时候,发现官方文档还是不够用,需要熟练掌握es6,而vue的全家桶(vue-cli,vue-router,vue-resource,vuex)还是都要上的。 vue-cli这个构建工具大大降低了webpack的使用难度,支持热更新,有webpack-dev-server的支持,相当于启动了一个请求服务器,给你搭建了一个测试环境,只关注开发就OK。 1.安装vue-cli ① 使用npm(需要安装node环境)全局安装webpack,打开命令行工具输入: npm install webpack -g 或者( npm install -g webpack ),安装完成之后输入 webpack -v ,如下图,如果出现相应的版本号,则说明安装成功。 注意:webpack 4.X 开始,需要安装 webpack-cli 依赖 ,所以使用这条命令 npm install

使用gulp构建自动化工作流

余生长醉 提交于 2020-03-22 03:10:43
简单易用 高效构建 高质量的生态圈 可能很多人会说现在提gulp也太落后了吧,但我想说写点东西并不是为了讨论它是否过时,而是来帮助我们自己来记忆、整理和学习。任何工具,我需要,我才去使用它,正如此时我需要gulp一样。 为了效率而使用工具 安装 全局安装 gulp命令: $ npm install --global gulp-cli 作为项目的开发依赖(devDependencie)安装: $ npm install --save-dev gulp 创建配置文件 在项目根目录下创建一个名为 gulpfile.js 的文件: touch gulpfile.js API gulp.src(globs[, options]) 读取目标源文件 gulp.dest(path[, options]) 向目标路径输出结果 gulp.pipe() 将目标文件通过插件处理 gulp.watch(glob [, opts], tasks) 或 gulp.watch(glob [, opts, cb]) 监视文件系统,并且可以在文件发生改动时候做一些事情 gulp.task(name[, deps], fn): 任务 定义一个gulp任务 使用 当配置完gulp.file后运行 gulp: $ gulp 常用工具插件 gulp-sass sass/scss编译 gulp-eslint js代码校对

eslint 配置规则介绍

坚强是说给别人听的谎言 提交于 2020-03-21 12:02:22
eslint中文网 "no-alert": 0,//禁止使用alert confirm prompt "no-array-constructor": 2,//禁止使用数组构造器 "no-bitwise": 0,//禁止使用按位运算符 "no-caller": 1,//禁止使用arguments.caller或arguments.callee "no-catch-shadow": 2,//禁止catch子句参数与外部作用域变量同名 "no-class-assign": 2,//禁止给类赋值 "no-cond-assign": 2,//禁止在条件表达式中使用赋值语句 "no-console": 2,//禁止使用console "no-const-assign": 2,//禁止修改const声明的变量 "no-constant-condition": 2,//禁止在条件中使用常量表达式 if(true) if(1) "no-continue": 0,//禁止使用continue "no-control-regex": 2,//禁止在正则表达式中使用控制字符 "no-debugger": 2,//禁止使用debugger "no-delete-var": 2,//不能对var声明的变量使用delete操作符 "no-div-regex": 1,//不能使用看起来像除法的正则表达式/=foo

VUE 脚手架搭建

冷暖自知 提交于 2020-03-18 22:01:48
npm install vue-cli -g vue init webpack projectName $ vue init webpack exprice --------------------- 这个是那个安装vue脚手架的命令 This will install Vue 2.x version of the template. ---------------------这里说明将要创建一个vue 2.x版本的项目 For Vue 1.x use: vue init webpack#1.0 exprice ? Project name (exprice) ---------------------项目名称 ? Project name exprice ? Project description (A Vue.js project) ---------------------项目描述 ? Project description A Vue.js project ? Author Datura --------------------- 项目创建者 ? Author Datura ? Vue build (Use arrow keys) ? Vue build standalone ? Install vue-router? (Y/n) ---------------------

eslint Parsing error: Unexpected token =

给你一囗甜甜゛ 提交于 2020-03-18 11:45:26
问题 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