未验证 提交 8ebdf5db 编写于 作者: B Boris Sekachev 提交者: GitHub

Fixed eslint config (#131)

* Fixed eslint config

* Updated yarn.lock
上级 b5b828e5
......@@ -14,6 +14,7 @@ module.exports = (stagedFiles) => {
const eslintExtensions = ['ts', 'tsx', 'js'].map(makePattern);
const eslintFiles = micromatch(stagedFiles, eslintExtensions);
const tests = containsInPath('/tests/', eslintFiles);
const cvatData = containsInPath('/cvat-data/', eslintFiles);
const cvatCore = containsInPath('/cvat-core/', eslintFiles);
const cvatCanvas = containsInPath('/cvat-canvas/', eslintFiles);
......@@ -22,6 +23,7 @@ module.exports = (stagedFiles) => {
const mapping = {};
const commands = [];
mapping['yarn run precommit:cvat-tests -- '] = tests.join(' ');
mapping['yarn run precommit:cvat-ui -- '] = cvatUI.join(' ');
mapping['yarn run precommit:cvat-data -- '] = cvatData.join(' ');
mapping['yarn run precommit:cvat-core -- '] = cvatCore.join(' ');
......
......@@ -95,6 +95,7 @@
"cp": "cp -r cvat-ui_cov/* cvat-ui && cp -r cvat-canvas_cov/* cvat-canvas && cp -r cvat-data_cov/* cvat-data && cp -r cvat-core_cov/* cvat-core",
"rm": "rm -rf cvat-ui_cov cvat-canvas_cov cvat-data_cov cvat-core_cov",
"prepare": "husky install && rm .husky/pre-commit; npx husky add .husky/pre-commit \"npx lint-staged\"",
"precommit:cvat-tests": "cd tests && eslint --fix",
"precommit:cvat-data": "cd cvat-data && eslint --fix",
"precommit:cvat-core": "cd cvat-core && eslint --fix",
"precommit:cvat-canvas": "cd cvat-canvas && eslint --fix",
......
......@@ -2,9 +2,26 @@
//
// SPDX-License-Identifier: MIT
const globalConfig = require('../.eslintrc.js');
module.exports = {
env: {
'cypress/globals': true,
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
},
ignorePatterns: [
'.eslintrc.js',
'lint-staged.config.js',
],
plugins: ['security', 'no-unsanitized', 'eslint-plugin-header', 'import'],
extends: [
'eslint:recommended', 'plugin:security/recommended', 'plugin:no-unsanitized/DOM', 'plugin:cypress/recommended',
'airbnb-base', 'plugin:import/errors', 'plugin:import/warnings',
],
rules: {
...Object.fromEntries(Object.entries(globalConfig.rules).filter(([key]) => {
return !key.startsWith('@typescript-eslint')
})),
},
plugins: ['cypress']
};
......@@ -12,7 +12,7 @@ context('Objects ordering feature', () => {
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: 250,
firstY: 350,
secondX: 350,
......@@ -22,7 +22,7 @@ context('Objects ordering feature', () => {
const createRectangleShape2PointsSecond = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: createRectangleShape2Points.firstX + 300,
firstY: createRectangleShape2Points.firstY,
secondX: createRectangleShape2Points.secondX + 300,
......@@ -30,18 +30,20 @@ context('Objects ordering feature', () => {
};
function checkSideBarItemOrdering(ordering) {
let cvatObjectsSidebarStateItemIdList = [];
const cvatObjectsSidebarStateItemIdList1 = [];
cy.get('.cvat-objects-sidebar-state-item').then(($cvatObjectsSidebarStateItemId) => {
for (let i = 0; i < $cvatObjectsSidebarStateItemId.length; i++) {
cvatObjectsSidebarStateItemIdList.push(Number($cvatObjectsSidebarStateItemId[i].id.match(/\d+$/)));
cvatObjectsSidebarStateItemIdList1.push(Number($cvatObjectsSidebarStateItemId[i].id.match(/\d+$/)));
}
const idAscent = cvatObjectsSidebarStateItemIdList.reduce((previousValue, currentValue) => {
return previousValue > currentValue ? false : true;
});
const idAscent = cvatObjectsSidebarStateItemIdList1.reduce((previousValue, currentValue) => (
!(previousValue > currentValue)
));
if (ordering === 'ascent') {
expect(idAscent).to.be.true; //expected true to be true (ascent)
/* eslint-disable-next-line */
expect(idAscent).to.be.true; // expected true to be true (ascent)
} else {
expect(idAscent).to.be.false; //expected false to be false (descent)
/* eslint-disable-next-line */
expect(idAscent).to.be.false; // expected false to be false (descent)
}
});
}
......
......@@ -12,6 +12,7 @@
"cypress-file-upload": "^5.0.8",
"cypress-localstorage-commands": "^1.7.0",
"cypress-real-events": "^1.6.0",
"eslint-plugin-cypress": "^2.12.1",
"extract-zip": "^2.0.1",
"fs-extra": "^10.1.0",
"jimp": "^0.16.1"
......
......@@ -1265,6 +1265,13 @@ escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
eslint-plugin-cypress@^2.12.1:
version "2.12.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz#9aeee700708ca8c058e00cdafe215199918c2632"
integrity sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==
dependencies:
globals "^11.12.0"
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
......@@ -1523,7 +1530,7 @@ global@~4.4.0:
min-document "^2.19.0"
process "^0.11.10"
globals@^11.1.0:
globals@^11.1.0, globals@^11.12.0:
version "11.12.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册