eslint

eslint - Optional chaining error with vscode

痴心易碎 提交于 2021-01-26 03:10:21
问题 I am seeing a a red underline when I'm using an optional chain, but the code runs fine as I am on node 14 Here's my setup: node 14.1.0 eslint "^6.8.0" .eslintrc.js module.exports = { "env": { "node": true }, "extends": [ "eslint:recommended", ], "parserOptions": { "sourceType": "module", "ecmaVersion": 2020 }, "rules": { }, } 回答1: You should use babel-eslint with your eslint config. This allows you to lint ALL valid Babel code with eslint. Currently eslint does not support all ES2020 features

.eslintrc.js for React 17 and JSX without import 'react'

天涯浪子 提交于 2021-01-24 09:32:05
问题 in react 17 is not necessarily use import React from 'react'; but if i don't have it, so eslint gave me error 'React' must be in scope when using JSX react/react-in-jsx-scope any idea how modify .eslintrc.js module.exports = { parser: "babel-eslint", env: { browser: true, node: true, es6: true, jest: true, }, extends: [ "eslint:recommended", "plugin:react/recommended", "plugin:jsx-a11y/recommended" ], plugins: [ "react", "react-hooks", "jsx-a11y", ], rules: { strict: 0, "react-hooks/rules-of

Expected catch() or return (promise/catch-or-return)

↘锁芯ラ 提交于 2021-01-22 08:57:59
问题 I am new to JavaScript.This is my first function in javascript to deploy a function on the firebase. Got this error: - [eslint] Unexpected function expression. (prefer-arrow-callback) - [eslint] Expected catch() or return (promise/catch-or-return) What is wrong with this function? const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.grantSignupReward = functions.database.ref('/users/{uid}/last

React17+React Hook+TS4 最佳实践 仿 Jira 企业级项目

送分小仙女□ 提交于 2021-01-21 21:03:33
download: React17+React Hook+TS4 最佳实践 仿 Jira 企业级项目 React17 + React Hook + TypeScript4 已成为大型React 项目质量保证的代名词,更是 2021年优秀 React 开发者必备的技术。本课程将通过完成一个功能强大的任务管理项目,带领大家掌握最佳实践,全方位提升开发效率、开发质量和技术能力。 技术要求 有 React 基础 环境参数 React 17.0.1 / TypeScript 4.0.5 / react-router : 6.0.0 / create-react-app 4.0.1 react-query: 1.0.0 / emotion: 10.0.35 / cypress: 6.1.0 / jest: 26.6.3 章节目录: 第一章课程介绍(本课程是必看的)试看 介绍了课程整体的背景知识、能解决什么问题、学习后能得到什么、学习方法和学习前提。 总共保存2节(12分钟)列表 1-1课程指南(11:06 )试试 下载1-2课程源 第二章项目出航:项目初始化与配置 本章介绍Create-React-App初始化项目。 然后,构成eslint检查代码质量、prettier检查代码格式、commitlint检查提交信息,规范流程。 最后配置优秀的后端mock方案,在JSON SERVER第3

Is it possible to show warnings instead of errors on ALL of eslint rules?

老子叫甜甜 提交于 2021-01-21 12:11:41
问题 As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules? I'm using Standard JS, if that information is relevant. Thanks! 回答1: I think there's no out-of-the-box option right now, but maybe you could use a plugin to archieve that: Eslint plugin only warn Or set all the rules ar warning instead of errors. 回答2: Following es-lint-plugin-prettier readme, edit your .eslintrc.json and put a specific rule for prettier : "rules": { // maybe your other

Is it possible to show warnings instead of errors on ALL of eslint rules?

别说谁变了你拦得住时间么 提交于 2021-01-21 12:07:53
问题 As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules? I'm using Standard JS, if that information is relevant. Thanks! 回答1: I think there's no out-of-the-box option right now, but maybe you could use a plugin to archieve that: Eslint plugin only warn Or set all the rules ar warning instead of errors. 回答2: Following es-lint-plugin-prettier readme, edit your .eslintrc.json and put a specific rule for prettier : "rules": { // maybe your other

Is it possible to show warnings instead of errors on ALL of eslint rules?

亡梦爱人 提交于 2021-01-21 12:06:41
问题 As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules? I'm using Standard JS, if that information is relevant. Thanks! 回答1: I think there's no out-of-the-box option right now, but maybe you could use a plugin to archieve that: Eslint plugin only warn Or set all the rules ar warning instead of errors. 回答2: Following es-lint-plugin-prettier readme, edit your .eslintrc.json and put a specific rule for prettier : "rules": { // maybe your other

【rollup】打包特性解析

吃可爱长大的小学妹 提交于 2021-01-21 01:59:56
rollup是什么 Rollup 是一个 JavaScript 模块打包器,可以将小块代码编译成大块复杂的代码,例如 library 或应用程序,对代码模块采用es6格式 特性 tree shaking Rollup静态分析代码中的import,并将排除任何未实际使用的代码,使得不会增加额外的依赖或使项目的大小膨胀。 并且,这种基于显式的 import 和 export 语句的方式,它远比「在编译后的输出代码中,简单地运行自动 minifier 检测未使用的变量」更有效 导入 CommonJS(Importing CommonJS) 通过插件导入已存在的commonJS模块 发布 ES6 模块(Publishing ES6 Modules) 为了确保你的 ES6 模块可以直接与「运行在 CommonJS(例如 Node.js 和 webpack)中的工具(tool)」使用,你可以使用 Rollup 编译为 UMD 或 CommonJS 格式,然后在 package.json 文件的 main 属性中指向当前编译的版本。如果你的 package.json 也具有 module 字段,像 Rollup 和 webpack 2 这样的 ES6 感知工具(ES6-aware tools)将会直接导入 ES6 模块版本。 安装rollup 全局 npm install -g rollup

eslint Parsing error: Unexpected token function with async

亡梦爱人 提交于 2021-01-20 16:22:46
问题 I am getting the following error in async usage on ESLINT. eslint Parsing error: Unexpected token function with async Here is my eslintsrc { "extends": "airbnb-base", "rules": { "no-console": "off", "func-style":"error", "import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false, "packageDir": "./"}] }, "parserOptions": { "ecmaVersion":8 } } UPDATE Here is my async const get = async function get(req, res) { const user =

What means 'Parsing error: “parserOptions.project” has been set for @typescript-eslint/parser.' error in IntelliJ IDEs family?

此生再无相见时 提交于 2021-01-20 07:52:18
问题 When I open .vue file, below error appears in my IntelliJ IDEA: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: XX\XX\CurrentFile.vue. The file must be included in at least one of the projects provided. Of course I will be glad if you teach me the solution, but first what I know what it means and WHY it appears. I suspect that it is a some kind of bug, or inaccurate error message. Experimentally known what: