是否可以在eslint中停用此错误?
Parsing error: 'import' and 'export' may only appear at the top level
Run Code Online (Sandbox Code Playgroud) 在阅读了有关我的问题的一些问答后:
解析错误:“导入”和“导出”可能仅与“sourceType:模块”一起出现
我将.eslintrc.json写入:
{
"extends": ["airbnb", "prettier", "plugin:node/recommended"],
"plugins": ["prettier"],
"env": {
"node": true,
"es6": true,
"browser": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module",
"allowImportExportEverywhere": true
},
"rules": {
"prettier/prettier": "error",
"spaced-comment": "off",
"no-console": "warn",
"consistent-return": "off",
"func-names": "off",
"object-shorthand": "off",
"no-process-exit": "off",
"no-param-reassign": "off",
"no-return-await": "off",
"no-underscore-dangle": "off",
"class-methods-use-this": "off",
"prefer-destructuring": ["error", { "object": true, "array": false }],
"no-unused-vars": ["error", { …Run Code Online (Sandbox Code Playgroud) 我有一个看起来像这样的表格:
<form class="col s12" materialize [formGroup]="newUserForm">
...
<div class="row">
<div class="input-field col m4 s12">
<select formControlName="genderBound" materialize="material_select" id="gender" name="test">
<option value="" disabled selected name="chooseGender">Choose gender</option>
<option *ngFor="let gender of genders">{{gender}}</option>
</select>
<label for="gender">Gender</label>
</div>
...
Run Code Online (Sandbox Code Playgroud)
当我尝试使用cypress选择下拉菜单时,它告诉我它不可见。当我遵循赛普拉斯提供的解释性URL时,它建议我{force: true}在单击内使用。这允许我的测试通过,但实际上似乎从未选择过这些项目。
我还遵循此处提供的解决方案,并在实际选项上实现了jQuery单击(请注意,我的select和option标记不是md-select和md-option标记)
cypress目录中的sample.spec.js:
...
it('signs up a new user', () =>{
cy.get('button[id=new-account-button]').click();
cy.get('input[id=affiliation]').type(affiliation);
cy.get('input[id=password]').type(pass);
cy.get('input[id=userName]').type(name);
cy.get('input[id=email]').type(email);
//Now the options
cy.get('[name="chooseGender"]').click({force: true});
cy.get('option').contains("Female").then(option =>{
cy.wrap(option).contains("Female");
option[0].click();
});
...
Run Code Online (Sandbox Code Playgroud)
我想有两件事我不太了解:
我在下面提供了我的确切问题的回购协议:
git clone https://github.com/Atticus29/dataJitsu.git
cd dataJitsu
git checkout cypress-SO
Run Code Online (Sandbox Code Playgroud)
在/ …