From 6561fba94731634559cb3f27ff00e9f73a73f3d7 Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Sun, 8 Jul 2018 00:02:10 -0600 Subject: [PATCH] Applied eslint from main .eslintrc to examples (#418) * Changed eslintrc to be JSON file (Most projects use JSON version) * Added .eslintignore to ingore node_modules from subdirectories such as examples * Ran eslint --fix examples to fix all examples * Added npm script for running eslint against examples * Added npm script for running eslint against generated *out* code * Hooked npm scripts into travis ci to prevent examples from becoming inconsistent with future PR's --- .eslintignore | 1 + .eslintrc | 34 +++++ .eslintrc.js | 34 ----- .travis.yml | 4 +- examples/add/index.js | 2 +- examples/add/webpack.config.js | 12 +- examples/asm.js/webpack.config.js | 12 +- examples/char/chars.js | 169 ++++++++++++------------ examples/char/index.js | 11 +- examples/char/webpack.config.js | 12 +- examples/closures/index.js | 2 +- examples/closures/webpack.config.js | 12 +- examples/comments/index.js | 7 +- examples/comments/webpack.config.js | 14 +- examples/console_log/index.js | 2 +- examples/console_log/webpack.config.js | 12 +- examples/dom/index.js | 2 +- examples/dom/webpack.config.js | 12 +- examples/hello_world/index.js | 4 +- examples/hello_world/webpack.config.js | 12 +- examples/import_js/defined-in-js.js | 26 ++-- examples/import_js/index.js | 2 +- examples/import_js/webpack.config.js | 12 +- examples/math/index.js | 10 +- examples/math/webpack.config.js | 12 +- examples/performance/index.js | 2 +- examples/performance/webpack.config.js | 12 +- examples/smorgasboard/README.md | 2 +- examples/smorgasboard/app.js | 12 +- examples/smorgasboard/awesome.js | 16 +-- examples/smorgasboard/index.js | 2 +- examples/smorgasboard/webpack.config.js | 12 +- examples/wasm-in-wasm/index.js | 2 +- examples/wasm-in-wasm/webpack.config.js | 12 +- package.json | 8 +- 35 files changed, 260 insertions(+), 252 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc delete mode 100644 .eslintrc.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +node_modules diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..ee87fe672 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,34 @@ +{ + "env": { + "es6": true, + "browser": true, + "commonjs": true, + "node": true + }, + "extends": "eslint:recommended", + "parser": "babel-eslint", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "indent": ["error", 4], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "no-console": 0, + "no-undef": "warn" + }, + "globals": { + "BigInt64Array": true, + "BigUint64Array": true + } +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index c065517d9..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = { - env: { - es6: true, - browser: true, - commonjs: true, - node: true - }, - extends: 'eslint:recommended', - parser: 'babel-eslint', - parserOptions: { - sourceType: 'module' - }, - rules: { - indent: ['error', 4], - 'linebreak-style': [ - 'error', - 'unix' - ], - quotes: [ - 'error', - 'single' - ], - semi: [ - 'error', - 'always' - ], - 'no-console': 0, - 'no-undef': 'warn' - }, - globals: { - BigInt64Array: true, - BigUint64Array: true - } -}; diff --git a/.travis.yml b/.travis.yml index ddddc8940..60a7a9d37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,9 @@ matrix: script: - cargo test # Check JS output from all tests against eslint - - ./node_modules/.bin/eslint ./target/generated-tests/*/out*js + - npm run run-lint-generated-tests + # Check Examples against eslint + - npm run run-lint-examples addons: firefox: latest diff --git a/examples/add/index.js b/examples/add/index.js index 276746161..5d94c1ec0 100644 --- a/examples/add/index.js +++ b/examples/add/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./add"); +const rust = import('./add'); rust.then(m => alert('1 + 2 = ' + m.add(1, 2))); diff --git a/examples/add/webpack.config.js b/examples/add/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/add/webpack.config.js +++ b/examples/add/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/asm.js/webpack.config.js b/examples/asm.js/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/asm.js/webpack.config.js +++ b/examples/asm.js/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/char/chars.js b/examples/char/chars.js index 563ad71d1..3acd92bfd 100644 --- a/examples/char/chars.js +++ b/examples/char/chars.js @@ -1,85 +1,86 @@ export let chars = [ -"!","#","$","%","&","'","(",")","*","+",",", -"-",".","/","0","1","2","3","4","5","6","7", -"8","9",":",";","<","=",">","?","@","A","B", -"C","D","E","F","G","H","I","J","K","L","M", -"N","O","P","Q","R","S","T","U","V","W","X", -"Y","Z","[","]","^","_","`","a","b","c", -"d","e","f","g","h","i","j","k","l","m","n", -"o","p","q","r","s","t","u","v","w","x","y", -"z","{","|","}","~"," ","¡","¢","£","¤","¥", -"¦","§","¨","©","ª","«","¬","®","¯","°", -"±","²","³","´","µ","¶","·","¸","¹","º","»", -"¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ", -"Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ", -"Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü", -"Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç", -"è","é","ê","ë","ì","í","î","ï","ð","ñ","ò", -"ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý", -"þ","ÿ","Ā","ā","Ă","ă","Ą","ą","Ć","ć","Ĉ", -"ĉ","Ċ","ċ","Č","č","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ʜ","ʝ","ʞ","ʟ", -"ʠ","ʡ","ʢ","ʣ","ʤ","ʥ","ʦ","ʧ","ʨ","ʩ","ʪ", -"ʫ","ʬ","ʭ","ʮ","ʯ","Ͳ","ͳ","ʹ","͵","Ͷ","ͷ", -"ͺ","ͻ","ͼ","ͽ",";","Ϳ","΄","΅","Ά","·","Έ","Ή", -"Ί","Ό","Ύ","Ώ", -"ΐ","Α","Β","Γ","Δ","Ε","Ζ","Η","Θ","Ι","Κ", -"Λ","Μ","Ν","Ξ","Ο","Π","Ρ","Σ","Τ","Υ","Φ", -"Χ","Ψ","Ω","Ϊ","Ϋ","ά","έ","ή","ί","ΰ","α", -"β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ", -"ν","ξ","ο","π","ρ","ς","σ","τ","υ","φ","χ", -"ψ","ω","ϊ","ϋ","ό","ύ","ώ","Ϗ","ϐ","ϑ","ϒ", -"ϓ","ϔ","ϕ","ϖ","ϗ","Ϙ","ϙ","Ϛ","ϛ","Ϝ","ϝ", -"Ϟ","ϟ","Ϡ","ϡ","Ϣ","ϣ","Ϥ","ϥ","Ϧ","ϧ","Ϩ", -"ϩ","Ϫ","ϫ","Ϭ","ϭ","Ϯ","ϯ","ϰ","ϱ","ϲ","ϳ", -"Օ","Ֆ","🕧","🕨","🕩","🕪","🕫","🕬","🕭","🕮", -"🕯","🕰","🕱","🕲","🕳","🕴","🕵","🕶","🕷","🕸", -"🕹","🕺","🕻","🕼","🕽","🕾","🕿","🖀","🖁","🖂", -"🖃","🖄","🖅","🖆","🖇","🖈","🖉","🖊","🖋", -"🖌","🖍","🖎","🖏","🖐","🖑","🖒","🖓","🖔","🖕", -"🖖","🖗","🖘","🖙","🖚","🖛","🖜","🖝","🖞","🖟", -"🖠","🖡","🖢","🖣","🖤","🖥","🖦","🖧","🖨","🖩", -"🖪","🖫","🖬","🖭","🖮","🖯","🖰","🖱","🖲","🖳", -"🖴","🖵","🖶","🖷","🖸","🖹","🖺","🖻","🖼","🖽", -"🖾","🖿","🗀","🗁","🗂","🗃","🗄","🗅","🗆","🗇", -"🗈","🗉","🗊","🗋","🗌","🗍","🗎","🗏","🗐","🗑","🗒", -"🗓","🗔","🗕","🗖","🗗","🗘","🗙","🗚","🗛","🗜", -"🗝","🗞","🗟","🗠","🗡","🗢","🗣","🗤","🗥","🗦", -"🗧","🗨","🗩","🗪","🗫","🗬","🗭","🗮","🗯","🗰", -"🗱","🗲","🗳","🗴","🗵","🗶","🗷","🗸","🗹","🗺", -"🗻","🗼","🗽","🗾","🗿","😀"]; \ No newline at end of file + '!','#','$','%','&','\'','(',')','*','+',',', + '-','.','/','0','1','2','3','4','5','6','7', + '8','9',':',';','<','=','>','?','@','A','B', + 'C','D','E','F','G','H','I','J','K','L','M', + 'N','O','P','Q','R','S','T','U','V','W','X', + 'Y','Z','[',']','^','_','`','a','b','c', + 'd','e','f','g','h','i','j','k','l','m','n', + 'o','p','q','r','s','t','u','v','w','x','y', + 'z','{','|','}','~',' ','¡','¢','£','¤','¥', + '¦','§','¨','©','ª','«','¬','®','¯','°', + '±','²','³','´','µ','¶','·','¸','¹','º','»', + '¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ', + 'Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ', + 'Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü', + 'Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç', + 'è','é','ê','ë','ì','í','î','ï','ð','ñ','ò', + 'ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý', + 'þ','ÿ','Ā','ā','Ă','ă','Ą','ą','Ć','ć','Ĉ', + 'ĉ','Ċ','ċ','Č','č','Ď','ď','Đ','đ','Ē','ē', + 'Ĕ','ĕ','Ė','ė','Ę','ę','Ě','ě','Ĝ','ĝ','Ğ', + 'ğ','Ġ','ġ','Ģ','ģ','Ĥ','ĥ','Ħ','ħ','Ĩ','ĩ', + 'Ī','ī','Ĭ','ĭ','Į','į','İ','ı','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','Ͷ','ͷ', + 'ͺ','ͻ','ͼ','ͽ',';','Ϳ','΄','΅','Ά','·','Έ','Ή', + 'Ί','Ό','Ύ','Ώ', + 'ΐ','Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ', + 'Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ', + 'Χ','Ψ','Ω','Ϊ','Ϋ','ά','έ','ή','ί','ΰ','α', + 'β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ', + 'ν','ξ','ο','π','ρ','ς','σ','τ','υ','φ','χ', + 'ψ','ω','ϊ','ϋ','ό','ύ','ώ','Ϗ','ϐ','ϑ','ϒ', + 'ϓ','ϔ','ϕ','ϖ','ϗ','Ϙ','ϙ','Ϛ','ϛ','Ϝ','ϝ', + 'Ϟ','ϟ','Ϡ','ϡ','Ϣ','ϣ','Ϥ','ϥ','Ϧ','ϧ','Ϩ', + 'ϩ','Ϫ','ϫ','Ϭ','ϭ','Ϯ','ϯ','ϰ','ϱ','ϲ','ϳ', + 'Օ','Ֆ','🕧','🕨','🕩','🕪','🕫','🕬','🕭','🕮', + '🕯','🕰','🕱','🕲','🕳','🕴','🕵','🕶','🕷','🕸', + '🕹','🕺','🕻','🕼','🕽','🕾','🕿','🖀','🖁','🖂', + '🖃','🖄','🖅','🖆','🖇','🖈','🖉','🖊','🖋', + '🖌','🖍','🖎','🖏','🖐','🖑','🖒','🖓','🖔','🖕', + '🖖','🖗','🖘','🖙','🖚','🖛','🖜','🖝','🖞','🖟', + '🖠','🖡','🖢','🖣','🖤','🖥','🖦','🖧','🖨','🖩', + '🖪','🖫','🖬','🖭','🖮','🖯','🖰','🖱','🖲','🖳', + '🖴','🖵','🖶','🖷','🖸','🖹','🖺','🖻','🖼','🖽', + '🖾','🖿','🗀','🗁','🗂','🗃','🗄','🗅','🗆','🗇', + '🗈','🗉','🗊','🗋','🗌','🗍','🗎','🗏','🗐','🗑','🗒', + '🗓','🗔','🗕','🗖','🗗','🗘','🗙','🗚','🗛','🗜', + '🗝','🗞','🗟','🗠','🗡','🗢','🗣','🗤','🗥','🗦', + '🗧','🗨','🗩','🗪','🗫','🗬','🗭','🗮','🗯','🗰', + '🗱','🗲','🗳','🗴','🗵','🗶','🗷','🗸','🗹','🗺', + '🗻','🗼','🗽','🗾','🗿','😀']; + diff --git a/examples/char/index.js b/examples/char/index.js index dc0418536..d5adbf2f5 100644 --- a/examples/char/index.js +++ b/examples/char/index.js @@ -1,5 +1,6 @@ -import {chars} from './chars.js' -let imp = import('./char.js') +/* eslint-disable no-unused-vars */ +import {chars} from './chars.js'; +let imp = import('./char.js'); let mod; let counters = []; @@ -8,7 +9,7 @@ imp.then(wasm => { addCounter(); let b = document.getElementById('add-counter'); if (!b) throw new Error('Unable to find #add-counter'); - b.addEventListener('click', ev => addCounter()) + b.addEventListener('click', ev => addCounter()); }); function addCounter() { @@ -21,7 +22,7 @@ function update() { let container = document.getElementById('container'); if (!container) throw new Error('Unable to find #container in dom'); while (container.hasChildNodes()) { - if (container.lastChild.id == "add-counter") break; + if (container.lastChild.id == 'add-counter') break; container.removeChild(container.lastChild); } for (var i = 0; i < counters.length; i++) { @@ -29,7 +30,7 @@ function update() { container.appendChild(newCounter(counter.key(), counter.count(), ev => { counter.increment(); update(); - })) + })); } } diff --git a/examples/char/webpack.config.js b/examples/char/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/char/webpack.config.js +++ b/examples/char/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/closures/index.js b/examples/closures/index.js index 3035ac7ab..6c2133e53 100644 --- a/examples/closures/index.js +++ b/examples/closures/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./closures"); +const rust = import('./closures'); rust.then(m => m.run()); diff --git a/examples/closures/webpack.config.js b/examples/closures/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/closures/webpack.config.js +++ b/examples/closures/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/comments/index.js b/examples/comments/index.js index f0bb93f03..72caa2cd9 100644 --- a/examples/comments/index.js +++ b/examples/comments/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ const mod = import('./comments'); let wasm; mod.then(m => { @@ -48,7 +49,7 @@ function storeComments() { name: c.name(), comment: c.comment(), count: c.count, - } + }; }); localStorage.setItem('comments', JSON.stringify(json)); } @@ -118,10 +119,10 @@ function renderComment(comment) { bottom.appendChild(title); let text = document.createElement('span'); text.setAttribute('class', 'comment-text'); - text.appendChild(document.createTextNode(comment.comment())) + text.appendChild(document.createTextNode(comment.comment())); bottom.appendChild(text); div.appendChild(top); - div.appendChild(bottom) + div.appendChild(bottom); return div; } diff --git a/examples/comments/webpack.config.js b/examples/comments/webpack.config.js index 644d9bc37..4b5f4574b 100644 --- a/examples/comments/webpack.config.js +++ b/examples/comments/webpack.config.js @@ -1,11 +1,11 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development", - devtool: 'source-map', + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development', + devtool: 'source-map', }; diff --git a/examples/console_log/index.js b/examples/console_log/index.js index 73304d823..09cab0de7 100644 --- a/examples/console_log/index.js +++ b/examples/console_log/index.js @@ -1,5 +1,5 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./console_log"); +const rust = import('./console_log'); rust.then(m => m.run()); diff --git a/examples/console_log/webpack.config.js b/examples/console_log/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/console_log/webpack.config.js +++ b/examples/console_log/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/dom/index.js b/examples/dom/index.js index d47e9abd6..61fe73795 100644 --- a/examples/dom/index.js +++ b/examples/dom/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./dom"); +const rust = import('./dom'); rust.then(m => m.run()); diff --git a/examples/dom/webpack.config.js b/examples/dom/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/dom/webpack.config.js +++ b/examples/dom/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/hello_world/index.js b/examples/hello_world/index.js index 4312dbdc7..488fc4688 100644 --- a/examples/hello_world/index.js +++ b/examples/hello_world/index.js @@ -1,6 +1,6 @@ // Note that a dynamic `import` statement here is required due to // webpack/webpack#6615, but in theory `import { greet } from './hello_world';` // will work here one day as well! -const rust = import("./hello_world"); +const rust = import('./hello_world'); -rust.then(m => m.greet("World!")); +rust.then(m => m.greet('World!')); diff --git a/examples/hello_world/webpack.config.js b/examples/hello_world/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/hello_world/webpack.config.js +++ b/examples/hello_world/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/import_js/defined-in-js.js b/examples/import_js/defined-in-js.js index 248545077..ed5091b02 100644 --- a/examples/import_js/defined-in-js.js +++ b/examples/import_js/defined-in-js.js @@ -1,21 +1,21 @@ export function name() { - return 'World'; + return 'World'; } export class MyClass { - constructor() { - this._number = 42; - } + constructor() { + this._number = 42; + } - get number() { - return this._number; - } + get number() { + return this._number; + } - set number(n) { - return this._number = n; - } + set number(n) { + return this._number = n; + } - render() { - return `My number is: ${this.number}`; - } + render() { + return `My number is: ${this.number}`; + } } diff --git a/examples/import_js/index.js b/examples/import_js/index.js index 791d82670..e41c33aa6 100644 --- a/examples/import_js/index.js +++ b/examples/import_js/index.js @@ -1,5 +1,5 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./import_js"); +const rust = import('./import_js'); rust.then(m => m.run()); diff --git a/examples/import_js/webpack.config.js b/examples/import_js/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/import_js/webpack.config.js +++ b/examples/import_js/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/math/index.js b/examples/math/index.js index ff5e25fce..776e82959 100644 --- a/examples/math/index.js +++ b/examples/math/index.js @@ -1,10 +1,10 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./math"); +const rust = import('./math'); rust.then(m => { - m.run(); - console.log('and in JS the answers look like:'); - console.log(`Math.log2(10.0) = ${Math.log2(10.0)}`); - console.log(`Math.sin(1.2) = ${Math.sin(1.2)}`); + m.run(); + console.log('and in JS the answers look like:'); + console.log(`Math.log2(10.0) = ${Math.log2(10.0)}`); + console.log(`Math.sin(1.2) = ${Math.sin(1.2)}`); }); diff --git a/examples/math/webpack.config.js b/examples/math/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/math/webpack.config.js +++ b/examples/math/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/performance/index.js b/examples/performance/index.js index 4f8b5eff7..33b7561a8 100644 --- a/examples/performance/index.js +++ b/examples/performance/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./performance"); +const rust = import('./performance'); rust.then(m => m.run()); diff --git a/examples/performance/webpack.config.js b/examples/performance/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/performance/webpack.config.js +++ b/examples/performance/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/smorgasboard/README.md b/examples/smorgasboard/README.md index 4dd7a62d1..9f1cd28f6 100644 --- a/examples/smorgasboard/README.md +++ b/examples/smorgasboard/README.md @@ -2,7 +2,7 @@ [View this example online](https://webassembly.studio/?f=t61j18noqz) -This directory is an smattering of examples using the `#[wasm_bindgen]` macro. +This directory is a smattering of examples using the `#[wasm_bindgen]` macro. Here we see passing strings back and for, exporting classes from Rust to JS, importing classes from JS to Rust, etc. diff --git a/examples/smorgasboard/app.js b/examples/smorgasboard/app.js index 5a0a231a5..69d9a689f 100644 --- a/examples/smorgasboard/app.js +++ b/examples/smorgasboard/app.js @@ -1,9 +1,9 @@ -import { Foo, Bar, concat } from "./smorgasboard"; +import { Foo, Bar, concat } from './smorgasboard'; function assertEq(a, b) { - if (a !== b) - throw new Error(`${a} != ${b}`); - console.log(`found ${a} === ${b}`); + if (a !== b) + throw new Error(`${a} != ${b}`); + console.log(`found ${a} === ${b}`); } assertEq(concat('a', 'b'), 'ab'); @@ -18,7 +18,7 @@ foo.free(); // Pass objects to one another let foo1 = new Foo(); -let bar = Bar.from_str("22", { opaque: 'object' }); +let bar = Bar.from_str('22', { opaque: 'object' }); foo1.add_other(bar); // We also don't have to `free` the `bar` variable as this function is @@ -29,4 +29,4 @@ foo1.consume_other(bar); assertEq(foo1.add(2), 22 + 34 + 2); foo1.free(); -alert('all passed!') +alert('all passed!'); diff --git a/examples/smorgasboard/awesome.js b/examples/smorgasboard/awesome.js index 896cc0015..e6824b703 100644 --- a/examples/smorgasboard/awesome.js +++ b/examples/smorgasboard/awesome.js @@ -1,14 +1,14 @@ export function bar_on_reset(s, token) { - console.log(token); - console.log(`this instance of bar was reset to ${s}`); + console.log(token); + console.log(`this instance of bar was reset to ${s}`); } export class Awesome { - constructor() { - this.internal = 32; - } + constructor() { + this.internal = 32; + } - get_internal() { - return this.internal; - } + get_internal() { + return this.internal; + } } diff --git a/examples/smorgasboard/index.js b/examples/smorgasboard/index.js index 17ff8acf4..b5fb9009e 100644 --- a/examples/smorgasboard/index.js +++ b/examples/smorgasboard/index.js @@ -1 +1 @@ -import("./app"); +import('./app'); diff --git a/examples/smorgasboard/webpack.config.js b/examples/smorgasboard/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/smorgasboard/webpack.config.js +++ b/examples/smorgasboard/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/examples/wasm-in-wasm/index.js b/examples/wasm-in-wasm/index.js index 80e75dcf1..e01116928 100644 --- a/examples/wasm-in-wasm/index.js +++ b/examples/wasm-in-wasm/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -const rust = import("./wasm_in_wasm"); +const rust = import('./wasm_in_wasm'); rust.then(m => m.run()); diff --git a/examples/wasm-in-wasm/webpack.config.js b/examples/wasm-in-wasm/webpack.config.js index 5910e2ae1..dce271493 100644 --- a/examples/wasm-in-wasm/webpack.config.js +++ b/examples/wasm-in-wasm/webpack.config.js @@ -1,10 +1,10 @@ const path = require('path'); module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js", - }, - mode: "development" + entry: './index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + mode: 'development' }; diff --git a/package.json b/package.json index 995f245f6..9c1225d3b 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,13 @@ "scripts": { "run-webpack": "webpack", "run-webpack-dev-server": "webpack-dev-server", - "run-geckodriver": "geckodriver" + "run-geckodriver": "geckodriver", + "run-lint-examples": "eslint ./examples", + "run-lint-generated-tests": "eslint ./target/generated-tests/*/out*js" }, "devDependencies": { "@types/node": "^10.5.2", + "babel-eslint": "^8.2.5", "eslint": "^5.0.1", "geckodriver": "^1.11.0", "selenium-webdriver": "^4.0.0-alpha.1", @@ -14,7 +17,6 @@ "typescript": "^2.7.2", "webpack": "^4.15.1", "webpack-cli": "^3.0.8", - "webpack-dev-server": "^3.1.4", - "babel-eslint": "^8.2.5" + "webpack-dev-server": "^3.1.4" } }