草庐IT

eslint-plugin-import

全部标签

javascript - 使用 ESLint `indent` 规则忽略模板文字中的缩进

indent的ESLint规则允许您在确定规则是否应用于该节点时使用ignoredNodes选项指定忽略哪些节点。我有以下代码,我想使用此规则忽略它们:consta=b?`c${d}`:e具体来说,带有d的行和后续行被报告为比应有的多了两个空格。我想忽略规则中的那些行,但我无法找出应该应用的节点。指定节点类型inthisrepo.我知道三元表达式,就像在这段代码中使用的那样,是一个ConditionalExpression节点,它看起来像一个templateliteralnode存在,但我无法让它工作。我知道我可以使用eslint-disable-next-line、eslint-di

javascript - webpack.config.babel.js中使用 'import'报错

(function(exports,require,module,__filename,__dirname){importpathfrom'path'^^^^^^SyntaxError:Unexpectedtokenimport当我使用webpack-dev-server--hot时出现此错误。出现这种情况好像是因为它无法读取import或者webpack不支持import。我尝试使用babel-register但它不起作用。有什么办法可以解决这个问题吗?请引用下面的代码。webpack.config.babel.jsimportpathfrom'path'importwebpackf

javascript - Babel ES6 导入错误,SyntaxError : Unexpected token import

我正在尝试设置一个基本的模块化程序,但我似乎遇到了导入模块的问题。我尝试导入我的自定义模块,但出现以下错误:(function(exports,require,module,__filename,__dirname){importtestStepfrom'testStep';^^^^^^SyntaxError:Unexpectedtokenimport导致问题的代码:测试用例.jsimporttestStepfrom'testStep';testStep.hello();测试步骤.jsvartestStep={hello:hello,};varhello=()=>{console.lo

javascript - "sequelize.import()"如何从另一个文件导入模型?

当我按以下方式创建新模型时://user.jsfilemodule.exports=function(sequelize,DateTypes){returnsequelize.define("user",{email:{type:DateTypes.STRING,allowNull:false,unique:true,validate:{isEmail:true}},password:{type:DateTypes.STRING,allowNull:false,validate:{len:[7,100]}}});};然后进入我构建新数据库的db.js文件:varSequelize=re

javascript - jstree jquery plugin - 获取父节点的所有子节点和子节点

我正在使用jsTreejqueryplugin我正在尝试获取选定父节点的所有节点和子节点。但不知何故,除非我使用递归,否则它不起作用。jsTree有更好的固有方法吗? 最佳答案 您可以使用此选择器获取完整树:$("#demo1").find("li>a") 关于javascript-jstreejqueryplugin-获取父节点的所有子节点和子节点,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/q

javascript - 推特 Bootstrap : Accordion plugin collides with Modal

在弹出模式中使用Accordion时,我遇到了一个问题(都是TwitterBootstrap插件)。每当切换任何Accordionblock时,模式都会关闭。 最佳答案 Accordion折叠会触发一个“隐藏”事件,这对于Modal插件也是实际的。因此,有一种方法可以防止模态关闭:$(document).on('click','a.accordion-toggle',function(e){$(e.target).parent().siblings('.accordion-body').on('hidden',function(e)

javascript - CKEditor 4 : How to add CSS stylesheet from plugin?

暂时试过了,但是没有成功editor.addCss(this.path+'tabber.css');editor.document.appendStyleSheet(this.path+'tabber.css');完整代码(function(){CKEDITOR.plugins.add('tabber',{init:function(editor){editor.ui.addButton('addTab',{command:'addTab',icon:this.path+'icons/tabber.png',label:Drupal.t('Inserttabs')});editor.a

javascript - “等于”未定义 : Ember-qunit does not seem to be importing

Qunit测试方法似乎不可用,尽管我很确定我正在正确导入它们。我收到以下错误:unit/models/friend-test.js:line11,col3,'ok'isnotdefined.unit/models/friend-test.js:line17,col3,'equal'isnotdefined.unit/models/friend-test.js:line23,col3,'equal'isnotdefined.unit/models/friend-test.js:line31,col3,'equal'isnotdefined.unit/models/friend-test.

javascript - react : Understanding import statement

这两个语句有什么区别importReactfrom'react';和importReact,{Component}from'react';不应该importReactfrom'react'导入包括内容在内的所有内容吗?我应该阅读什么来理解这一点? 最佳答案 你可以阅读这个here.导入不带大括号的内容会导入您要从中导入的模块中定义为默认导出的内容。一个模块中只能有一个(或没有)默认导出。foo.js:constmyObject={foo:'bar'};exportdefaultmyObject;bar.js:importtheObj

javascript - Eslint - 脚本和模块的 SourceType 混合体

我们开始混入一些es6模块,当您在不使用sourceType:脚本的情况下使用import/export时,eslint会公正地提示Parsingerror:'import'and'export'mayappearonlywith'sourceType:module'atline1col1但是,如果我将sourceType更改为模块,那么每个具有“usestrict”的文件;在顶部被标记为模块中不需要usestrict。模块是我的jsx文件,我的js文件是POJ,所以我需要两个sourceTypes才能运行。关于如何强制eslint与模块和脚本一起工作有什么想法吗?我想避免运行两个单独