Skip to content

Commit dd14bb3

Browse files
committed
Format wasm/ according to prettier rules
1 parent 2d246f0 commit dd14bb3

8 files changed

Lines changed: 47 additions & 42 deletions

File tree

wasm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ print(js_vars['a'] * 9)
4949
`,
5050
{
5151
vars: {
52-
a: 9
53-
}
52+
a: 9,
53+
},
5454
}
5555
);
5656
```

wasm/demo/src/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ let rp;
1111

1212
// A dependency graph that contains any wasm must be imported asynchronously.
1313
import('rustpython')
14-
.then(rustpy => {
14+
.then((rustpy) => {
1515
rp = rustpy;
1616
// so people can play around with it
1717
window.rp = rustpy;
1818
onReady();
1919
})
20-
.catch(e => {
20+
.catch((e) => {
2121
console.error('Error importing `rustpython`:', e);
2222
document.getElementById('error').textContent = e;
2323
});
@@ -29,15 +29,15 @@ const editor = CodeMirror.fromTextArea(document.getElementById('code'), {
2929
'Shift-Tab': 'indentLess',
3030
'Ctrl-/': 'toggleComment',
3131
'Cmd-/': 'toggleComment',
32-
Tab: editor => {
32+
Tab: (editor) => {
3333
var spaces = Array(editor.getOption('indentUnit') + 1).join(' ');
3434
editor.replaceSelection(spaces);
35-
}
35+
},
3636
},
3737
lineNumbers: true,
3838
mode: 'text/x-python',
3939
indentUnit: 4,
40-
autofocus: true
40+
autofocus: true,
4141
});
4242

4343
const consoleElement = document.getElementById('console');
@@ -51,15 +51,15 @@ function runCodeFromTextarea() {
5151
const code = editor.getValue();
5252
try {
5353
rp.pyExec(code, {
54-
stdout: output => {
54+
stdout: (output) => {
5555
const shouldScroll =
5656
consoleElement.scrollHeight - consoleElement.scrollTop ===
5757
consoleElement.clientHeight;
5858
consoleElement.value += output;
5959
if (shouldScroll) {
6060
consoleElement.scrollTop = consoleElement.scrollHeight;
6161
}
62-
}
62+
},
6363
});
6464
} catch (err) {
6565
if (err instanceof WebAssembly.RuntimeError) {
@@ -79,7 +79,7 @@ function updateSnippet() {
7979
// dynamically.
8080
// https://webpack.js.org/guides/dependency-management/
8181
const {
82-
default: snippet
82+
default: snippet,
8383
} = require(`raw-loader!../snippets/${selected}.py`);
8484

8585
editor.setValue(snippet);
@@ -148,8 +148,8 @@ function onReady() {
148148
runCodeFromTextarea();
149149

150150
terminalVM = rp.vmStore.init('term_vm');
151-
terminalVM.setStdout(data => localEcho.print(data));
152-
readPrompts().catch(err => console.error(err));
151+
terminalVM.setStdout((data) => localEcho.print(data));
152+
readPrompts().catch((err) => console.error(err));
153153

154154
// so that the test knows that we're ready
155155
const readyElement = document.createElement('div');

wasm/demo/webpack.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ module.exports = (env = {}) => {
1111
entry: './src/index.js',
1212
output: {
1313
path: path.join(__dirname, 'dist'),
14-
filename: 'index.js'
14+
filename: 'index.js',
1515
},
1616
mode: 'development',
1717
resolve: {
1818
alias: {
1919
rustpython: path.resolve(
2020
__dirname,
2121
env.rustpythonPkg || '../lib/pkg'
22-
)
23-
}
22+
),
23+
},
2424
},
2525
module: {
2626
rules: [
2727
{
2828
test: /\.css$/,
29-
use: [MiniCssExtractPlugin.loader, 'css-loader']
30-
}
31-
]
29+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
30+
},
31+
],
3232
},
3333
plugins: [
3434
new CleanWebpackPlugin(),
@@ -38,24 +38,24 @@ module.exports = (env = {}) => {
3838
templateParameters: {
3939
snippets: fs
4040
.readdirSync(path.join(__dirname, 'snippets'))
41-
.map(filename =>
41+
.map((filename) =>
4242
path.basename(filename, path.extname(filename))
4343
),
4444
defaultSnippetName: 'fibonacci',
4545
defaultSnippet: fs.readFileSync(
4646
path.join(__dirname, 'snippets/fibonacci.py')
47-
)
48-
}
47+
),
48+
},
4949
}),
5050
new MiniCssExtractPlugin({
51-
filename: 'styles.css'
51+
filename: 'styles.css',
5252
}),
53-
]
53+
],
5454
};
5555
if (!env.noWasmPack) {
5656
config.plugins.push(
5757
new WasmPackPlugin({
58-
crateDirectory: path.join(__dirname, '../lib')
58+
crateDirectory: path.join(__dirname, '../lib'),
5959
})
6060
);
6161
}

wasm/example/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// A dependency graph that contains any wasm must all be imported
22
// asynchronously. This `index.js` file does the single async import, so
33
// that no one else needs to worry about it again.
4-
import('./main.js').catch(e => {
4+
import('./main.js').catch((e) => {
55
console.error('Error importing `main.js`:', e);
66
});

wasm/example/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
output: {
77
path: path.join(__dirname, 'dist'),
88
filename: 'app.js',
9-
publicPath: '/dist/'
9+
publicPath: '/dist/',
1010
},
11-
devtool: 'cheap-module-eval-source-map'
11+
devtool: 'cheap-module-eval-source-map',
1212
};

wasm/notebook/snippets/python-js-css/css.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ h1 {
66
font-family: 'Sen', 'sans-serif';
77
}
88

9-
h2, h3, h4, button {
9+
h2,
10+
h3,
11+
h4,
12+
button {
1013
font-family: 'Turret Road', cursive;
1114
}
1215

1316
h1 {
1417
font-size: 1.5rem;
1518
}
16-
h2, h3, h4 {
19+
h2,
20+
h3,
21+
h4 {
1722
padding-top: 1.25rem;
1823
}
1924

wasm/notebook/src/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ ul.list-inline li {
140140
height: calc(90vh - 60px);
141141
}
142142

143-
.CodeMirror, .CodeMirror-wrap {
143+
.CodeMirror,
144+
.CodeMirror-wrap {
144145
height: 100% !important;
145146
}
146147
#rp-notebook {
@@ -248,7 +249,6 @@ input[type='url'] {
248249
.md-flex-grow {
249250
flex-grow: 1;
250251
}
251-
252252
}
253253

254254
@media screen and (max-width: 768px) {

wasm/notebook/webpack.config.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ module.exports = (env = {}) => {
1111
entry: './src/index.js',
1212
output: {
1313
path: path.join(__dirname, 'dist'),
14-
filename: 'index.js'
14+
filename: 'index.js',
1515
},
1616
mode: 'development',
1717
resolve: {
1818
alias: {
1919
rustpython: path.resolve(
2020
__dirname,
2121
env.rustpythonPkg || '../lib/pkg'
22-
)
23-
}
22+
),
23+
},
2424
},
2525
module: {
2626
rules: [
2727
{
2828
test: /\.css$/,
29-
use: [MiniCssExtractPlugin.loader, 'css-loader']
29+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
3030
},
3131
{
3232
test: /\.(woff(2)?|ttf)$/,
3333
use: {
34-
loader:"file-loader",
35-
options: { name: "fonts/[name].[ext]" }
34+
loader: 'file-loader',
35+
options: { name: 'fonts/[name].[ext]' },
3636
},
37-
}
38-
]
37+
},
38+
],
3939
},
4040
plugins: [
4141
new CleanWebpackPlugin(),
@@ -55,15 +55,15 @@ module.exports = (env = {}) => {
5555
// }
5656
}),
5757
new MiniCssExtractPlugin({
58-
filename: 'styles.css'
58+
filename: 'styles.css',
5959
}),
60-
]
60+
],
6161
};
6262
if (!env.noWasmPack) {
6363
config.plugins.push(
6464
new WasmPackPlugin({
6565
crateDirectory: path.join(__dirname, '../lib'),
66-
forceMode: 'release'
66+
forceMode: 'release',
6767
})
6868
);
6969
}

0 commit comments

Comments
 (0)