eslint

使用typescript改造koa开发框架

倾然丶 夕夏残阳落幕 提交于 2020-02-04 14:36:42
原文地址: 使用typescript改造koa开发框架 强类型的 TypeScript 开发体验和维护项目上相比 JavaScript 有着明显的优势,那么对常用的脚手架进行改造也就势在必行了。 接下来开始对基于 koa 框架的 node 后端脚手架进行改造: 项目开发环境 和 typescript 编译环境的搭建; 对 node 、 koa 、koa中间件和使用到的库 添加类型化支持; 基于 typesript 的特性改造项目。 项目开发环境搭建 基于 gulp 搭建开发编译环境, gulp-typescript 插件用于编译 typescript 文件, gulp-nodemon 则可以监控文件内容的变更,自动编译和重启 node 服务,提升开发效率。 npm install -D gulp gulp-nodemon gulp-typescript ts-node typescript gulp 的配置 gulpfile.js 的设置 const { src, dest, watch, series, task } = require('gulp'); const del = require('del'); const ts = require('gulp-typescript'); const nodemon = require('gulp-nodemon'); const

Definition for rule 'react/require-extension' was not found

不想你离开。 提交于 2020-02-04 08:42:13
问题 I have started to use Atom to work react-native.When I open index.js from Atom.I am getting error such as "definition for rule 'react/require-extension' was not found" top of the code line.I think ,ıt couldn't import @format . I don't know exactly. I am newbie at react.Any experience about this trouble or any advise ? enter image description here enter image description here 回答1: If you are using eslint for your ReactNative project then edit your .eslintrc file and add this snip of code

Definition for rule 'react/require-extension' was not found

帅比萌擦擦* 提交于 2020-02-04 08:42:00
问题 I have started to use Atom to work react-native.When I open index.js from Atom.I am getting error such as "definition for rule 'react/require-extension' was not found" top of the code line.I think ,ıt couldn't import @format . I don't know exactly. I am newbie at react.Any experience about this trouble or any advise ? enter image description here enter image description here 回答1: If you are using eslint for your ReactNative project then edit your .eslintrc file and add this snip of code

How can I synchronise eslint or setup similar tslint and prettier with typescript?

让人想犯罪 __ 提交于 2020-02-02 13:01:45
问题 I've an existing React/Redux project and I've started using typescript in my project. I've already setup my eslint configuration for the project which extends the airbnb eslint configurations. My eslint is as follows: module.exports = { "parser": "babel-eslint", "extends": [ "airbnb", "plugin:flowtype/recommended" ], "plugins": [ "react", "jsx-a11y", "flowtype" ], "env": { "browser": true, "node": true, "es6": true }, "globals": { "__DEV__": true, "__SERVER__": true, "__": true, "define":

npm模块管理器

陌路散爱 提交于 2020-02-01 11:04:08
本文转自阮一峰老师教程:链接: http://javascript.ruanyifeng.com/nodejs/npm.html#toc2 npm模块管理器 来自 《JavaScript 标准参考教程(alpha)》 ,by 阮一峰 目录 简介 npm init npm set npm config npm info npm search npm list npm install 基本用法 安装不同版本 避免系统权限 npm update,npm uninstall npm run 参数 scripts脚本命令最佳实践 pre- 和 post- 脚本 内部变量 通配符 npm link npm bin npm adduser npm publish npm deprecate npm owner 其他命令 npm home,npm repo npm outdated npm prune npm shrinkwrap 参考链接 重要说明:本教程已经搬迁,此处不再维护,请访问新网址: wangdoc.com/javascript 。 简介 npm 有两层含义。一层含义是Node的开放式模块登记和管理系统,网址为 npmjs.org 。另一层含义是Node默认的模块管理器,是一个命令行下的软件,用来安装和管理Node模块。 npm 不需要单独安装。在安装Node的时候,会连带一起安装

VUE3.X版本@vue/cli 3.x遇到error: Parsing error: Unexpected token解决办法

爷,独闯天下 提交于 2020-02-01 01:42:17
使用@vue/cli 3.x和eslint时遇到了如下截图变态的报错,其实与代码无关 解决办法: 1. 安装eslint-plugin-vue依赖 2.在.eslint.js配置文件中添加如下配置: parser: “vue-eslint-parser”, 如截图: 来源: CSDN 作者: FreeSoar1 链接: https://blog.csdn.net/u011846249/article/details/103811359

vue.js三种安装方式

大憨熊 提交于 2020-02-01 00:02:05
Vue.js(读音 /vjuː/, 类似于 view)是一个构建数据驱动的 web 界面的渐进式框架。Vue.js 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件。它不仅易于上手,还便于与第三方库或既有项目整合。 下面介绍三种 Vue.js 的安装方法: 独立版本 我们可以在Vue.js的官网上直接下载vue.js,并在html中通过 <script> 标签中引用。 <script src = ../vue.js> </script> 开发环境不要使用最小压缩版,不然会没有错误提示和警告!(页面中直接使用) 使用vue多页面开发: 引入vue.js 创建一个vue根实例 new Vue({选项}) 使用CDN方法 BootCDN(国内) : https://cdn.bootcss.com/vue/2.2.2/vue.min.js , (国内不稳定) unpkg: https://unpkg.com/vue/dist/vue.js , 会保持和 npm 发布的最新的版本一致。(推荐使用) cdnjs : https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js,如 ( <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue

WebStrom 使用 ESLint 规则格式化

一世执手 提交于 2020-01-31 20:34:11
以 WebStorm 2019.3.1 为例 参考 How to make WebStorm format code according to eslint? ph.dev 的回答 Plug-ins | JavaScript and TypeScript | Fix ESLint Problems 快捷键设置为 格式化 的快捷键 确保 ESLintPreferences | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint 选项正确 来源: CSDN 作者: jonsalam 链接: https://blog.csdn.net/xshhou/article/details/104125692

Vue.js 组件编码规范

倾然丶 夕夏残阳落幕 提交于 2020-01-31 05:31:31
Vue.js 组件编码规范( 最下文附有本人写的demo地址 ) 目标 本规范提供了一种统一的编码规范来编写 Vue.js 代码。这使得代码具有如下的特性: 其它开发者或是团队成员更容易阅读和理解。 IDEs 更容易理解代码,从而提供高亮、格式化等辅助功能 更容易使用现有的工具 更容易实现缓存以及代码包的分拆 本指南为 De Voorhoede 参考 RiotJS 编码规范 而写。 目录 将 this 赋值给 component 变量 使用组件名作为样式作用域空间 对组件文件进行代码校验 基于模块开发 始终基于模块的方式来构建你的 app,每一个子模块只做一件事情。 Vue.js 的设计初衷就是帮助开发者更好的开发界面模块。一个模块是应用程序中独立的一个部分。 怎么做? 每一个 Vue 组件(等同于模块)首先必须专注于解决一个 单一的问题 , 独立的 , 可复用的 , 微小的 and 可测试的 。 如果你的组件做了太多的事或是变得臃肿,请将其拆分成更小的组件并保持单一的原则。一般来说,尽量保证每一个文件的代码行数不要超过 100 行。也请保证组件可独立的运行。比较好的做法是增加一个单独的 demo 示例。 Vue 组件命名 组件的命名需遵从以下原则: 有意义的 : 不过于具体,也不过于抽象 简短 : 2 到 3 个单词 具有可读性 : 以便于沟通交流 同时还需要注意: 必须符合

ESLint: How to set .eslintrc to recognize 'require'?

╄→尐↘猪︶ㄣ 提交于 2020-01-30 19:32:32
问题 I am new to ESLint, and I have successfully integrated ESLint with IntelliJ. Out of the box, my integration of ESLint did not recognize node , but basic review of documentation made clear that by creating the configuration file named .eslintrc at the root of my project folder (with the proper IntelliJ setting to access this file) and setting "node":true , ESLint recognizes node (i.e., the following complete .eslintrc works). // Contents of .eslintrc at root of project - support for Node and