Skip to content

Commit

Permalink
chore: add eslint rule 'comma-dangle' (part 1) (#2759)
Browse files Browse the repository at this point in the history
* part 1

* part 2

* part 3

* part 4

* fix ie tests
  • Loading branch information
miherlosev committed Apr 13, 2022
1 parent 952a3e7 commit 7f80940
Show file tree
Hide file tree
Showing 209 changed files with 1,553 additions and 1,551 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Expand Up @@ -2,5 +2,8 @@
"env": {
"node": true,
"es6": true
}
},
"rules": {
"comma-dangle": ["error", "always-multiline"]
}
}
16 changes: 8 additions & 8 deletions Gulpfile.js
Expand Up @@ -29,7 +29,7 @@ ll
.tasks('lint')
.onlyInDebug([
'server-scripts',
'client-scripts-bundle'
'client-scripts-bundle',
]);

// Build
Expand Down Expand Up @@ -81,13 +81,13 @@ gulp.step('server-scripts-add-exports', () => {
}

cb(null, file);
}
},
});

return gulp
.src([
'lib/**/*.js',
'!lib/client/**/*.js'
'!lib/client/**/*.js',
])
.pipe(transform)
.pipe(gulp.dest('lib'));
Expand All @@ -113,7 +113,7 @@ gulp.step('lint-js', () => {
'./test/client/fixtures/**/*.js',
'./gulp/**/*.js',
'Gulpfile.js',
'!./test/server/data/**/*.js'
'!./test/server/data/**/*.js',
])
.pipe(eslint())
.pipe(eslint.format())
Expand Down Expand Up @@ -150,7 +150,7 @@ gulp.step('test-server-run', () => {
.pipe(mocha({
// NOTE: Disable timeouts in debug mode.
timeout: typeof v8debug !== 'undefined' || !!process.debugPort ? Infinity : 2000,
fullTrace: true
fullTrace: true,
}));
});

Expand Down Expand Up @@ -207,8 +207,8 @@ gulp.step('https-playground-server', () => {
ssl: {
key: selfSignedCertificate.key,
cert: selfSignedCertificate.cert,
needBeautifyScripts
}
needBeautifyScripts,
},
});
});

Expand All @@ -222,7 +222,7 @@ gulp.task('cached-http-playground', gulp.series(BUILD_TASK, 'cached-http-playgro

gulp.step('test-functional-testcafe-run', gulpRunCommand([
'chmod +x ./test/functional/run-testcafe-functional-tests.sh',
'./test/functional/run-testcafe-functional-tests.sh'
'./test/functional/run-testcafe-functional-tests.sh',
]));

gulp.task('test-functional-testcafe', gulp.series(BUILD_TASK, 'test-functional-testcafe-run'));
Expand Down
24 changes: 12 additions & 12 deletions gulp/saucelabs-settings.js
@@ -1,51 +1,51 @@
const CLIENT_TESTS_BROWSERS = [
{
platform: 'Windows 10',
browserName: 'MicrosoftEdge'
browserName: 'MicrosoftEdge',
},
{
platform: 'Windows 10',
browserName: 'chrome'
browserName: 'chrome',
},
{
platform: 'Windows 10',
browserName: 'firefox'
browserName: 'firefox',
},
{
platform: 'Windows 10',
browserName: 'internet explorer',
version: '11.0'
version: '11.0',
},
{
browserName: 'safari',
platform: 'macOS 11.00',
version: '14'
version: '14',
},
{
browserName: 'safari',
platform: 'macOS 12',
version: '15'
version: '15',
},
{
browserName: 'Safari',
deviceName: 'iPhone 7 Plus Simulator',
platformVersion: '11.3',
platformName: 'iOS'
platformName: 'iOS',
},
{
deviceName: 'Android GoogleAPI Emulator',
browserName: 'Chrome',
platformVersion: '7.1',
platformName: 'Android'
platformName: 'Android',
},
{
browserName: 'chrome',
platform: 'macOS 12'
platform: 'macOS 12',
},
{
browserName: 'firefox',
platform: 'macOS 12'
}
platform: 'macOS 12',
},
];

const SAUCELABS_SETTINGS = {
Expand All @@ -55,7 +55,7 @@ const SAUCELABS_SETTINGS = {
tags: [process.env.TRAVIS_BRANCH || 'master'],
browsers: CLIENT_TESTS_BROWSERS,
name: 'testcafe-hammerhead client tests',
timeout: 720
timeout: 720,
};

module.exports = SAUCELABS_SETTINGS;
4 changes: 2 additions & 2 deletions gulp/utils/get-client-test-settings.js
Expand Up @@ -7,9 +7,9 @@ module.exports = function getClientTestSettings () {
crossDomainPort: 2001,
scripts: [
{ src: '/hammerhead.js', path: util.env.dev ? './lib/client/hammerhead.js' : './lib/client/hammerhead.min.js' },
{ src: '/before-test.js', path: './test/client/before-test.js' }
{ src: '/before-test.js', path: './test/client/before-test.js' },
],

configApp: require('../../test/client/config-qunit-server-app')
configApp: require('../../test/client/config-qunit-server-app'),
};
};
1 change: 0 additions & 1 deletion src/.eslintrc
Expand Up @@ -15,7 +15,6 @@
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,

"@typescript-eslint/no-parameter-properties": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/ban-ts-comment": 0,
Expand Down
22 changes: 11 additions & 11 deletions src/client/index.ts
Expand Up @@ -114,15 +114,15 @@ class Hammerhead {
pageNavigationTriggered: this.pageNavigationWatch.PAGE_NAVIGATION_TRIGGERED_EVENT,
scriptElementAdded: this.sandbox.node.element.SCRIPT_ELEMENT_ADDED_EVENT,
consoleMethCalled: this.sandbox.console.CONSOLE_METH_CALLED_EVENT,
windowOpened: this.sandbox.childWindow.WINDOW_OPENED_EVENT
windowOpened: this.sandbox.childWindow.WINDOW_OPENED_EVENT,
};

this.PROCESSING_INSTRUCTIONS = {
dom: {
script: SCRIPT_PROCESSING_INSTRUCTIONS,
internal_attributes: INTERNAL_ATTRIBUTES,
internal_props: INTERNAL_PROPS
}
internal_props: INTERNAL_PROPS,
},
};

this.SHADOW_UI_CLASS_NAME = SHADOW_UI_CLASS_NAME;
Expand Down Expand Up @@ -152,13 +152,13 @@ class Hammerhead {
message: this.sandbox.event.message,
timers: this.sandbox.event.timers,
DataTransfer: this.sandbox.event.DataTransfer,
DragDataStore: this.sandbox.event.DragDataStore
DragDataStore: this.sandbox.event.DragDataStore,
};

const processingUtils = {
script: scriptProcessingUtils,
header: headerProcessingUtils,
instrumentation: instrumentationProcessingUtils
instrumentation: instrumentationProcessingUtils,
};

this.utils = {
Expand All @@ -179,15 +179,15 @@ class Hammerhead {
getMimeType: getMimeType,
urlResolver: urlResolver,
processing: processingUtils,
removeInjectedScript: removeInjectedScript
removeInjectedScript: removeInjectedScript,
};

this.sharedUtils = {
cookie: sharedCookieUtils,
url: sharedUrlUtils,
headers: sharedHeadersUtils,
stackProcessing: sharedStackProcessingUtils,
selfRemovingScripts: sharedSelfRemovingScripts
selfRemovingScripts: sharedSelfRemovingScripts,
};

this.settings = settings;
Expand All @@ -198,7 +198,7 @@ class Hammerhead {
ShadowUISandbox,
ElectronSandbox,
UploadSandbox,
ChildWindowSandbox
ChildWindowSandbox,
};

this.sandboxUtils = {
Expand All @@ -213,13 +213,13 @@ class Hammerhead {
StorageWrapper,
CodeInstrumentation,
LocationInstrumentation,
LocationWrapper
LocationWrapper,
};

this.processors = {
styleProcessor,
domProcessor,
DomProcessor
DomProcessor,
};
}

Expand Down Expand Up @@ -330,7 +330,7 @@ const hammerhead = new Hammerhead();
// So, we need to define the '%hammerhead%' variable as 'configurable' so that it can be redefined.
nativeMethods.objectDefineProperty(window, INTERNAL_PROPS.hammerhead, {
value: hammerhead,
configurable: true
configurable: true,
});

export default hammerhead;
14 changes: 7 additions & 7 deletions src/client/sandbox/code-instrumentation/index.ts
Expand Up @@ -53,7 +53,7 @@ export default class CodeInstrumentation extends SandboxBase {
return evalWrapper;
},

configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.processScript, {
Expand All @@ -77,7 +77,7 @@ export default class CodeInstrumentation extends SandboxBase {
return script;
},

configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.processHtml, {
Expand All @@ -88,7 +88,7 @@ export default class CodeInstrumentation extends SandboxBase {
return html;
},

configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.getProxyUrl, {
Expand All @@ -107,12 +107,12 @@ export default class CodeInstrumentation extends SandboxBase {
return proxyUrl;
},

configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.restArray, {
value: (array: any[], startIndex: number) => nativeMethods.arraySlice.call(array, startIndex),
configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.arrayFrom, {
Expand All @@ -125,7 +125,7 @@ export default class CodeInstrumentation extends SandboxBase {

return shouldConvertToArray ? nativeMethods.arrayFrom.call(nativeMethods.Array, target) : target;
},
configurable: true
configurable: true,
});

nativeMethods.objectDefineProperty(window, INSTRUCTION.restObject, {
Expand All @@ -141,7 +141,7 @@ export default class CodeInstrumentation extends SandboxBase {
return rest;
},

configurable: true
configurable: true,
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/sandbox/code-instrumentation/location/index.ts
Expand Up @@ -52,7 +52,7 @@ export default class LocationAccessorsInstrumentation extends SandboxBase {
nativeMethods.objectDefineProperty(document, LOCATION_WRAPPER, { value: locationWrapper, configurable: true });
nativeMethods.objectDefineProperty(window, INSTRUCTION.getLocation, {
value: (location: any) => isLocation(location) ? locationWrapper : location,
configurable: true
configurable: true,
});
nativeMethods.objectDefineProperty(window, INSTRUCTION.setLocation, {
value: (location: any, value: any) => {
Expand All @@ -66,7 +66,7 @@ export default class LocationAccessorsInstrumentation extends SandboxBase {
return null;
},

configurable: true
configurable: true,
});
}
}

0 comments on commit 7f80940

Please sign in to comment.