Skip to content
Permalink
Browse files

chore: lint spec-main (#20835)

  • Loading branch information...
nornagon committed Nov 1, 2019
1 parent 1fed1ed commit ecd9e1f26e4b9ece82058629ce8b42a5edd97902
Showing with 591 additions and 535 deletions.
  1. +11 −0 .eslintrc.json
  2. +1 −1 Dockerfile.arm32v7
  3. +3 −3 package.json
  4. +2 −2 script/lint.js
  5. +1 −1 spec-main/ambient.d.ts
  6. +8 −9 spec-main/api-app-spec.ts
  7. +4 −4 spec-main/api-auto-updater-spec.ts
  8. +8 −8 spec-main/api-autoupdater-darwin-spec.ts
  9. +2 −2 spec-main/api-browser-view-spec.ts
  10. +1 −1 spec-main/api-browser-window-affinity-spec.ts
  11. +93 −94 spec-main/api-browser-window-spec.ts
  12. +1 −1 spec-main/api-callbacks-registry-spec.ts
  13. +66 −64 spec-main/api-context-bridge-spec.ts
  14. +10 −11 spec-main/api-crash-reporter-spec.ts
  15. +2 −2 spec-main/api-debugger-spec.ts
  16. +3 −3 spec-main/api-deprecate-spec.ts
  17. +2 −2 spec-main/api-desktop-capturer-spec.ts
  18. +1 −1 spec-main/api-dialog-spec.ts
  19. +1 −1 spec-main/api-ipc-renderer-spec.ts
  20. +37 −37 spec-main/api-ipc-spec.ts
  21. +4 −5 spec-main/api-menu-item-spec.ts
  22. +1 −1 spec-main/api-native-theme-spec.ts
  23. +8 −8 spec-main/api-net-log-spec.ts
  24. +25 −29 spec-main/api-net-spec.ts
  25. +1 −1 spec-main/api-notification-dbus-spec.ts
  26. +1 −0 spec-main/api-power-monitor-spec.ts
  27. +10 −10 spec-main/api-protocol-spec.ts
  28. +8 −8 spec-main/api-remote-spec.ts
  29. +25 −25 spec-main/api-session-spec.ts
  30. +1 −1 spec-main/api-shell-spec.ts
  31. +1 −1 spec-main/api-subframe-spec.ts
  32. +5 −5 spec-main/api-system-preferences-spec.ts
  33. +3 −3 spec-main/api-touch-bar-spec.ts
  34. +3 −3 spec-main/api-tray-spec.ts
  35. +23 −23 spec-main/api-web-contents-spec.ts
  36. +1 −1 spec-main/api-web-frame-spec.ts
  37. +4 −4 spec-main/api-web-request-spec.ts
  38. +1 −1 spec-main/asar-spec.ts
  39. +43 −51 spec-main/chromium-spec.ts
  40. +5 −6 spec-main/extensions-spec.ts
  41. +2 −1 spec-main/fixtures/extensions/chrome-runtime/main.js
  42. +3 −2 spec-main/fixtures/extensions/chrome-storage/main.js
  43. +3 −3 spec-main/node-spec.ts
  44. +3 −3 spec-main/security-warnings-spec.ts
  45. +1 −1 spec-main/spec-helpers.ts
  46. +2 −2 spec-main/version-bump-spec.ts
  47. +15 −15 spec-main/visibility-state-spec.ts
  48. +4 −5 spec-main/webview-spec.ts
  49. +4 −4 spec-main/window-helpers.ts
  50. +1 −1 vsts-arm32v7.yml
  51. +123 −65 yarn.lock
@@ -17,18 +17,29 @@
"prefer-const": ["error", {
"destructuring": "all"
}],
"standard/no-callback-literal": "off",
"node/no-deprecated-api": 0
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"globals": {
"standardScheme": "readonly"
},
"overrides": [
{
"files": "*.js",
"rules": {
"@typescript-eslint/no-unused-vars": "off"
}
},
{
"files": "*.d.ts",
"rules": {
"no-useless-constructor": "off",
"@typescript-eslint/no-unused-vars": "off"
}
}
]
}
@@ -43,7 +43,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# Install Node.js
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash - \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*

@@ -21,8 +21,8 @@
"@types/split": "^1.0.0",
"@types/webpack": "^4.4.32",
"@types/webpack-env": "^1.13.9",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"asar": "^1.0.0",
"check-for-leaks": "^1.2.1",
"colors": "^1.1.2",
@@ -138,4 +138,4 @@
"@types/multiparty": "^0.0.32",
"@types/temp": "^0.8.34"
}
}
}
@@ -95,8 +95,8 @@ const LINTERS = [ {
}
}, {
key: 'javascript',
roots: ['lib', 'spec', 'script', 'default_app'],
ignoreRoots: ['spec/node_modules'],
roots: ['lib', 'spec', 'spec-main', 'script', 'default_app'],
ignoreRoots: ['spec/node_modules', 'spec-main/node_modules'],
test: filename => filename.endsWith('.js') || filename.endsWith('.ts'),
run: (opts, filenames) => {
const cmd = path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint')
@@ -1,4 +1,4 @@
declare var standardScheme: string;
declare let standardScheme: string

declare namespace Electron {
interface Menu {
@@ -5,11 +5,11 @@ import * as https from 'https'
import * as net from 'net'
import * as fs from 'fs'
import * as path from 'path'
import split = require('split')
import { app, BrowserWindow, Menu } from 'electron'
import { emittedOnce } from './events-helpers';
import { closeWindow } from './window-helpers';
import { ifdescribe } from './spec-helpers';
import { emittedOnce } from './events-helpers'
import { closeWindow } from './window-helpers'
import { ifdescribe } from './spec-helpers'
import split = require('split')

const features = process.electronBinding('features')

@@ -196,7 +196,7 @@ describe('app module', () => {
// Singleton will send us greeting data to let us know it's running.
// After that, ask it to exit gracefully and confirm that it does.
if (appProcess && appProcess.stdout) {
appProcess.stdout.on('data', data => appProcess!.kill())
appProcess.stdout.on('data', () => appProcess!.kill())
}
const [code, signal] = await emittedOnce(appProcess, 'close')

@@ -403,10 +403,9 @@ describe('app module', () => {
w = new BrowserWindow({ show: false })
})

it('should emit renderer-process-crashed event when renderer crashes', async function() {
it('should emit renderer-process-crashed event when renderer crashes', async function () {
// FIXME: re-enable this test on win32.
if (process.platform === 'win32')
return this.skip()
if (process.platform === 'win32') { return this.skip() }
w = new BrowserWindow({
show: false,
webPreferences: {
@@ -644,7 +643,7 @@ describe('app module', () => {
it('returns whether the Chrome has accessibility APIs enabled', () => {
expect(app.accessibilitySupportEnabled).to.be.a('boolean')

//TODO(codebytere): remove when propertyification is complete
// TODO(codebytere): remove when propertyification is complete
expect(app.isAccessibilitySupportEnabled).to.be.a('function')
expect(app.setAccessibilitySupportEnabled).to.be.a('function')
})
@@ -9,7 +9,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
expect(error.message).to.equal('Update URL is not set')
done()
})
autoUpdater.setFeedURL({url:''})
autoUpdater.setFeedURL({ url: '' })
autoUpdater.checkForUpdates()
})
})
@@ -21,7 +21,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {

ifit(process.platform === 'win32')('correctly fetches the previously set FeedURL', function (done) {
const updateURL = 'https://fake-update.electron.io'
autoUpdater.setFeedURL({url: updateURL})
autoUpdater.setFeedURL({ url: updateURL })
expect(autoUpdater.getFeedURL()).to.equal(updateURL)
done()
})
@@ -50,7 +50,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
})

it('throws if no url is provided when using the new style', () => {
expect(() => autoUpdater.setFeedURL({ noUrl: 'lol' } as any),
expect(() => autoUpdater.setFeedURL({ noUrl: 'lol' } as any)
).to.throw('Expected options object to contain a \'url\' string property in setFeedUrl call')
})
})
@@ -61,7 +61,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
expect(error.message).equal('Could not get code signature for running application')
done()
})
autoUpdater.setFeedURL({url:''})
autoUpdater.setFeedURL({ url: '' })
})

it('does not throw if default is the serverType', () => {
@@ -5,7 +5,7 @@ import * as express from 'express'
import * as fs from 'fs-extra'
import * as os from 'os'
import * as path from 'path'
import { AddressInfo } from 'net';
import { AddressInfo } from 'net'

const features = process.electronBinding('features')

@@ -21,7 +21,7 @@ describeFn('autoUpdater behavior', function () {

beforeEach(function () {
const result = cp.spawnSync(path.resolve(__dirname, '../script/codesign/get-trusted-identity.sh'))
if (result.status !== 0 || result.stdout.toString().trim().length === 0) {
if (result.status !== 0 || result.stdout.toString().trim().length === 0) {
// Per https://circleci.com/docs/2.0/env-vars:
// CIRCLE_PR_NUMBER is only present on forked PRs
if (process.env.CI && !process.env.CIRCLE_PR_NUMBER) {
@@ -99,7 +99,7 @@ describeFn('autoUpdater behavior', function () {
try {
await fn(dir)
} finally {
cp.spawnSync('rm', ['-r' , dir])
cp.spawnSync('rm', ['-r', dir])
}
}

@@ -132,10 +132,10 @@ describeFn('autoUpdater behavior', function () {
})

describe('with update server', () => {
let port = 0;
let server: express.Application = null as any;
let port = 0
let server: express.Application = null as any
let httpServer: http.Server = null as any
let requests: express.Request[] = [];
let requests: express.Request[] = []

beforeEach((done) => {
requests = []
@@ -219,7 +219,7 @@ describeFn('autoUpdater behavior', function () {
(await fs.readFile(appPJPath, 'utf8')).replace('1.0.0', '2.0.0')
)
await signApp(secondAppPath)
const updateZipPath = path.resolve(dir2, 'update.zip');
const updateZipPath = path.resolve(dir2, 'update.zip')
await spawn('zip', ['-r', '--symlinks', updateZipPath, './'], {
cwd: dir2
})
@@ -235,7 +235,7 @@ describeFn('autoUpdater behavior', function () {
pub_date: (new Date()).toString()
})
})
const relaunchPromise = new Promise((resolve, reject) => {
const relaunchPromise = new Promise((resolve) => {
server.get('/update-check/updated/:version', (req, res) => {
res.status(204).send()
resolve()
@@ -1,10 +1,10 @@
import * as chai from 'chai'
import dirtyChai = require('dirty-chai')
import * as ChildProcess from 'child_process'
import * as path from 'path'
import { emittedOnce } from './events-helpers'
import { BrowserView, BrowserWindow } from 'electron'
import { closeWindow } from './window-helpers';
import { closeWindow } from './window-helpers'
import dirtyChai = require('dirty-chai')

const { expect } = chai
chai.use(dirtyChai)
@@ -81,7 +81,7 @@ describe('BrowserWindow with affinity module', () => {
const affinityWithNodeFalse = 'affinityWithNodeFalse'

function testNodeIntegration (present: boolean) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
ipcMain.once('answer', (event, typeofProcess, typeofBuffer) => {
if (present) {
expect(typeofProcess).to.not.equal('undefined')

0 comments on commit ecd9e1f

Please sign in to comment.
You can’t perform that action at this time.