eslint

Why is @typescript-eslint/parser including files outside of those configured in my tsconfig.json?

 ̄綄美尐妖づ 提交于 2020-08-27 22:18:49
问题 I am getting the error: - Parsing error: "parserOptions.project" has been set for u/typescript-eslint/parser. The file does not match your project config: .eslintrc.js. The file must be included in at least one of the projects provided. IDE - WebStorm 20.1.1 Project structure: - node_modules src --- testfile.js .eslintrc.js .prettierrc.js baseeslint.js package.json tsconfig.json .eslintrc.js: - module.exports = { extends: ['./baseeslint'], parserOptions: { project: './tsconfig.json' }, rules:

Eslint rule for optional chaining & nullish coalescing operator

余生颓废 提交于 2020-08-21 08:59:07
问题 I am looking for the relevant eslint rules for @babel/plugin-proposal-optional-chaining @babel/plugin-proposal-nullish-coalescing-operator My editor highlights in red when I do the following const baz = obj?.foo?.bar?.baz; // 42 const safe = obj?.qux?.baz; // undefined const foo = obj.baz ?? 'default'; // default // eslint-disable-next-line no-console console.log('baz', baz); // eslint-disable-next-line no-console console.log('safe', safe); // eslint-disable-next-line no-console console.log(

What's the difference between prettier-eslint, eslint-plugin-prettier and eslint-config-prettier?

吃可爱长大的小学妹 提交于 2020-08-20 16:18:52
问题 I want to use Prettier and ESLint together, but I experienced some conflicts just by using them one after another. I see that there are these three packages that seem to allow them to be used in tandem: prettier-eslint eslint-plugin-prettier eslint-config-prettier However, I am unsure which to use as these package names all contain eslint and prettier . Which should I use? 回答1: ESLint contains many rules and those that are formatting-related might conflict with Prettier, such as arrow-parens

记VS Code 中格式化 Vue 文件的问题

回眸只為那壹抹淺笑 提交于 2020-08-19 20:43:28
使用快捷键 Alt+Shift+F 时,选择了 Vetur 进行格式化。但是当按下快捷键一刹那,脑壳 weng weng 的。 JS 部分的 ' 全都成了 " ,每句后面也添加上了 ; 经过查找,发现需要配置 Vetur 的JS formatter 为 prettier-eslint : "vetur.format.defaultFormatter.js": "prettier-eslint" 配置如下图: 作博以备忘 来源: oschina 链接: https://my.oschina.net/hyjiacan/blog/4511687

react use dangerouslySetInnerHTML to render json with html tags

こ雲淡風輕ζ 提交于 2020-08-19 15:36:13
问题 I am trying to render a json list with html tags in the string in a list as follows jsbin. It works in Jsbin. But in my console I got warning below: warning Only set one of `children` or `props.dangerouslySetInnerHTML` react/no-danger-with-children just wonder if there is other way to render the list with dangerouslySetInnerHTML to avoid the warning? const displayList = [ { item: 1, text: "<strong>ABC</strong> this should be strong." }, { item: 2, text: "<a>ABC</a> this should be link." }, {

react use dangerouslySetInnerHTML to render json with html tags

做~自己de王妃 提交于 2020-08-19 15:29:08
问题 I am trying to render a json list with html tags in the string in a list as follows jsbin. It works in Jsbin. But in my console I got warning below: warning Only set one of `children` or `props.dangerouslySetInnerHTML` react/no-danger-with-children just wonder if there is other way to render the list with dangerouslySetInnerHTML to avoid the warning? const displayList = [ { item: 1, text: "<strong>ABC</strong> this should be strong." }, { item: 2, text: "<a>ABC</a> this should be link." }, {

react use dangerouslySetInnerHTML to render json with html tags

我的未来我决定 提交于 2020-08-19 15:28:42
问题 I am trying to render a json list with html tags in the string in a list as follows jsbin. It works in Jsbin. But in my console I got warning below: warning Only set one of `children` or `props.dangerouslySetInnerHTML` react/no-danger-with-children just wonder if there is other way to render the list with dangerouslySetInnerHTML to avoid the warning? const displayList = [ { item: 1, text: "<strong>ABC</strong> this should be strong." }, { item: 2, text: "<a>ABC</a> this should be link." }, {