本篇內(nèi)容主要講解“atom中eslint的配置以及使用方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“atom中eslint的配置以及使用方法”吧!
高臺網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,高臺網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為高臺上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的高臺做網(wǎng)站的公司定做!
下載aotm插件 linter-eslint
https://github.com/AtomLinter/linter-eslint
需要設(shè)置如下:
Install locally to your project eslint and the plugin
$ npm i --save-dev eslint [eslint-plugins]
Install globally eslint and plugins
Activate Use Global Eslint
package option
(Optional) Set Global Node Path
with $ npm config get prefix
$ npm i -g eslint [eslint-plugins]
提供了一些插件,可自行下載(ps: 版本差異會導致部分插件報錯)
eslint-config-airbnb
eslint-plugin-import
eslint-plugin-jsx-a11y
eslint-plugin-react
eslint-plugin-html (可解析html中的腳本, 最新的版本v4跟早期eslint有沖突)
然后在項目下$ eslint --init
/* eslint-disable */
創(chuàng)建一個 .eslintignore
文件,添加需要過濾的文件夾,或者文件
build/* app/lib/*
命令行使用 --ignore-path
:
$ eslint --ignore-path .eslintignore --fix app/*
路徑是相對于 .eslintignore 的位置或當前工作目錄
更多查看 http://eslint.cn/docs/user-guide/configuring
module.exports = { parser: 'babel-eslint', "env": { "browser": true, "commonjs": true, "es6": true }, // 以當前目錄為根目錄,不再向上查找 .eslintrc.js root: true, // 禁止使用 空格 和 tab 混合縮進 "extends": "eslint:recommended", globals: { // 這里填入你的項目需要的全局變量 // jQuery: false, $: false, wx: false, }, // eslint-plugin-html 開啟 "plugins": [ "html" ], "parserOptions": { "ecmaFeatures": { "jsx": false }, "sourceType": "module" }, "rules": { "indent": ["error", 'tab'], "linebreak-style": ["error","unix"], "quotes": ["error","single"], "semi": ["error","always"], "semi": ["error","always"], "arrow-spacing": ["error", { "before": true, "after": true }], "no-unused-vars": "off", //禁止提示沒有使用的變量,或者函數(shù) "block-spacing": "error", "no-console": "off", //可以使用console "keyword-spacing": ["error", { "before": true }] //強制關(guān)鍵字周圍空格的一致性 } };
到此,相信大家對“atom中eslint的配置以及使用方法”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進入相關(guān)頻道進行查詢,關(guān)注我們,繼續(xù)學習!
文章名稱:atom中eslint的配置以及使用方法
網(wǎng)站地址:http://muchs.cn/article8/jchpip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導航、電子商務(wù)、網(wǎng)站制作、云服務(wù)器、網(wǎng)站建設(shè)、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)