patch: disable useless tests

This commit is contained in:
Edwin Joassart 2023-10-31 11:44:56 +01:00
parent 9a1e1203b9
commit 250e33ac11
15 changed files with 26 additions and 484 deletions

View File

@ -1,9 +1,10 @@
module.exports = {
extends: ["./node_modules/@balena/lint/config/.eslintrc.js"],
root: true,
ignorePatterns: ["node_modules/", "dist/", "examples/", "tests/"],
ignorePatterns: ["node_modules/", "dist/", "examples/"],
rules: {
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
};

View File

@ -1,451 +0,0 @@
env:
browser: true
commonjs: true
es6: true
node: true
mocha: true
plugins:
- lodash
- jsdoc
- node
- react
extends: 'standard'
parserOptions:
sourceType: 'script'
ecmaFeatures:
jsx: true
settings:
jsdoc:
additionalTagNames:
customTags:
- fulfil
rules:
# Possible Errors
no-console:
- off
no-empty:
- error
no-extra-semi:
- error
no-negated-in-lhs:
- error
no-prototype-builtins:
- error
valid-jsdoc:
- error
- requireReturn: false
requireReturnDescription: false
requireReturnType: true
requireParamDescription: true
preferType:
boolean: "Boolean"
number: "Number"
object: "Object"
string: "String"
array: "Array"
prefer:
arg: "param"
return: "returns"
# Best Practices
array-callback-return:
- error
block-scoped-var:
- error
class-methods-use-this:
- error
complexity:
- off
consistent-return:
- error
curly:
- error
default-case:
- error
dot-notation:
- error
guard-for-in:
- error
no-alert:
- error
no-case-declarations:
- error
no-div-regex:
- error
no-else-return:
- error
no-empty-function:
- error
no-eq-null:
- error
no-extra-label:
- error
no-implicit-coercion:
- error
no-implicit-globals:
- error
no-loop-func:
- error
no-magic-numbers:
- error
no-native-reassign:
- error
no-param-reassign:
- error
no-restricted-properties:
- error
- property: __proto__
no-return-await:
- error
no-script-url:
- error
no-unused-expressions:
- error
no-unused-labels:
- error
no-useless-concat:
- error
no-void:
- error
no-warning-comments:
- off
radix:
- error
vars-on-top:
- off
# Strict mode
strict:
- error
- global
# Variables
init-declarations:
- error
- always
no-catch-shadow:
- error
no-restricted-globals:
- error
- event
no-shadow:
- error
no-undefined:
- error
no-unused-vars:
- error
no-use-before-define:
- error
# NodeJS and CommonJS
callback-return:
- error
global-require:
- off
no-mixed-requires:
- error
no-process-env:
- off
no-process-exit:
- off
no-sync:
- off
# Stylistic Issues
array-bracket-spacing:
- error
- always
capitalized-comments:
- error
- always
- ignoreConsecutiveComments: true
comma-spacing:
- error
- before: false
after: true
computed-property-spacing:
- error
- never
consistent-this:
- error
- self
func-name-matching:
- error
- always
func-names:
- error
- never
func-style:
- error
- expression
id-blacklist:
- error
id-length:
- error
- min: 2
exceptions:
- "_"
id-match:
- error
- "^[_0-9A-Za-z\\$]+$"
line-comment-position:
- error
- position: above
linebreak-style:
- error
- unix
lines-around-comment:
- error
- beforeBlockComment: true
afterBlockComment: false
beforeLineComment: true
afterLineComment: false
allowBlockStart: true
allowBlockEnd: false
allowObjectStart: true
allowObjectEnd: false
allowArrayStart: true
allowArrayEnd: false
lines-around-directive:
- error
- always
max-len:
- error
- code: 130
comments: 150
ignoreComments: false
ignoreTrailingComments: false
ignoreUrls: true
max-params:
- off
max-statements-per-line:
- error
- max: 1
multiline-ternary:
- off
newline-per-chained-call:
- off
no-bitwise:
- error
no-continue:
- error
no-inline-comments:
- error
no-lonely-if:
- error
no-mixed-operators:
- error
no-multi-assign:
- error
no-negated-condition:
- error
no-nested-ternary:
- error
no-plusplus:
- error
no-restricted-syntax:
- error
- WithStatement
- ForInStatement
no-spaced-func:
- error
no-underscore-dangle:
- error
- allowAfterThis: false
object-curly-newline:
- error
- minProperties: 3
consistent: true
object-curly-spacing:
- error
- always
one-var-declaration-per-line:
- error
- always
operator-assignment:
- error
- always
quotes:
- error
- single
quote-props:
- error
- as-needed
require-jsdoc:
- error
- require:
FunctionDeclaration: true
ClassDeclaration: true
MethodDefinition: true
ArrowFunctionExpression: true
space-before-function-paren:
- error
- anonymous: always
named: always
asyncArrow: always
template-tag-spacing:
- error
- always
unicode-bom:
- error
# ECMAScript 6
arrow-parens:
- error
- always
arrow-spacing:
- error
- before: true
after: true
generator-star-spacing:
- error
- before: true
after: false
no-confusing-arrow:
- error
no-var:
- error
object-shorthand:
- error
- always
prefer-const:
- error
prefer-spread:
- error
prefer-numeric-literals:
- error
prefer-rest-params:
- error
prefer-template:
- error
prefer-arrow-callback:
- error
- allowNamedFunctions: false
require-yield:
- error
symbol-description:
- error
# Lodash
lodash/chain-style:
- error
- explicit
lodash/identity-shorthand:
- error
- always
lodash/import-scope:
- error
- full
lodash/matches-prop-shorthand:
- error
- always
lodash/matches-shorthand:
- error
- always
lodash/no-commit:
- error
lodash/path-style:
- error
- array
lodash/prefer-compact:
- error
lodash/prefer-filter:
- error
- 5
lodash/prefer-flat-map:
- error
lodash/prefer-invoke-map:
- error
lodash/prefer-map:
- error
lodash/prefer-reject:
- error
lodash/prefer-thru:
- error
lodash/prefer-wrapper-method:
- error
lodash/prop-shorthand:
- error
- always
lodash/prefer-constant:
- error
- true
- true
lodash/prefer-get:
- error
- 2
lodash/prefer-includes:
- error
- includeNative: true
lodash/prefer-is-nil:
- error
lodash/prefer-lodash-chain:
- error
lodash/prefer-lodash-method:
- error
lodash/prefer-lodash-typecheck:
- error
lodash/prefer-matches:
- error
- 3
lodash/prefer-noop:
- error
lodash/prefer-over-quantifier:
- error
lodash/prefer-startswith:
- error
lodash/prefer-times:
- error
# JSDoc
jsdoc/check-param-names:
- error
jsdoc/check-tag-names:
- error
jsdoc/newline-after-description:
- error
jsdoc/require-example:
- error
jsdoc/require-hyphen-before-param-description:
- error
jsdoc/require-param:
- error
jsdoc/require-param-description:
- error
jsdoc/require-param-type:
- error
jsdoc/require-returns-type:
- error
# Node
node/no-deprecated-api:
- error
node/no-missing-import:
- error
node/no-missing-require:
- error
node/process-exit-as-throw:
- error
node/no-extraneous-require:
- error
node/no-extraneous-import:
- error
# React
react/jsx-uses-vars:
- error
ban-ts-ignore:
- warn

View File

@ -448,7 +448,7 @@ export class DriveSelector extends React.Component<
}
rowKey="displayName"
// TODO: check why this is not passing the typescheck
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
onCheck={(rows: Drive[]) => {
let newSelection = rows.filter(isDrivelistDrive);

View File

@ -122,7 +122,6 @@ export class SafeWebview extends React.PureComponent<
ref={this.webviewRef}
partition={ELECTRON_SESSION}
style={style}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
allowpopups="true"
/>

View File

@ -520,7 +520,6 @@ export class SourceSelector extends React.Component<
}
private async onDrop(event: React.DragEvent<HTMLDivElement>) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const [file] = event.dataTransfer.files;
if (file) {
@ -587,7 +586,6 @@ export class SourceSelector extends React.Component<
let image: SourceMetadata | DrivelistDrive =
selectionImage !== undefined ? selectionImage : ({} as SourceMetadata);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
image = image.drive ?? image;

View File

@ -29,5 +29,5 @@ export function setDrives(drives: any[]) {
}
export function getDrives(): DrivelistDrive[] {
return store.getState().toJS().availableDrives;
return store.getState().toJS().availableDrives as DrivelistDrive[];
}

View File

@ -273,7 +273,7 @@ export class MainPage extends React.Component<
paddingTop="14px"
style={{
// Allow window to be dragged from header
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
WebkitAppRegion: 'drag',
position: 'relative',

View File

@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { main } from './app';
import './i18n';

View File

@ -40,7 +40,7 @@ ipc.config.silent = true;
// The purpose behind this change is for this process
// to emit a "disconnect" event as soon as the GUI
// process is closed, so we can kill this process as well.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore (0 is a valid value for stopRetrying and is not the same as false)
ipc.config.stopRetrying = 0;

View File

@ -52,7 +52,7 @@ async function write(options: WriteOptions) {
const onFail = (destination: SourceDestination, error: Error) => {
emitFail({
// TODO: device should be destination
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore (destination.drive is private)
device: destination.drive,
error: toJSON(error),

View File

@ -69,16 +69,15 @@ type Drive =
function prepareDrive(drive: Drive) {
if (drive instanceof sdk.sourceDestination.BlockDevice) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore (BlockDevice.drive is private)
return drive.drive;
} else if (drive instanceof sdk.sourceDestination.UsbbootDrive) {
// This is a workaround etcher expecting a device string and a size
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
drive.device = drive.usbDevice.portId;
drive.size = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
drive.progress = 0;
drive.disabled = true;
@ -143,11 +142,10 @@ function updateDriveProgress(
progress: number,
) {
const drives = getDrives();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const driveInMap = drives[drive.device];
if (driveInMap) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
drives[drive.device] = { ...driveInMap, progress };
setDrives(drives);

View File

@ -26,11 +26,11 @@
"lint-staged": "lint-staged",
"sanity-checks": "bash scripts/ci/ensure-all-file-extensions-in-gitattributes.sh",
"start": "./node_modules/.bin/electron .",
"test-gui": "electron-mocha --recursive --reporter spec --window-config tests/gui/window-config.json --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts",
"test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.ts",
"test-macos": "npm run lint && npm run test-gui && npm run test-shared && npm run sanity-checks",
"test-linux": "npm run lint && xvfb-run --auto-servernum npm run test-gui && xvfb-run --auto-servernum npm run test-shared && npm run sanity-checks",
"test-windows": "npm run lint && npm run test-gui && npm run test-shared && npm run sanity-checks",
"test-gui": "electron-mocha --recursive --reporter spec --window-config tests/gui/window-config.json --require ts-node/register --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts",
"test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.ts",
"test-macos": "npm run lint && npm run sanity-checks",
"test-linux": "npm run lint && npm run sanity-checks",
"test-windows": "npm run lint && npm run sanity-checks",
"test": "echo npm run test-{linux,windows,macos}",
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
"webpack": "webpack",

View File

@ -29,7 +29,6 @@ async function main() {
try {
const cleaned = omit(shrinkwrap);
for (const item of Object.values(cleaned.dependencies)) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
item.dev = true;
}

View File

@ -15,7 +15,6 @@
*/
import { expect } from 'chai';
import * as _ from 'lodash';
import { stub } from 'sinon';
import * as settings from '../../../lib/gui/app/models/settings';
@ -47,8 +46,8 @@ describe('Browser: settings', () => {
const writeConfigFileStub = stub();
writeConfigFileStub.returns(Promise.reject(new Error('settings error')));
const p = settings.set('foo', 'baz', writeConfigFileStub);
await checkError(p, async (error) => {
const param = settings.set('foo', 'baz', writeConfigFileStub);
await checkError(param, async (error) => {
expect(error).to.be.an.instanceof(Error);
expect(error.message).to.equal('settings error');
expect(await settings.get('foo')).to.equal('bar');

View File

@ -17,7 +17,7 @@
import { expect } from 'chai';
import { sourceDestination } from 'etcher-sdk';
import * as path from 'path';
import { SourceMetadata } from '../../lib/gui/app/components/source-selector/source-selector';
import { SourceMetadata } from '../../lib/shared/typings/source-selector';
import * as constraints from '../../lib/shared/drive-constraints';
import * as messages from '../../lib/shared/messages';
@ -87,7 +87,7 @@ describe('Shared: DriveConstraints', function () {
path: '/Volumes/Untitled/image.img',
hasMBR: false,
partitions: [],
SourceType: sourceDestination.File,
SourceType: 'File',
},
);
@ -101,7 +101,7 @@ describe('Shared: DriveConstraints', function () {
path: 'E:\\image.img',
hasMBR: false,
partitions: [],
SourceType: sourceDestination.File,
SourceType: 'File',
};
beforeEach(function () {
this.separator = path.sep;
@ -207,7 +207,7 @@ describe('Shared: DriveConstraints', function () {
path: '/Volumes/Untitled/image.img',
hasMBR: false,
partitions: [],
SourceType: sourceDestination.File,
SourceType: 'File',
};
beforeEach(function () {
this.separator = path.sep;
@ -522,7 +522,7 @@ describe('Shared: DriveConstraints', function () {
size: 1000000000,
isSizeEstimated: false,
recommendedDriveSize: 2000000000,
SourceType: sourceDestination.File,
SourceType: 'File',
};
it('should return true if the drive size is greater than the recommended size ', function () {
const result = constraints.isDriveSizeRecommended(
@ -626,7 +626,7 @@ describe('Shared: DriveConstraints', function () {
description: 'rpi.img',
displayName: 'rpi.img',
path: '',
SourceType: sourceDestination.File,
SourceType: 'File',
size: 2000000000,
isSizeEstimated: false,
};
@ -672,7 +672,7 @@ describe('Shared: DriveConstraints', function () {
description: 'rpi.img',
displayName: 'rpi.img',
path: '',
SourceType: sourceDestination.File,
SourceType: 'File',
size: 2000000000,
isSizeEstimated: false,
};
@ -720,7 +720,7 @@ describe('Shared: DriveConstraints', function () {
description: 'rpi.img',
displayName: 'rpi.img',
path: '',
SourceType: sourceDestination.File,
SourceType: 'File',
size: 2000000000,
isSizeEstimated: false,
};
@ -1227,7 +1227,7 @@ describe('Shared: DriveConstraints', function () {
description: 'rpi.img',
displayName: 'rpi.img',
path: path.join(__dirname, 'rpi.img'),
SourceType: sourceDestination.File,
SourceType: 'File',
// @ts-ignore
size: drives[2].size + 1,
isSizeEstimated: false,