Parcourir la source

lint and py3.5 compat

Steven Silvester il y a 6 ans
Parent
commit
950218bdd8

+ 1 - 0
.eslintignore

@@ -17,6 +17,7 @@ dev_mode/workspaces
 examples/app/build
 examples/app/themes
 examples/app/schemas
+examples/chrome-example-test.js
 tests/**/coverage
 docs/_build
 docs/api

+ 2 - 0
examples/app/index.js

@@ -2,6 +2,7 @@
 // Distributed under the terms of the Modified BSD License.
 
 import { PageConfig, URLExt } from '@jupyterlab/coreutils';
+// eslint-disable-next-line
 __webpack_public_path__ = URLExt.join(
   PageConfig.getBaseUrl(),
   'example/static/'
@@ -46,6 +47,7 @@ window.addEventListener('load', function() {
   });
   lab.registerPluginModules(mods);
   lab.start().then(() => {
+    // eslint-disable-next-line
     console.log('Example started!');
   });
 });

+ 1 - 1
examples/cell/src/index.ts

@@ -135,7 +135,7 @@ function main(): void {
   });
 
   // Start up the kernel.
-  session.initialize().then(() => {
+  void session.initialize().then(() => {
     console.log('Example started!');
   });
 }

+ 2 - 2
examples/chrome-example-test.js

@@ -14,7 +14,7 @@ async function main() {
 
   errored = false;
 
-  async function handleMessage(msg) {
+  const handleMessage = async msg => {
     const text = msg.text();
     console.log(`>> ${text}`);
     if (msg.type === 'error') {
@@ -29,7 +29,7 @@ async function main() {
       console.info('Example test complete!');
       return;
     }
-  }
+  };
 
   function handleError(err) {
     console.error(err);

+ 4 - 4
examples/test_examples.py

@@ -7,17 +7,17 @@ import sys
 
 here = osp.abspath(osp.dirname(__file__))
 
-paths = [i for i in glob.glob(f'{here}/*') if osp.isdir(i)]
+paths = [i for i in glob.glob('%s/*' % here) if osp.isdir(i)]
 
 services_dir = osp.abspath(osp.join(here, '../packages/services/examples'))
-paths += [i for i in glob.glob(f'{services_dir}/*')]
+paths += [i for i in glob.glob('%s/*' % services_dir)]
 
 
 def header(path):
     test_name = osp.basename(path)
     print('\n')
     print('*' * 40)
-    print(f'Starting {test_name} test')
+    print('Starting %s test' % test_name)
     print('*' * 40)
 
 
@@ -38,4 +38,4 @@ for path in sorted(paths):
     runner = osp.join(here, 'example_check.py')
     subprocess.check_call([sys.executable, runner, path])
 
-print(f'\n\n{count} tests complete!')
+print('\n\n%s tests complete!' % count)

+ 1 - 1
packages/services/examples/browser-require/index.js

@@ -1,4 +1,5 @@
 require(['jquery', '@jupyterlab/services'], function($, services) {
+  /* eslint-disable no-console */
   console.log('Starting example');
   var startNewKernel = services.Kernel.startNew;
 
@@ -7,7 +8,6 @@ require(['jquery', '@jupyterlab/services'], function($, services) {
   };
 
   // start a single kernel for the page
-  /* eslint-disable no-console */
   startNewKernel(kernelOptions).then(function(kernel) {
     console.log('Kernel started:', kernel);
     kernel.requestKernelInfo().then(function(reply) {

+ 1 - 1
tests/test-services/src/terminal/terminal.spec.ts

@@ -85,7 +85,7 @@ describe('terminal', () => {
           expect(args).to.be.undefined;
           called = true;
         });
-        await session.dispose();
+        session.dispose();
         expect(called).to.equal(true);
       });
     });