简体   繁体   English

将ESLint升级到ECMA6 Brackets IDE

[英]upgrade ESLint to ECMA6 Brackets IDE

Background 背景

I recently switched to using Brackets IDE to code on JavaScript. 我最近改用Brackets IDE在JavaScript上编码。 Upon realizing the default linter of Brackets was a very outdated version of JSLint, I followed some documentation and ended up installing the more versatile ESLint . 在意识到默认的Brackets短绒是JSLint的一个非常过时的版本之后,我遵循了一些文档并最终安装了功能更强大的ESLint

Problem 问题

The problem is that this linter is only built for ECMA5, and does not even recognize the usage of keywords like const . 问题在于,该linter仅针对ECMA5构建,甚至无法识别const等关键字的用法。

There are some efforts from the community to improve JSLint into accepting ECMA6, but since I have been using ESLint in Cloud9 IDE for quite a while, I would like to keep it. 社区做出了一些努力,以使JSLint更好地接受ECMA6,但是由于我已经在Cloud9 IDE中使用ESLint了一段时间了,所以我希望保留它。

What I tried 我尝试了什么

My reaction was to add the rules manually , in some eslint configuration file, but after searching for it I couldn't find it. 我的反应是在某些eslint配置文件中手动添加规则 ,但是在搜索后找不到。

Question

  1. Is there a way to update ESLint rules on brackets IDE? 有没有办法更新括号IDE上的ESLint规则? If so, how? 如果是这样,怎么办?

An issue in the brackets-eslint project says the extension will pick up ESLint's standard .eslintrc configuration files. 方括号-eslint项目中的一个问题是,扩展名将使用ESLint的标准.eslintrc配置文件。 Try putting this .eslintrc.json in your project's root directory: 尝试将此.eslintrc.json放入项目的根目录中:

{
    "root": true,

    "parserOptions": {
        "ecmaVersion": 6
    },

    "extends": "eslint:recommended"
}

You can find more options in ESLint's configuring guide . 您可以在ESLint的配置指南中找到更多选项。 You can also run eslint --init in your project's root directory to have ESLint walk you through setting up an initial configuration. 您还可以在项目的根目录中运行eslint --init ,以使ESLint引导您完成初始配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM